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(): for frame in item['service_item'].get_frames():
frame_path = item['service_item'].get_frame_path(frame=frame) frame_path = item['service_item'].get_frame_path(frame=frame)
if not frame_path.exists(): 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 continue
if item['service_item'].stored_filename: if item['service_item'].stored_filename:
sha256_file_name = Path(item['service_item'].stored_filename) sha256_file_name = Path(item['service_item'].stored_filename)
else: 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) bundle = (frame_path, sha256_file_name)
if bundle in write_list or str(frame_path) in missing_list: if bundle in write_list or str(frame_path) in missing_list:
continue continue
@ -602,7 +603,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
# Run through everything in the thumbnail folder and add pictures # Run through everything in the thumbnail folder and add pictures
for filename in os.listdir(thumbnail_path): for filename in os.listdir(thumbnail_path):
# Skip non-pictures # 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 continue
filename_path = Path(thumbnail_path) / Path(filename) filename_path = Path(thumbnail_path) / Path(filename)
if not filename_path.exists(): 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' # All image thumbnails will be put in a folder named 'thumbnails'
for frame in item['service_item'].get_frames(): for frame in item['service_item'].get_frames():
if 'thumbnail' in frame: if 'thumbnail' in frame:
filename_path = Path(thumbnail_path) / Path(frame['thumbnail']) filename_path = Path(thumbnail_path) / frame['thumbnail']
if not filename_path.exists(): if not filename_path.exists():
continue continue
# Create a thumbnail path in the zip/service file # Create a thumbnail path in the zip/service file