Always test timeline post type

main
Bob Mottram 2019-11-18 12:25:59 +00:00
parent e97e223ecb
commit fc1878d72a
1 changed files with 12 additions and 11 deletions

View File

@ -2295,6 +2295,7 @@ def isTimelinePost(filePath: str,boxname: str,postsInBox: []) -> bool:
if '"Create"' in postStr: if '"Create"' in postStr:
if 'mediaType' not in postStr or 'image/' not in postStr: if 'mediaType' not in postStr or 'image/' not in postStr:
return False return False
if postsInBox!=None:
# add the post to the dictionary # add the post to the dictionary
postsInBox.append(postStr) postsInBox.append(postStr)
return True return True
@ -2368,24 +2369,24 @@ def createBoxIndexed(session,baseDir: str,boxname: str, \
with open(indexFilename, 'r') as indexFile: with open(indexFilename, 'r') as indexFile:
while postsCtr<maxPostCtr: while postsCtr<maxPostCtr:
postFilename=indexFile.readline() postFilename=indexFile.readline()
# Skip through any posts previous to the current page
if postsCtr<int((pageNumber-1)*itemsPerPage):
if postFilename:
postsCtr+=1
continue
if not postFilename: if not postFilename:
continue continue
postOnThisTimeline=False
# filename of the post without any extension or path # filename of the post without any extension or path
postUrl=postFilename.replace('\n','').replace('.json','') postUrl=postFilename.replace('\n','').replace('.json','')
# get the full path of the post # get the full path of the post
fullPostFilename= \ fullPostFilename= \
locatePost(baseDir,nickname,domain,postUrl,False) locatePost(baseDir,nickname,domain,postUrl,False)
if fullPostFilename: if fullPostFilename:
if not isTimelinePost(fullPostFilename,boxname,postsInBox): if postsCtr<int((pageNumber-1)*itemsPerPage):
continue if isTimelinePost(fullPostFilename,boxname,None):
postOnThisTimeline=True
else:
if isTimelinePost(fullPostFilename,boxname,postsInBox):
postOnThisTimeline=True
if postOnThisTimeline:
postsCtr+=1 postsCtr+=1
# Generate first and last entries within header # Generate first and last entries within header