cache post filename

main
Bob Mottram 2019-11-29 23:20:56 +00:00
parent 8dc02ae340
commit 8283edd34e
1 changed files with 3 additions and 5 deletions

View File

@ -120,7 +120,7 @@ def getDisplayName(baseDir: str,actor: str,personCache: {}) -> str:
return personCache[actor]['actor']['name'] return personCache[actor]['actor']['name']
else: else:
# Try to obtain from the cached actors # Try to obtain from the cached actors
cachedActorFilename=baseDir+'/cache/actors/'+actor.replace('/','#')+'.json' cachedActorFilename=baseDir+'/cache/actors/'+(actor.replace('/','#'))+'.json'
if os.path.isfile(cachedActorFilename): if os.path.isfile(cachedActorFilename):
actorJson=loadJson(cachedActorFilename,1) actorJson=loadJson(cachedActorFilename,1)
if actorJson: if actorJson:
@ -456,11 +456,9 @@ def getCachedPostFilename(baseDir: str,nickname: str,domain: str, \
return None return None
cachedPostFilename= \ cachedPostFilename= \
cachedPostDir+ \ cachedPostDir+ \
'/'+postJsonObject['id'].replace('/activity','') '/'+postJsonObject['id'].replace('/activity','').replace('/','#')
print('CACHE: 1 '+nickname+' '+domain+' '+cachedPostFilename) print('CACHE: 1 '+nickname+' '+domain+' '+cachedPostFilename)
if '#' in cachedPostFilename: cachedPostFilename=cachedPostFilename+'.html'
cachedPostFilename=cachedPostFilename.split('#',1)[0]
cachedPostFilename=cachedPostFilename.replace('/','#')+'.html'
print('CACHE: 2'+cachedPostFilename) print('CACHE: 2'+cachedPostFilename)
return cachedPostFilename return cachedPostFilename