From 74ec3114fd639611ecd403482441a8afea423067 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 24 Jul 2019 10:02:38 +0100 Subject: [PATCH] Don't include published time in image filename Creates too many duplicates --- shares.py | 11 +++++------ webinterface.py | 10 ++++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/shares.py b/shares.py index d072fb6f..900c598e 100644 --- a/shares.py +++ b/shares.py @@ -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, diff --git a/webinterface.py b/webinterface.py index c706f956..9f1ebff9 100644 --- a/webinterface.py +++ b/webinterface.py @@ -103,11 +103,17 @@ def htmlProfileShares(nickname: str,domain: str,sharesJson: {}) -> str: """ profileStr='' for item in sharesJson['orderedItems']: - profileStr+='
TODO

' + profileStr+='
' + profileStr+='

'+item['displayName']+'

' + profileStr+='

'+item['summary']+'

' + profileStr+='

Type: '+item['itemType']+' ' + profileStr+='Category: '+item['itemCategory']+' ' + profileStr+='Location: '+item['location']+'

' + profileStr+='
' if len(profileStr)==0: profileStr+='

@'+nickname+'@'+domain+' is not sharing any items

' else: - profileStr='
' + profileStr='
'+profileStr+'
' return profileStr def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \