mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Get big thumbnails now
This commit is contained in:
@@ -44,8 +44,23 @@ class ZordonClient:
|
|||||||
self.job_cache = []
|
self.job_cache = []
|
||||||
|
|
||||||
# Setup photo preview
|
# Setup photo preview
|
||||||
self.photo_label = tk.Label(self.root, width=400, height=300)
|
photo_pad = tk.Frame(self.root, background="gray")
|
||||||
self.photo_label.pack()
|
photo_pad.pack(fill=tk.BOTH, pady=5, padx=5)
|
||||||
|
self.photo_label = tk.Label(photo_pad, height=500)
|
||||||
|
self.photo_label.pack(fill=tk.BOTH, expand=True)
|
||||||
|
|
||||||
|
server_frame = tk.LabelFrame(self.root, text="Server")
|
||||||
|
server_frame.pack(fill=tk.X, pady=5, padx=5, expand=True)
|
||||||
|
server_picker_frame = tk.Frame(server_frame)
|
||||||
|
server_picker_frame.pack(fill=tk.X, expand=True)
|
||||||
|
server_label = tk.Label(server_picker_frame, text="Current Server:")
|
||||||
|
server_label.pack(side=tk.LEFT, padx=5)
|
||||||
|
|
||||||
|
self.server_combo = tk.ttk.Combobox(server_picker_frame)
|
||||||
|
self.server_combo.pack(fill=tk.X)
|
||||||
|
self.server_combo.bind("<<ComboboxSelected>>", self.server_picked)
|
||||||
|
self.server_combo['values'] = servers
|
||||||
|
self.server_combo.current(0)
|
||||||
|
|
||||||
# Setup the Tree
|
# Setup the Tree
|
||||||
self.tree = ttk.Treeview(self.root, show="headings")
|
self.tree = ttk.Treeview(self.root, show="headings")
|
||||||
@@ -87,7 +102,7 @@ class ZordonClient:
|
|||||||
# Start the Tkinter event loop
|
# Start the Tkinter event loop
|
||||||
self.root.geometry("500x600+300+300")
|
self.root.geometry("500x600+300+300")
|
||||||
self.root.maxsize(width=2000, height=1200)
|
self.root.maxsize(width=2000, height=1200)
|
||||||
self.root.minsize(width=600, height=600)
|
self.root.minsize(width=900, height=1000)
|
||||||
make_sortable(self.tree)
|
make_sortable(self.tree)
|
||||||
|
|
||||||
self.update_jobs()
|
self.update_jobs()
|
||||||
@@ -113,7 +128,7 @@ class ZordonClient:
|
|||||||
job_id = row_data['values'][0]
|
job_id = row_data['values'][0]
|
||||||
|
|
||||||
# update thumb
|
# update thumb
|
||||||
thumb_url = f'http://{self.server_proxy.hostname}:{self.server_proxy.port}/ui/job/{job_id}/thumbnail'
|
thumb_url = f'http://{self.server_proxy.hostname}:{self.server_proxy.port}/ui/job/{job_id}/thumbnail?size=big'
|
||||||
response = requests.get(thumb_url)
|
response = requests.get(thumb_url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -70,17 +70,27 @@ def job_detail(job_id):
|
|||||||
|
|
||||||
@server.route('/ui/job/<job_id>/thumbnail')
|
@server.route('/ui/job/<job_id>/thumbnail')
|
||||||
def job_thumbnail(job_id):
|
def job_thumbnail(job_id):
|
||||||
|
big_thumb = request.args.get('size', False) == "big"
|
||||||
found_job = RenderQueue.job_with_id(job_id, none_ok=True)
|
found_job = RenderQueue.job_with_id(job_id, none_ok=True)
|
||||||
if found_job:
|
if found_job:
|
||||||
|
|
||||||
os.makedirs(server.config['THUMBS_FOLDER'], exist_ok=True)
|
os.makedirs(server.config['THUMBS_FOLDER'], exist_ok=True)
|
||||||
thumb_video_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '.mp4')
|
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')
|
thumb_image_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '.jpg')
|
||||||
|
big_video_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '_big.mp4')
|
||||||
|
big_image_path = os.path.join(server.config['THUMBS_FOLDER'], found_job.id + '_big.jpg')
|
||||||
|
|
||||||
if not os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS') and \
|
if not os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS') and \
|
||||||
found_job.status not in [RenderStatus.CANCELLED, RenderStatus.ERROR]:
|
found_job.status not in [RenderStatus.CANCELLED, RenderStatus.ERROR]:
|
||||||
generate_thumbnail_for_job(found_job, thumb_video_path, thumb_image_path, max_width=240)
|
generate_thumbnail_for_job(found_job, thumb_video_path, thumb_image_path, max_width=240)
|
||||||
|
|
||||||
|
if big_thumb and os.path.exists(big_video_path) and not os.path.exists(big_video_path + '_IN-PROGRESS'):
|
||||||
|
return send_file(big_video_path, mimetype="video/mp4")
|
||||||
|
elif big_thumb and os.path.exists(big_image_path):
|
||||||
|
return send_file(big_image_path, mimetype='image/jpeg')
|
||||||
|
elif not os.path.exists(big_video_path) and not os.path.exists(big_image_path + '_IN-PROGRESS') and \
|
||||||
|
found_job.status not in [RenderStatus.CANCELLED, RenderStatus.ERROR]:
|
||||||
|
generate_thumbnail_for_job(found_job, big_video_path, big_image_path, max_width=800)
|
||||||
if os.path.exists(thumb_video_path) and not os.path.exists(thumb_video_path + '_IN-PROGRESS'):
|
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")
|
return send_file(thumb_video_path, mimetype="video/mp4")
|
||||||
elif os.path.exists(thumb_image_path):
|
elif os.path.exists(thumb_image_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user