Fix graphics creation and selection error (Thanks. ThUnD3r|Gr33n).
This commit is contained in:
parent
129e80e8ba
commit
3a4e05bd5c
1 changed files with 8 additions and 6 deletions
14
fasi.py
14
fasi.py
|
@ -149,7 +149,7 @@ class HttpInstance:
|
|||
jid_bare, jid_info, jid_kind, node_name)
|
||||
|
||||
# Graphic files
|
||||
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard)
|
||||
filename, filepath, filetype, selection = FileUtilities.handle_photo(jid_bare, jid_vcard, link_href)
|
||||
|
||||
#except Exception as e:
|
||||
else:
|
||||
|
@ -827,18 +827,20 @@ class FileUtilities:
|
|||
|
||||
print(jid_details)
|
||||
|
||||
FileUtilities.handle_photo(jid_bare, jid_vcard, link_href)
|
||||
|
||||
filename = 'details/{}.toml'.format(jid_bare)
|
||||
Data.save_to_toml(filename, jid_details)
|
||||
|
||||
return jid_details
|
||||
|
||||
def handle_photo(jid_bare, jid_vcard):
|
||||
def handle_photo(jid_bare, jid_vcard, link_href):
|
||||
filetype = selection = None
|
||||
filecirca = 'photo/{}.*'.format(jid_bare)
|
||||
filepath = glob.glob(filecirca)
|
||||
if filepath:
|
||||
filepath = filepath[0]
|
||||
filetype = filepath.split('.').pop()
|
||||
filepath_guess = glob.glob(filecirca)
|
||||
if filepath_guess:
|
||||
filepath_guess = filepath_guess[0]
|
||||
filetype = filepath_guess.split('.').pop()
|
||||
filename = '{}.{}'.format(jid_bare, filetype)
|
||||
elif jid_vcard:
|
||||
mimetype = filename = filepath = None
|
||||
|
|
Loading…
Reference in a new issue