From 1b9989bcd368eb67084294c0dff9f63bd86e887a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 2 Dec 2020 17:02:32 +0000 Subject: [PATCH] Missing parameter --- daemon.py | 3 +++ newsdaemon.py | 3 ++- newswire.py | 18 ++++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index 466cdd99d..2251567c5 100644 --- a/daemon.py +++ b/daemon.py @@ -12962,6 +12962,9 @@ def runDaemon(maxNewswirePosts: int, # maximum size of individual RSS feed items, in K httpd.maxFeedItemSizeKb = maxFeedItemSizeKb + # maximum size of a hashtag category, in K + httpd.maxCategoriesFeedItemSizeKb = 256 + if registration == 'open': httpd.registration = True else: diff --git a/newsdaemon.py b/newsdaemon.py index a08f0e200..1e1a3068b 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -717,7 +717,8 @@ def runNewswireDaemon(baseDir: str, httpd, httpd.maxNewswireFeedSizeKb, httpd.maxTags, httpd.maxFeedItemSizeKb, - httpd.maxNewswirePosts) + httpd.maxNewswirePosts, + httpd.maxCategoriesFeedItemSizeKb) if not httpd.newswire: if os.path.isfile(newswireStateFilename): diff --git a/newswire.py b/newswire.py index 088cbf9ac..bcf9bbf1d 100644 --- a/newswire.py +++ b/newswire.py @@ -455,7 +455,8 @@ def atomFeedYTToDict(baseDir: str, domain: str, xmlStr: str, def xmlStrToDict(baseDir: str, domain: str, xmlStr: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, - maxFeedItemSizeKb: int) -> {}: + maxFeedItemSizeKb: int, + maxCategoriesFeedItemSizeKb: int) -> {}: """Converts an xml string to a dictionary """ if '' in xmlStr and '' in xmlStr: @@ -466,7 +467,8 @@ def xmlStrToDict(baseDir: str, domain: str, xmlStr: str, elif 'rss version="2.0"' in xmlStr: return xml2StrToDict(baseDir, domain, xmlStr, moderated, mirrored, - maxPostsPerSource, maxFeedItemSizeKb) + maxPostsPerSource, maxFeedItemSizeKb, + maxCategoriesFeedItemSizeKb) elif 'xmlns="http://www.w3.org/2005/Atom"' in xmlStr: return atomFeedToDict(baseDir, domain, xmlStr, moderated, mirrored, @@ -489,7 +491,8 @@ def YTchannelToAtomFeed(url: str) -> str: def getRSS(baseDir: str, domain: str, session, url: str, moderated: bool, mirrored: bool, maxPostsPerSource: int, maxFeedSizeKb: int, - maxFeedItemSizeKb: int) -> {}: + maxFeedItemSizeKb: int, + maxCategoriesFeedItemSizeKb: int) -> {}: """Returns an RSS url as a dict """ if not isinstance(url, str): @@ -519,7 +522,8 @@ def getRSS(baseDir: str, domain: str, session, url: str, return xmlStrToDict(baseDir, domain, result.text, moderated, mirrored, maxPostsPerSource, - maxFeedItemSizeKb) + maxFeedItemSizeKb, + maxCategoriesFeedItemSizeKb) else: print('WARN: feed is too large, ' + 'or contains invalid characters: ' + url) @@ -753,7 +757,8 @@ def addBlogsToNewswire(baseDir: str, domain: str, newswire: {}, def getDictFromNewswire(session, baseDir: str, domain: str, maxPostsPerSource: int, maxFeedSizeKb: int, maxTags: int, maxFeedItemSizeKb: int, - maxNewswirePosts: int) -> {}: + maxNewswirePosts: int, + maxCategoriesFeedItemSizeKb: int) -> {}: """Gets rss feeds as a dictionary from newswire file """ subscriptionsFilename = baseDir + '/accounts/newswire.txt' @@ -793,7 +798,8 @@ def getDictFromNewswire(session, baseDir: str, domain: str, itemsList = getRSS(baseDir, domain, session, url, moderated, mirrored, maxPostsPerSource, maxFeedSizeKb, - maxFeedItemSizeKb) + maxFeedItemSizeKb, + maxCategoriesFeedItemSizeKb) if itemsList: for dateStr, item in itemsList.items(): result[dateStr] = item