mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
a8a4aa3d98
commit
deb1f8b20a
|
@ -18428,7 +18428,7 @@ def runDaemon(content_license_url: str,
|
||||||
dormant_months: int,
|
dormant_months: int,
|
||||||
max_newswire_posts: int,
|
max_newswire_posts: int,
|
||||||
allow_local_network_access: bool,
|
allow_local_network_access: bool,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
publishButtonAtTop: bool,
|
publishButtonAtTop: bool,
|
||||||
rssIconAtTop: bool,
|
rssIconAtTop: bool,
|
||||||
iconsAsButtons: bool,
|
iconsAsButtons: bool,
|
||||||
|
@ -18675,7 +18675,7 @@ def runDaemon(content_license_url: str,
|
||||||
httpd.publishButtonAtTop = publishButtonAtTop
|
httpd.publishButtonAtTop = publishButtonAtTop
|
||||||
|
|
||||||
# maximum size of individual RSS feed items, in K
|
# maximum size of individual RSS feed items, in K
|
||||||
httpd.maxFeedItemSizeKb = maxFeedItemSizeKb
|
httpd.max_feed_item_size_kb = max_feed_item_size_kb
|
||||||
|
|
||||||
# maximum size of a hashtag category, in K
|
# maximum size of a hashtag category, in K
|
||||||
httpd.maxCategoriesFeedItemSizeKb = 1024
|
httpd.maxCategoriesFeedItemSizeKb = 1024
|
||||||
|
|
14
epicyon.py
14
epicyon.py
|
@ -199,8 +199,8 @@ parser.add_argument('--maxFeedSize',
|
||||||
dest='maxNewswireFeedSizeKb', type=int,
|
dest='maxNewswireFeedSizeKb', type=int,
|
||||||
default=10240,
|
default=10240,
|
||||||
help='Maximum newswire rss/atom feed size in K')
|
help='Maximum newswire rss/atom feed size in K')
|
||||||
parser.add_argument('--maxFeedItemSizeKb',
|
parser.add_argument('--max_feed_item_size_kb',
|
||||||
dest='maxFeedItemSizeKb', type=int,
|
dest='max_feed_item_size_kb', type=int,
|
||||||
default=2048,
|
default=2048,
|
||||||
help='Maximum size of an individual rss/atom ' +
|
help='Maximum size of an individual rss/atom ' +
|
||||||
'feed item in K')
|
'feed item in K')
|
||||||
|
@ -3058,10 +3058,10 @@ maxFollowers = \
|
||||||
if maxFollowers is not None:
|
if maxFollowers is not None:
|
||||||
args.maxFollowers = int(maxFollowers)
|
args.maxFollowers = int(maxFollowers)
|
||||||
|
|
||||||
maxFeedItemSizeKb = \
|
max_feed_item_size_kb = \
|
||||||
getConfigParam(base_dir, 'maxFeedItemSizeKb')
|
getConfigParam(base_dir, 'max_feed_item_size_kb')
|
||||||
if maxFeedItemSizeKb is not None:
|
if max_feed_item_size_kb is not None:
|
||||||
args.maxFeedItemSizeKb = int(maxFeedItemSizeKb)
|
args.max_feed_item_size_kb = int(max_feed_item_size_kb)
|
||||||
|
|
||||||
dormant_months = \
|
dormant_months = \
|
||||||
getConfigParam(base_dir, 'dormant_months')
|
getConfigParam(base_dir, 'dormant_months')
|
||||||
|
@ -3226,7 +3226,7 @@ if __name__ == "__main__":
|
||||||
args.dormant_months,
|
args.dormant_months,
|
||||||
args.max_newswire_posts,
|
args.max_newswire_posts,
|
||||||
args.allow_local_network_access,
|
args.allow_local_network_access,
|
||||||
args.maxFeedItemSizeKb,
|
args.max_feed_item_size_kb,
|
||||||
args.publishButtonAtTop,
|
args.publishButtonAtTop,
|
||||||
args.rssIconAtTop,
|
args.rssIconAtTop,
|
||||||
args.iconsAsButtons,
|
args.iconsAsButtons,
|
||||||
|
|
|
@ -799,7 +799,7 @@ def runNewswireDaemon(base_dir: str, httpd,
|
||||||
httpd.max_newswire_postsPerSource,
|
httpd.max_newswire_postsPerSource,
|
||||||
httpd.maxNewswireFeedSizeKb,
|
httpd.maxNewswireFeedSizeKb,
|
||||||
httpd.maxTags,
|
httpd.maxTags,
|
||||||
httpd.maxFeedItemSizeKb,
|
httpd.max_feed_item_size_kb,
|
||||||
httpd.max_newswire_posts,
|
httpd.max_newswire_posts,
|
||||||
httpd.maxCategoriesFeedItemSizeKb,
|
httpd.maxCategoriesFeedItemSizeKb,
|
||||||
httpd.systemLanguage,
|
httpd.systemLanguage,
|
||||||
|
|
40
newswire.py
40
newswire.py
|
@ -381,7 +381,7 @@ def _xml2StrToHashtagCategories(base_dir: str, xmlStr: str,
|
||||||
def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str,
|
def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
maxCategoriesFeedItemSizeKb: int,
|
maxCategoriesFeedItemSizeKb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts an xml RSS 2.0 string to a dictionary
|
"""Converts an xml RSS 2.0 string to a dictionary
|
||||||
|
@ -398,7 +398,7 @@ def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
|
|
||||||
rssItems = xmlStr.split('<item>')
|
rssItems = xmlStr.split('<item>')
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = max_feed_item_size_kb * 1024
|
||||||
for rssItem in rssItems:
|
for rssItem in rssItems:
|
||||||
if not rssItem:
|
if not rssItem:
|
||||||
continue
|
continue
|
||||||
|
@ -465,7 +465,7 @@ def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str,
|
def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
maxCategoriesFeedItemSizeKb: int,
|
maxCategoriesFeedItemSizeKb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts an xml RSS 1.0 string to a dictionary
|
"""Converts an xml RSS 1.0 string to a dictionary
|
||||||
|
@ -484,7 +484,7 @@ def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
|
|
||||||
rssItems = xmlStr.split(itemStr)
|
rssItems = xmlStr.split(itemStr)
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = max_feed_item_size_kb * 1024
|
||||||
for rssItem in rssItems:
|
for rssItem in rssItems:
|
||||||
if not rssItem:
|
if not rssItem:
|
||||||
continue
|
continue
|
||||||
|
@ -553,7 +553,7 @@ def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str,
|
def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts an atom feed string to a dictionary
|
"""Converts an atom feed string to a dictionary
|
||||||
"""
|
"""
|
||||||
|
@ -562,7 +562,7 @@ def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
result = {}
|
result = {}
|
||||||
atomItems = xmlStr.split('<entry>')
|
atomItems = xmlStr.split('<entry>')
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = max_feed_item_size_kb * 1024
|
||||||
for atomItem in atomItems:
|
for atomItem in atomItems:
|
||||||
if not atomItem:
|
if not atomItem:
|
||||||
continue
|
continue
|
||||||
|
@ -629,7 +629,7 @@ def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str,
|
def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts a json feed string to a dictionary
|
"""Converts a json feed string to a dictionary
|
||||||
See https://jsonfeed.org/version/1.1
|
See https://jsonfeed.org/version/1.1
|
||||||
|
@ -641,7 +641,7 @@ def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
except BaseException:
|
except BaseException:
|
||||||
print('EX: _jsonFeedV1ToDict unable to load json ' + str(xmlStr))
|
print('EX: _jsonFeedV1ToDict unable to load json ' + str(xmlStr))
|
||||||
return {}
|
return {}
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = max_feed_item_size_kb * 1024
|
||||||
if not feedJson.get('version'):
|
if not feedJson.get('version'):
|
||||||
return {}
|
return {}
|
||||||
if not feedJson['version'].startswith('https://jsonfeed.org/version/1'):
|
if not feedJson['version'].startswith('https://jsonfeed.org/version/1'):
|
||||||
|
@ -741,7 +741,7 @@ def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str,
|
def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts an atom-style YouTube feed string to a dictionary
|
"""Converts an atom-style YouTube feed string to a dictionary
|
||||||
"""
|
"""
|
||||||
|
@ -752,7 +752,7 @@ def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
result = {}
|
result = {}
|
||||||
atomItems = xmlStr.split('<entry>')
|
atomItems = xmlStr.split('<entry>')
|
||||||
postCtr = 0
|
postCtr = 0
|
||||||
maxBytes = maxFeedItemSizeKb * 1024
|
maxBytes = max_feed_item_size_kb * 1024
|
||||||
for atomItem in atomItems:
|
for atomItem in atomItems:
|
||||||
if not atomItem:
|
if not atomItem:
|
||||||
continue
|
continue
|
||||||
|
@ -813,7 +813,7 @@ def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
def _xmlStrToDict(base_dir: str, domain: str, xmlStr: str,
|
def _xmlStrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int,
|
maxPostsPerSource: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
maxCategoriesFeedItemSizeKb: int,
|
maxCategoriesFeedItemSizeKb: int,
|
||||||
session, debug: bool) -> {}:
|
session, debug: bool) -> {}:
|
||||||
"""Converts an xml string to a dictionary
|
"""Converts an xml string to a dictionary
|
||||||
|
@ -822,29 +822,29 @@ def _xmlStrToDict(base_dir: str, domain: str, xmlStr: str,
|
||||||
print('YouTube feed: reading')
|
print('YouTube feed: reading')
|
||||||
return _atomFeedYTToDict(base_dir, domain,
|
return _atomFeedYTToDict(base_dir, domain,
|
||||||
xmlStr, moderated, mirrored,
|
xmlStr, moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedItemSizeKb,
|
maxPostsPerSource, max_feed_item_size_kb,
|
||||||
session, debug)
|
session, debug)
|
||||||
elif 'rss version="2.0"' in xmlStr:
|
elif 'rss version="2.0"' in xmlStr:
|
||||||
return _xml2StrToDict(base_dir, domain,
|
return _xml2StrToDict(base_dir, domain,
|
||||||
xmlStr, moderated, mirrored,
|
xmlStr, moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedItemSizeKb,
|
maxPostsPerSource, max_feed_item_size_kb,
|
||||||
maxCategoriesFeedItemSizeKb,
|
maxCategoriesFeedItemSizeKb,
|
||||||
session, debug)
|
session, debug)
|
||||||
elif '<?xml version="1.0"' in xmlStr:
|
elif '<?xml version="1.0"' in xmlStr:
|
||||||
return _xml1StrToDict(base_dir, domain,
|
return _xml1StrToDict(base_dir, domain,
|
||||||
xmlStr, moderated, mirrored,
|
xmlStr, moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedItemSizeKb,
|
maxPostsPerSource, max_feed_item_size_kb,
|
||||||
maxCategoriesFeedItemSizeKb,
|
maxCategoriesFeedItemSizeKb,
|
||||||
session, debug)
|
session, debug)
|
||||||
elif 'xmlns="http://www.w3.org/2005/Atom"' in xmlStr:
|
elif 'xmlns="http://www.w3.org/2005/Atom"' in xmlStr:
|
||||||
return _atomFeedToDict(base_dir, domain,
|
return _atomFeedToDict(base_dir, domain,
|
||||||
xmlStr, moderated, mirrored,
|
xmlStr, moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedItemSizeKb,
|
maxPostsPerSource, max_feed_item_size_kb,
|
||||||
session, debug)
|
session, debug)
|
||||||
elif 'https://jsonfeed.org/version/1' in xmlStr:
|
elif 'https://jsonfeed.org/version/1' in xmlStr:
|
||||||
return _jsonFeedV1ToDict(base_dir, domain,
|
return _jsonFeedV1ToDict(base_dir, domain,
|
||||||
xmlStr, moderated, mirrored,
|
xmlStr, moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedItemSizeKb,
|
maxPostsPerSource, max_feed_item_size_kb,
|
||||||
session, debug)
|
session, debug)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@ def _YTchannelToAtomFeed(url: str) -> str:
|
||||||
def getRSS(base_dir: str, domain: str, session, url: str,
|
def getRSS(base_dir: str, domain: str, session, url: str,
|
||||||
moderated: bool, mirrored: bool,
|
moderated: bool, mirrored: bool,
|
||||||
maxPostsPerSource: int, maxFeedSizeKb: int,
|
maxPostsPerSource: int, maxFeedSizeKb: int,
|
||||||
maxFeedItemSizeKb: int,
|
max_feed_item_size_kb: int,
|
||||||
maxCategoriesFeedItemSizeKb: int, debug: bool) -> {}:
|
maxCategoriesFeedItemSizeKb: int, debug: bool) -> {}:
|
||||||
"""Returns an RSS url as a dict
|
"""Returns an RSS url as a dict
|
||||||
"""
|
"""
|
||||||
|
@ -895,7 +895,7 @@ def getRSS(base_dir: str, domain: str, session, url: str,
|
||||||
return _xmlStrToDict(base_dir, domain, result.text,
|
return _xmlStrToDict(base_dir, domain, result.text,
|
||||||
moderated, mirrored,
|
moderated, mirrored,
|
||||||
maxPostsPerSource,
|
maxPostsPerSource,
|
||||||
maxFeedItemSizeKb,
|
max_feed_item_size_kb,
|
||||||
maxCategoriesFeedItemSizeKb,
|
maxCategoriesFeedItemSizeKb,
|
||||||
session, debug)
|
session, debug)
|
||||||
else:
|
else:
|
||||||
|
@ -1135,7 +1135,7 @@ def _addBlogsToNewswire(base_dir: str, domain: str, newswire: {},
|
||||||
|
|
||||||
def getDictFromNewswire(session, base_dir: str, domain: str,
|
def getDictFromNewswire(session, base_dir: str, domain: str,
|
||||||
maxPostsPerSource: int, maxFeedSizeKb: int,
|
maxPostsPerSource: int, maxFeedSizeKb: int,
|
||||||
maxTags: int, maxFeedItemSizeKb: int,
|
maxTags: int, max_feed_item_size_kb: int,
|
||||||
max_newswire_posts: int,
|
max_newswire_posts: int,
|
||||||
maxCategoriesFeedItemSizeKb: int,
|
maxCategoriesFeedItemSizeKb: int,
|
||||||
systemLanguage: str, debug: bool) -> {}:
|
systemLanguage: str, debug: bool) -> {}:
|
||||||
|
@ -1178,7 +1178,7 @@ def getDictFromNewswire(session, base_dir: str, domain: str,
|
||||||
itemsList = getRSS(base_dir, domain, session, url,
|
itemsList = getRSS(base_dir, domain, session, url,
|
||||||
moderated, mirrored,
|
moderated, mirrored,
|
||||||
maxPostsPerSource, maxFeedSizeKb,
|
maxPostsPerSource, maxFeedSizeKb,
|
||||||
maxFeedItemSizeKb,
|
max_feed_item_size_kb,
|
||||||
maxCategoriesFeedItemSizeKb, debug)
|
maxCategoriesFeedItemSizeKb, debug)
|
||||||
if itemsList:
|
if itemsList:
|
||||||
for dateStr, item in itemsList.items():
|
for dateStr, item in itemsList.items():
|
||||||
|
|
Loading…
Reference in New Issue