main
Bob Mottram 2021-09-15 18:03:20 +01:00
parent 5ab2e97605
commit b715146a85
1 changed files with 8 additions and 0 deletions

View File

@ -753,6 +753,7 @@ def runNewswireDaemon(baseDir: str, httpd,
print('Newswire daemon session established') print('Newswire daemon session established')
# try to update the feeds # try to update the feeds
print('Updating newswire feeds')
newNewswire = \ newNewswire = \
getDictFromNewswire(httpd.session, baseDir, domain, getDictFromNewswire(httpd.session, baseDir, domain,
httpd.maxNewswirePostsPerSource, httpd.maxNewswirePostsPerSource,
@ -764,16 +765,22 @@ def runNewswireDaemon(baseDir: str, httpd,
httpd.systemLanguage) httpd.systemLanguage)
if not httpd.newswire: if not httpd.newswire:
print('Newswire feeds not updated')
if os.path.isfile(newswireStateFilename): if os.path.isfile(newswireStateFilename):
print('Loading newswire from file')
httpd.newswire = loadJson(newswireStateFilename) httpd.newswire = loadJson(newswireStateFilename)
print('Merging with previous newswire')
_mergeWithPreviousNewswire(httpd.newswire, newNewswire) _mergeWithPreviousNewswire(httpd.newswire, newNewswire)
httpd.newswire = newNewswire httpd.newswire = newNewswire
if newNewswire: if newNewswire:
saveJson(httpd.newswire, newswireStateFilename) saveJson(httpd.newswire, newswireStateFilename)
print('Newswire updated') print('Newswire updated')
else:
print('No new newswire')
print('Converting newswire to activitypub format')
_convertRSStoActivityPub(baseDir, _convertRSStoActivityPub(baseDir,
httpPrefix, domain, port, httpPrefix, domain, port,
newNewswire, translate, newNewswire, translate,
@ -795,6 +802,7 @@ def runNewswireDaemon(baseDir: str, httpd,
archiveDir = baseDir + '/archive' archiveDir = baseDir + '/archive'
archiveSubdir = \ archiveSubdir = \
archiveDir + '/accounts/news@' + domain + '/outbox' archiveDir + '/accounts/news@' + domain + '/outbox'
print('Archiving news posts')
archivePostsForPerson(httpPrefix, 'news', archivePostsForPerson(httpPrefix, 'news',
domain, baseDir, 'outbox', domain, baseDir, 'outbox',
archiveSubdir, archiveSubdir,