From c3b1e9ef08a6b1b58aa540f776a4cc3088415d17 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 23 Oct 2019 11:43:20 +0100 Subject: [PATCH] Avoid checks for indexed posts --- posts.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/posts.py b/posts.py index 7c7657ca..e99eb4ec 100644 --- a/posts.py +++ b/posts.py @@ -2026,6 +2026,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \ postsInBox={} indexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxname+'.index' + lookedUpFromIndex=False if os.path.isfile(indexFilename): print('DEBUG: using index file to construct timeline') postsCtr=0 @@ -2042,6 +2043,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \ break postsInBox[postsCtr]=os.path.join(boxDir, postFilename.replace('\n','')) postsCtr+=1 + lookedUpFromIndex=True else: postsCtr=createBoxIndex(boxDir,postsInBoxDict) @@ -2112,18 +2114,21 @@ def createBoxBase(session,baseDir: str,boxname: str, \ # get the post as json p = json.loads(postStr) - if (boxname!='dm' and boxname!='tlreplies' and boxname!='tlmedia'): + if lookedUpFromIndex: isTimelinePost=True else: - if boxname=='dm': - if isDM(p): - isTimelinePost=True - elif boxname=='tlreplies': - if isDM(p) or isReply(p,boxActor): - isTimelinePost=True - elif boxname=='tlmedia': - if isImageMedia(session,baseDir,httpPrefix,nickname,domain,p): - isTimelinePost=True + if (boxname!='dm' and boxname!='tlreplies' and boxname!='tlmedia'): + isTimelinePost=True + else: + if boxname=='dm': + if isDM(p): + isTimelinePost=True + elif boxname=='tlreplies': + if isDM(p) or isReply(p,boxActor): + isTimelinePost=True + elif boxname=='tlmedia': + if isImageMedia(session,baseDir,httpPrefix,nickname,domain,p): + isTimelinePost=True if isTimelinePost and currPage == pageNumber: # remove any capability so that it's not displayed