mirror of https://gitlab.com/bashrc2/epicyon
Use index to construct timeline
parent
8f826a1ac5
commit
7e0ae8d8e1
16
posts.py
16
posts.py
|
@ -2029,6 +2029,22 @@ def createBoxBase(session,baseDir: str,boxname: str, \
|
|||
|
||||
# post filenames sorted in descending order
|
||||
postsInBoxDict={}
|
||||
|
||||
indexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxname+'.index'
|
||||
if os.path.isfile(indexFilename):
|
||||
print('DEBUG: using index file to construct timeline')
|
||||
postsCtr=0
|
||||
maxPostCtr=None
|
||||
if pageNumber:
|
||||
maxPostCtr=itemsPerPage*pageNumber
|
||||
with open(indexFilename, 'r') as indexFile:
|
||||
for postFilename in indexFile:
|
||||
postsInBoxDict[postsCtr]=os.path.join(boxDir, postFilename)
|
||||
postsCtr+=1
|
||||
if maxPostCtr:
|
||||
if postsCtr>=maxPostCtr:
|
||||
break
|
||||
else:
|
||||
postsCtr=createBoxIndex(boxDir,postsInBoxDict)
|
||||
|
||||
# combine the inbox for the account with the shared inbox
|
||||
|
|
Loading…
Reference in New Issue