Constructing the features timeline

merge-requests/8/head
Bob Mottram 2020-11-28 13:04:30 +00:00
parent e5e3987699
commit 16f4e7a312
1 changed files with 16 additions and 3 deletions

View File

@ -2598,7 +2598,7 @@ def createBlogsTimeline(session, baseDir: str, nickname: str, domain: str,
def createFeaturesTimeline(session, baseDir: str, nickname: str, domain: str,
port: int, httpPrefix: str, itemsPerPage: int,
headerOnly: bool, pageNumber=None) -> {}:
return createBoxIndexed({}, session, baseDir, 'tlfeatures', 'news',
return createBoxIndexed({}, session, baseDir, 'tlfeatures', nickname,
domain, port, httpPrefix,
itemsPerPage, headerOnly, True,
0, False, 0, pageNumber)
@ -2946,12 +2946,14 @@ def createBoxIndexed(recentPostsCache: {},
# bookmarks and events timelines are like the inbox
# but have their own separate index
indexBoxName = boxname
timelineNickname = nickname
if boxname == "tlbookmarks":
boxname = "bookmarks"
indexBoxName = boxname
elif boxname == "tlfeatures":
boxname = "tlblogs"
indexBoxName = boxname
timelineNickname = 'news'
if port:
if port != 80 and port != 443:
@ -2989,7 +2991,7 @@ def createBoxIndexed(recentPostsCache: {},
postsInBox = []
indexFilename = \
baseDir + '/accounts/' + nickname + '@' + domain + \
baseDir + '/accounts/' + timelineNickname + '@' + domain + \
'/' + indexBoxName + '.index'
postsCtr = 0
if os.path.isfile(indexFilename):
@ -3074,7 +3076,18 @@ def createBoxIndexed(recentPostsCache: {},
addPostToTimeline(fullPostFilename, boxname,
postsInBox, boxActor)
else:
print('WARN: unable to locate post ' + postUrl)
# if this is the features timeline
if timelineNickname != nickname:
fullPostFilename = \
locatePost(baseDir, timelineNickname,
domain, postUrl, False)
if fullPostFilename:
addPostToTimeline(fullPostFilename, boxname,
postsInBox, boxActor)
else:
print('WARN: unable to locate post ' + postUrl)
else:
print('WARN: unable to locate post ' + postUrl)
postsCtr += 1