Avoid checks for indexed posts

main2
Bob Mottram 2019-10-23 11:43:20 +01:00
parent ce3e372459
commit c3b1e9ef08
1 changed files with 15 additions and 10 deletions

View File

@ -2026,6 +2026,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \
postsInBox={} postsInBox={}
indexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxname+'.index' indexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxname+'.index'
lookedUpFromIndex=False
if os.path.isfile(indexFilename): if os.path.isfile(indexFilename):
print('DEBUG: using index file to construct timeline') print('DEBUG: using index file to construct timeline')
postsCtr=0 postsCtr=0
@ -2042,6 +2043,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \
break break
postsInBox[postsCtr]=os.path.join(boxDir, postFilename.replace('\n','')) postsInBox[postsCtr]=os.path.join(boxDir, postFilename.replace('\n',''))
postsCtr+=1 postsCtr+=1
lookedUpFromIndex=True
else: else:
postsCtr=createBoxIndex(boxDir,postsInBoxDict) postsCtr=createBoxIndex(boxDir,postsInBoxDict)
@ -2112,18 +2114,21 @@ def createBoxBase(session,baseDir: str,boxname: str, \
# get the post as json # get the post as json
p = json.loads(postStr) p = json.loads(postStr)
if (boxname!='dm' and boxname!='tlreplies' and boxname!='tlmedia'): if lookedUpFromIndex:
isTimelinePost=True isTimelinePost=True
else: else:
if boxname=='dm': if (boxname!='dm' and boxname!='tlreplies' and boxname!='tlmedia'):
if isDM(p): isTimelinePost=True
isTimelinePost=True else:
elif boxname=='tlreplies': if boxname=='dm':
if isDM(p) or isReply(p,boxActor): if isDM(p):
isTimelinePost=True isTimelinePost=True
elif boxname=='tlmedia': elif boxname=='tlreplies':
if isImageMedia(session,baseDir,httpPrefix,nickname,domain,p): if isDM(p) or isReply(p,boxActor):
isTimelinePost=True isTimelinePost=True
elif boxname=='tlmedia':
if isImageMedia(session,baseDir,httpPrefix,nickname,domain,p):
isTimelinePost=True
if isTimelinePost and currPage == pageNumber: if isTimelinePost and currPage == pageNumber:
# remove any capability so that it's not displayed # remove any capability so that it's not displayed