mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Fix server issue with purple / green thumbnails
This commit is contained in:
@@ -28,6 +28,7 @@ def generate_thumbnail_for_job(job, thumb_video_path, thumb_image_path, max_widt
|
||||
in_progress_path = thumb_video_path + '_IN-PROGRESS'
|
||||
subprocess.run(['touch', in_progress_path])
|
||||
try:
|
||||
logger.debug(f"Generating video thumbnail for {source}")
|
||||
generate_thumbnail(source_path=source, dest_path=thumb_video_path, max_width=max_width)
|
||||
except Exception as e:
|
||||
logger.error(f"Error generating thumbnail for {source}: {e}")
|
||||
@@ -43,13 +44,19 @@ def generate_thumbnail_for_job(job, thumb_video_path, thumb_image_path, max_widt
|
||||
source_path = [job.input_path] # use source if nothing else
|
||||
|
||||
if source_path:
|
||||
# Todo: convert image sequence to animated movie
|
||||
valid_formats = ['.mp4', '.mov', '.avi', '.mpg', '.mpeg', '.jpg', '.png', '.exr', '.mxf']
|
||||
is_valid_file_type = any(ele in source_path[0] for ele in valid_formats)
|
||||
if is_valid_file_type and not os.path.exists(thumb_video_path):
|
||||
video_formats = ['.mp4', '.mov', '.avi', '.mpg', '.mpeg', '.mxf', '.m4v', 'mkv']
|
||||
image_formats = ['.jpg', '.png', '.exr']
|
||||
|
||||
is_image_file = any(ele in source_path[0] for ele in image_formats)
|
||||
is_video_file = any(ele in source_path[0] for ele in video_formats)
|
||||
|
||||
if (is_image_file or is_video_file) and not os.path.exists(thumb_image_path):
|
||||
try:
|
||||
logger.debug(f"Generating image thumbnail for {source_path[0]}")
|
||||
save_first_frame(source_path=source_path[0], dest_path=thumb_image_path, max_width=max_width)
|
||||
except Exception as e:
|
||||
logger.error(f"Exception saving first frame: {e}")
|
||||
|
||||
if is_video_file and not os.path.exists(thumb_video_path):
|
||||
x = threading.Thread(target=generate_thumb_thread, args=(source_path[0],))
|
||||
x.start()
|
||||
|
||||
Reference in New Issue
Block a user