diff --git a/daemon.py b/daemon.py index cfdcb12c7..cad20c698 100644 --- a/daemon.py +++ b/daemon.py @@ -18428,7 +18428,7 @@ def runDaemon(content_license_url: str, dormant_months: int, max_newswire_posts: int, allow_local_network_access: bool, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, publishButtonAtTop: bool, rssIconAtTop: bool, iconsAsButtons: bool, @@ -18675,7 +18675,7 @@ def runDaemon(content_license_url: str, httpd.publishButtonAtTop = publishButtonAtTop # 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 httpd.maxCategoriesFeedItemSizeKb = 1024 diff --git a/epicyon.py b/epicyon.py index ca4616792..fb95d33d0 100644 --- a/epicyon.py +++ b/epicyon.py @@ -199,8 +199,8 @@ parser.add_argument('--maxFeedSize', dest='maxNewswireFeedSizeKb', type=int, default=10240, help='Maximum newswire rss/atom feed size in K') -parser.add_argument('--maxFeedItemSizeKb', - dest='maxFeedItemSizeKb', type=int, +parser.add_argument('--max_feed_item_size_kb', + dest='max_feed_item_size_kb', type=int, default=2048, help='Maximum size of an individual rss/atom ' + 'feed item in K') @@ -3058,10 +3058,10 @@ maxFollowers = \ if maxFollowers is not None: args.maxFollowers = int(maxFollowers) -maxFeedItemSizeKb = \ - getConfigParam(base_dir, 'maxFeedItemSizeKb') -if maxFeedItemSizeKb is not None: - args.maxFeedItemSizeKb = int(maxFeedItemSizeKb) +max_feed_item_size_kb = \ + getConfigParam(base_dir, 'max_feed_item_size_kb') +if max_feed_item_size_kb is not None: + args.max_feed_item_size_kb = int(max_feed_item_size_kb) dormant_months = \ getConfigParam(base_dir, 'dormant_months') @@ -3226,7 +3226,7 @@ if __name__ == "__main__": args.dormant_months, args.max_newswire_posts, args.allow_local_network_access, - args.maxFeedItemSizeKb, + args.max_feed_item_size_kb, args.publishButtonAtTop, args.rssIconAtTop, args.iconsAsButtons, diff --git a/newsdaemon.py b/newsdaemon.py index c657ac31b..e6253cc78 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -799,7 +799,7 @@ def runNewswireDaemon(base_dir: str, httpd, httpd.max_newswire_postsPerSource, httpd.maxNewswireFeedSizeKb, httpd.maxTags, - httpd.maxFeedItemSizeKb, + httpd.max_feed_item_size_kb, httpd.max_newswire_posts, httpd.maxCategoriesFeedItemSizeKb, httpd.systemLanguage, diff --git a/newswire.py b/newswire.py index ca2dc8801..bfe8c1fd8 100644 --- a/newswire.py +++ b/newswire.py @@ -381,7 +381,7 @@ def _xml2StrToHashtagCategories(base_dir: str, xmlStr: str, def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, maxCategoriesFeedItemSizeKb: int, session, debug: bool) -> {}: """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('') postCtr = 0 - maxBytes = maxFeedItemSizeKb * 1024 + maxBytes = max_feed_item_size_kb * 1024 for rssItem in rssItems: if not rssItem: continue @@ -465,7 +465,7 @@ def _xml2StrToDict(base_dir: str, domain: str, xmlStr: str, def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, maxCategoriesFeedItemSizeKb: int, session, debug: bool) -> {}: """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) postCtr = 0 - maxBytes = maxFeedItemSizeKb * 1024 + maxBytes = max_feed_item_size_kb * 1024 for rssItem in rssItems: if not rssItem: continue @@ -553,7 +553,7 @@ def _xml1StrToDict(base_dir: str, domain: str, xmlStr: str, def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, session, debug: bool) -> {}: """Converts an atom feed string to a dictionary """ @@ -562,7 +562,7 @@ def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str, result = {} atomItems = xmlStr.split('') postCtr = 0 - maxBytes = maxFeedItemSizeKb * 1024 + maxBytes = max_feed_item_size_kb * 1024 for atomItem in atomItems: if not atomItem: continue @@ -629,7 +629,7 @@ def _atomFeedToDict(base_dir: str, domain: str, xmlStr: str, def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, session, debug: bool) -> {}: """Converts a json feed string to a dictionary See https://jsonfeed.org/version/1.1 @@ -641,7 +641,7 @@ def _jsonFeedV1ToDict(base_dir: str, domain: str, xmlStr: str, except BaseException: print('EX: _jsonFeedV1ToDict unable to load json ' + str(xmlStr)) return {} - maxBytes = maxFeedItemSizeKb * 1024 + maxBytes = max_feed_item_size_kb * 1024 if not feedJson.get('version'): return {} 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, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, session, debug: bool) -> {}: """Converts an atom-style YouTube feed string to a dictionary """ @@ -752,7 +752,7 @@ def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str, result = {} atomItems = xmlStr.split('') postCtr = 0 - maxBytes = maxFeedItemSizeKb * 1024 + maxBytes = max_feed_item_size_kb * 1024 for atomItem in atomItems: if not atomItem: continue @@ -813,7 +813,7 @@ def _atomFeedYTToDict(base_dir: str, domain: str, xmlStr: str, def _xmlStrToDict(base_dir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, maxCategoriesFeedItemSizeKb: int, session, debug: bool) -> {}: """Converts an xml string to a dictionary @@ -822,29 +822,29 @@ def _xmlStrToDict(base_dir: str, domain: str, xmlStr: str, print('YouTube feed: reading') return _atomFeedYTToDict(base_dir, domain, xmlStr, moderated, mirrored, - maxPostsPerSource, maxFeedItemSizeKb, + maxPostsPerSource, max_feed_item_size_kb, session, debug) elif 'rss version="2.0"' in xmlStr: return _xml2StrToDict(base_dir, domain, xmlStr, moderated, mirrored, - maxPostsPerSource, maxFeedItemSizeKb, + maxPostsPerSource, max_feed_item_size_kb, maxCategoriesFeedItemSizeKb, session, debug) elif ' str: def getRSS(base_dir: str, domain: str, session, url: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, maxFeedSizeKb: int, - maxFeedItemSizeKb: int, + max_feed_item_size_kb: int, maxCategoriesFeedItemSizeKb: int, debug: bool) -> {}: """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, moderated, mirrored, maxPostsPerSource, - maxFeedItemSizeKb, + max_feed_item_size_kb, maxCategoriesFeedItemSizeKb, session, debug) else: @@ -1135,7 +1135,7 @@ def _addBlogsToNewswire(base_dir: str, domain: str, newswire: {}, def getDictFromNewswire(session, base_dir: str, domain: str, maxPostsPerSource: int, maxFeedSizeKb: int, - maxTags: int, maxFeedItemSizeKb: int, + maxTags: int, max_feed_item_size_kb: int, max_newswire_posts: int, maxCategoriesFeedItemSizeKb: int, systemLanguage: str, debug: bool) -> {}: @@ -1178,7 +1178,7 @@ def getDictFromNewswire(session, base_dir: str, domain: str, itemsList = getRSS(base_dir, domain, session, url, moderated, mirrored, maxPostsPerSource, maxFeedSizeKb, - maxFeedItemSizeKb, + max_feed_item_size_kb, maxCategoriesFeedItemSizeKb, debug) if itemsList: for dateStr, item in itemsList.items():