Fix graphics creation and selection error (Thanks. ThUnD3r|Gr33n).

This commit is contained in:
Schimon Jehudah, Adv. 2024-10-15 23:13:10 +03:00
parent 129e80e8ba
commit 3a4e05bd5c

14
fasi.py
View file

@ -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