More thumbnail fixes

This commit is contained in:
Brett Williams
2023-05-30 21:05:59 -05:00
parent 769611ba26
commit 22cfe9c24e
3 changed files with 13 additions and 6 deletions

View File

@@ -78,14 +78,23 @@ def job_thumbnail(job_id):
thumb_video_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '.mp4')
thumb_image_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '.jpg')
if not os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS'):
if not os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS') and \
found_job.render_status() not in [RenderStatus.CANCELLED, RenderStatus.ERROR]:
generate_thumbnail_for_job(found_job, thumb_video_path, thumb_image_path, max_width=240)
if os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS'):
return send_file(thumb_video_path, mimetype="video/mp4")
elif os.path.exists(thumb_image_path):
return send_file(thumb_image_path, mimetype='image/jpeg')
return send_file('static/images/spinner.gif', mimetype="image/gif")
elif found_job.render_status() == RenderStatus.RUNNING:
return send_file('static/images/gears.png', mimetype="image/png")
elif found_job.render_status() == RenderStatus.CANCELLED:
return send_file('static/images/cancelled.png', mimetype="image/png")
elif found_job.render_status() == RenderStatus.SCHEDULED:
return send_file('static/images/scheduled.png', mimetype="image/png")
elif found_job.render_status() == RenderStatus.NOT_STARTED:
return send_file('static/images/not_started.png', mimetype="image/png")
return send_file('static/images/error.png', mimetype="image/png")
# Get job file routing