mirror of https://gitlab.com/bashrc2/epicyon
parent
454d02bc89
commit
74ec3114fd
11
shares.py
11
shares.py
|
@ -31,8 +31,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \
|
||||||
itemID=displayName.replace(' ','')
|
itemID=displayName.replace(' ','')
|
||||||
if sharesJson.get(itemID):
|
if sharesJson.get(itemID):
|
||||||
# remove any image for the item
|
# remove any image for the item
|
||||||
published=sharesJson[itemID]['published']
|
itemIDfile=baseDir+'/sharefiles/'+itemID
|
||||||
itemIDfile=baseDir+'/sharefiles/'+str(published)+itemID
|
|
||||||
if sharesJson[itemID]['imageUrl']:
|
if sharesJson[itemID]['imageUrl']:
|
||||||
if sharesJson[itemID]['imageUrl'].endswith('.png'):
|
if sharesJson[itemID]['imageUrl'].endswith('.png'):
|
||||||
os.remove(itemIDfile+'.png')
|
os.remove(itemIDfile+'.png')
|
||||||
|
@ -101,25 +100,25 @@ def addShare(baseDir: str,nickname: str,domain: str, \
|
||||||
if os.path.isfile(imageFilename):
|
if os.path.isfile(imageFilename):
|
||||||
if not os.path.isdir(baseDir+'/sharefiles'):
|
if not os.path.isdir(baseDir+'/sharefiles'):
|
||||||
os.mkdir(baseDir+'/sharefiles')
|
os.mkdir(baseDir+'/sharefiles')
|
||||||
itemIDfile=baseDir+'/sharefiles/'+str(published)+itemID
|
itemIDfile=baseDir+'/sharefiles/'+itemID
|
||||||
if imageFilename.endswith('.png'):
|
if imageFilename.endswith('.png'):
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.rename(imageFilename,itemIDfile+'.png')
|
os.rename(imageFilename,itemIDfile+'.png')
|
||||||
else:
|
else:
|
||||||
copyfile(imageFilename,itemIDfile+'.png')
|
copyfile(imageFilename,itemIDfile+'.png')
|
||||||
imageUrl='/sharefiles/'+str(published)+itemID+'.png'
|
imageUrl='/sharefiles/'+itemID+'.png'
|
||||||
if imageFilename.endswith('.jpg'):
|
if imageFilename.endswith('.jpg'):
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.rename(imageFilename,itemIDfile+'.jpg')
|
os.rename(imageFilename,itemIDfile+'.jpg')
|
||||||
else:
|
else:
|
||||||
copyfile(imageFilename,itemIDfile+'.jpg')
|
copyfile(imageFilename,itemIDfile+'.jpg')
|
||||||
imageUrl='/sharefiles/'+str(published)+itemID+'.jpg'
|
imageUrl='/sharefiles/'+itemID+'.jpg'
|
||||||
if imageFilename.endswith('.gif'):
|
if imageFilename.endswith('.gif'):
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.rename(imageFilename,itemIDfile+'.gif')
|
os.rename(imageFilename,itemIDfile+'.gif')
|
||||||
else:
|
else:
|
||||||
copyfile(imageFilename,itemIDfile+'.gif')
|
copyfile(imageFilename,itemIDfile+'.gif')
|
||||||
imageUrl='/sharefiles/'+str(published)+itemID+'.gif'
|
imageUrl='/sharefiles/'+itemID+'.gif'
|
||||||
|
|
||||||
sharesJson[itemID] = {
|
sharesJson[itemID] = {
|
||||||
"displayName": displayName,
|
"displayName": displayName,
|
||||||
|
|
|
@ -103,11 +103,17 @@ def htmlProfileShares(nickname: str,domain: str,sharesJson: {}) -> str:
|
||||||
"""
|
"""
|
||||||
profileStr=''
|
profileStr=''
|
||||||
for item in sharesJson['orderedItems']:
|
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:
|
if len(profileStr)==0:
|
||||||
profileStr+='<p>@'+nickname+'@'+domain+' is not sharing any items</p>'
|
profileStr+='<p>@'+nickname+'@'+domain+' is not sharing any items</p>'
|
||||||
else:
|
else:
|
||||||
profileStr='<center><div class="share-title">'+profileStr+'</div></center>'
|
profileStr='<div class="share-title">'+profileStr+'</div>'
|
||||||
return profileStr
|
return profileStr
|
||||||
|
|
||||||
def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
def htmlProfile(baseDir: str,httpPrefix: str,authorized: bool, \
|
||||||
|
|
Loading…
Reference in New Issue