From 8283edd34ed0344dfa7184aeed7a7cfb457d2285 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 29 Nov 2019 23:20:56 +0000 Subject: [PATCH] cache post filename --- utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index 8be29b6f..6b58bf93 100644 --- a/utils.py +++ b/utils.py @@ -120,7 +120,7 @@ def getDisplayName(baseDir: str,actor: str,personCache: {}) -> str: return personCache[actor]['actor']['name'] else: # 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): actorJson=loadJson(cachedActorFilename,1) if actorJson: @@ -456,11 +456,9 @@ def getCachedPostFilename(baseDir: str,nickname: str,domain: str, \ return None cachedPostFilename= \ cachedPostDir+ \ - '/'+postJsonObject['id'].replace('/activity','') + '/'+postJsonObject['id'].replace('/activity','').replace('/','#') print('CACHE: 1 '+nickname+' '+domain+' '+cachedPostFilename) - if '#' in cachedPostFilename: - cachedPostFilename=cachedPostFilename.split('#',1)[0] - cachedPostFilename=cachedPostFilename.replace('/','#')+'.html' + cachedPostFilename=cachedPostFilename+'.html' print('CACHE: 2'+cachedPostFilename) return cachedPostFilename