mirror of https://gitlab.com/bashrc2/epicyon
Use index to construct timeline
parent
8f826a1ac5
commit
7e0ae8d8e1
34
posts.py
34
posts.py
|
@ -2029,17 +2029,33 @@ def createBoxBase(session,baseDir: str,boxname: str, \
|
||||||
|
|
||||||
# post filenames sorted in descending order
|
# post filenames sorted in descending order
|
||||||
postsInBoxDict={}
|
postsInBoxDict={}
|
||||||
postsCtr=createBoxIndex(boxDir,postsInBoxDict)
|
|
||||||
|
|
||||||
# combine the inbox for the account with the shared inbox
|
indexFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/'+boxname+'.index'
|
||||||
if sharedBoxDir:
|
if os.path.isfile(indexFilename):
|
||||||
postsCtr= \
|
print('DEBUG: using index file to construct timeline')
|
||||||
createSharedInboxIndex(baseDir,sharedBoxDir, \
|
postsCtr=0
|
||||||
postsInBoxDict,postsCtr, \
|
maxPostCtr=None
|
||||||
nickname,domain,ocapAlways)
|
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)
|
||||||
|
|
||||||
# sort the list in descending order of date
|
# combine the inbox for the account with the shared inbox
|
||||||
postsInBox=OrderedDict(sorted(postsInBoxDict.items(),reverse=True))
|
if sharedBoxDir:
|
||||||
|
postsCtr= \
|
||||||
|
createSharedInboxIndex(baseDir,sharedBoxDir, \
|
||||||
|
postsInBoxDict,postsCtr, \
|
||||||
|
nickname,domain,ocapAlways)
|
||||||
|
|
||||||
|
# sort the list in descending order of date
|
||||||
|
postsInBox=OrderedDict(sorted(postsInBoxDict.items(),reverse=True))
|
||||||
|
|
||||||
# number of posts in box
|
# number of posts in box
|
||||||
boxHeader['totalItems']=postsCtr
|
boxHeader['totalItems']=postsCtr
|
||||||
|
|
Loading…
Reference in New Issue