mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
More thumbnail fixes
This commit is contained in:
@@ -129,9 +129,9 @@ class BlenderRenderWorker(BaseRenderWorker):
|
||||
image_sequence_to_video(source_glob_pattern=glob_pattern,
|
||||
output_path=self.output_path + '.mp4',
|
||||
framerate=self.scene_info['fps'])
|
||||
logger.info('Successfully generated preview image sequence')
|
||||
logger.info('Successfully generated preview video from image sequence')
|
||||
except Exception as e:
|
||||
logger.error('Error generating image sequence')
|
||||
logger.error(f'Error generating video from image sequence: {e}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,8 +38,6 @@ def generate_thumbnail_for_job(job, thumb_video_path, thumb_image_path, max_widt
|
||||
# Determine best source file to use for thumbs
|
||||
if job.render_status() == RenderStatus.COMPLETED: # use finished file for thumb
|
||||
source_path = job.file_list()
|
||||
elif len(job.file_list()) > 1: # if image sequence, use second to last file (last may be in use)
|
||||
source_path = [job.file_list()[-2]]
|
||||
else:
|
||||
source_path = [job.input_path] # use source if nothing else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user