Don't include published time in image filename

Creates too many duplicates
master
Bob Mottram 2019-07-24 10:02:38 +01:00
parent 454d02bc89
commit 74ec3114fd
2 changed files with 13 additions and 8 deletions

View File

@ -31,8 +31,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \
itemID=displayName.replace(' ','')
if sharesJson.get(itemID):
# remove any image for the item
published=sharesJson[itemID]['published']
itemIDfile=baseDir+'/sharefiles/'+str(published)+itemID
itemIDfile=baseDir+'/sharefiles/'+itemID
if sharesJson[itemID]['imageUrl']:
if sharesJson[itemID]['imageUrl'].endswith('.png'):
os.remove(itemIDfile+'.png')
@ -101,25 +100,25 @@ def addShare(baseDir: str,nickname: str,domain: str, \
if os.path.isfile(imageFilename):
if not os.path.isdir(baseDir+'/sharefiles'):
os.mkdir(baseDir+'/sharefiles')
itemIDfile=baseDir+'/sharefiles/'+str(published)+itemID
itemIDfile=baseDir+'/sharefiles/'+itemID
if imageFilename.endswith('.png'):
if moveImage:
os.rename(imageFilename,itemIDfile+'.png')
else:
copyfile(imageFilename,itemIDfile+'.png')
imageUrl='/sharefiles/'+str(published)+itemID+'.png'
imageUrl='/sharefiles/'+itemID+'.png'
if imageFilename.endswith('.jpg'):
if moveImage:
os.rename(imageFilename,itemIDfile+'.jpg')
else:
copyfile(imageFilename,itemIDfile+'.jpg')
imageUrl='/sharefiles/'+str(published)+itemID+'.jpg'
imageUrl='/sharefiles/'+itemID+'.jpg'
if imageFilename.endswith('.gif'):
if moveImage:
os.rename(imageFilename,itemIDfile+'.gif')
else:
copyfile(imageFilename,itemIDfile+'.gif')
imageUrl='/sharefiles/'+str(published)+itemID+'.gif'
imageUrl='/sharefiles/'+itemID+'.gif'
sharesJson[itemID] = {
"displayName": displayName,

View File

@ -103,11 +103,17 @@ def htmlProfileShares(nickname: str,domain: str,sharesJson: {}) -> str:
"""
profileStr=''
for item in sharesJson['orderedItems']:
profileStr+='<div>TODO</div><br>'
profileStr+='<div class="container">'
profileStr+='<p class="post-title">'+item['displayName']+'</p>'
profileStr+='<p>'+item['summary']+'</p>'
profileStr+='<p>Type: '+item['itemType']+' '
profileStr+='Category: '+item['itemCategory']+' '
profileStr+='Location: '+item['location']+'</p>'
profileStr+='</div>'
if len(profileStr)==0:
profileStr+='<p>@'+nickname+'@'+domain+' is not sharing any items</p>'
else:
profileStr='<center><div class="share-title">'+profileStr+'</div></center>'
profileStr='<div class="share-title">'+profileStr+'</div>'
return profileStr
def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \