mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
fe50d3d677
commit
2da2a331c2
5
inbox.py
5
inbox.py
|
@ -87,10 +87,11 @@ def storeHashTags(baseDir: str,nickname: str,postJsonObject: {}) -> None:
|
||||||
tagName=tag['name'].replace('#','').strip()
|
tagName=tag['name'].replace('#','').strip()
|
||||||
tagsFilename=tagsDir+'/'+tagName+'.txt'
|
tagsFilename=tagsDir+'/'+tagName+'.txt'
|
||||||
postUrl=postJsonObject['id'].replace('/activity','').replace('/','#')
|
postUrl=postJsonObject['id'].replace('/activity','').replace('/','#')
|
||||||
|
tagline=nickname+' '+postUrl+'\n'
|
||||||
if not os.path.isfile(tagsFilename):
|
if not os.path.isfile(tagsFilename):
|
||||||
tagsFile=open(tagsFilename, "w+")
|
tagsFile=open(tagsFilename, "w+")
|
||||||
if tagsFile:
|
if tagsFile:
|
||||||
tagsFile.write(nickname+' '+postUrl+'\n')
|
tagsFile.write(tagline)
|
||||||
tagsFile.close()
|
tagsFile.close()
|
||||||
else:
|
else:
|
||||||
if postUrl not in open(tagsFilename).read():
|
if postUrl not in open(tagsFilename).read():
|
||||||
|
@ -98,7 +99,7 @@ def storeHashTags(baseDir: str,nickname: str,postJsonObject: {}) -> None:
|
||||||
with open(tagsFilename, 'r+') as tagsFile:
|
with open(tagsFilename, 'r+') as tagsFile:
|
||||||
content = tagsFile.read()
|
content = tagsFile.read()
|
||||||
tagsFile.seek(0, 0)
|
tagsFile.seek(0, 0)
|
||||||
tagsFile.write(nickname+' '+postUrl+'\n'+content)
|
tagsFile.write(tagline+content)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('WARN: Failed to write entry to tags file '+ \
|
print('WARN: Failed to write entry to tags file '+ \
|
||||||
tagsFilename+' '+str(e))
|
tagsFilename+' '+str(e))
|
||||||
|
|
Loading…
Reference in New Issue