Fix up the saving of images

This commit is contained in:
Raoul Snyman 2022-04-19 15:04:15 +00:00
parent 9be02daa3c
commit ac4ff452d0

View File

@ -582,12 +582,13 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
for frame in item['service_item'].get_frames():
frame_path = item['service_item'].get_frame_path(frame=frame)
if not frame_path.exists():
missing_list.append(str(frame_path))
if 'thumbnail' not in frame_path.parts:
missing_list.append(str(frame_path))
continue
if item['service_item'].stored_filename:
sha256_file_name = Path(item['service_item'].stored_filename)
else:
sha256_file_name = sha256_file_hash(frame_path) / frame_path.suffix
sha256_file_name = Path(sha256_file_hash(frame_path)) / frame_path.suffix
bundle = (frame_path, sha256_file_name)
if bundle in write_list or str(frame_path) in missing_list:
continue
@ -602,7 +603,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
# Run through everything in the thumbnail folder and add pictures
for filename in os.listdir(thumbnail_path):
# Skip non-pictures
if os.path.splitext(filename)[1] not in ['.png', '.jpg']:
if os.path.splitext(filename)[1] not in ['.png', '.jpg', '.jpeg']:
continue
filename_path = Path(thumbnail_path) / Path(filename)
if not filename_path.exists():
@ -615,7 +616,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
# All image thumbnails will be put in a folder named 'thumbnails'
for frame in item['service_item'].get_frames():
if 'thumbnail' in frame:
filename_path = Path(thumbnail_path) / Path(frame['thumbnail'])
filename_path = Path(thumbnail_path) / frame['thumbnail']
if not filename_path.exists():
continue
# Create a thumbnail path in the zip/service file