From 2e021a888e0e73ce8cc604e680cb221fc6b1c3b3 Mon Sep 17 00:00:00 2001 From: Andreas Valder <andreasv@fsmpi.rwth-aachen.de> Date: Wed, 26 Jul 2017 01:09:25 +0200 Subject: [PATCH] added error handling --- worker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker.py b/worker.py index bd58d05..d81c9f7 100755 --- a/worker.py +++ b/worker.py @@ -24,7 +24,10 @@ if (jobtype == 'thumbnail'): inputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+data['path'] outputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+config['thumbnail']['folder']+'/'+'l_'+str(data['lectureid'])+'.jpg' api.job_ping(id=id) - duration = float(subprocess.check_output(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", inputfile])) + try: + duration = float(subprocess.check_output(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", inputfile])) + except: + duration = 0 api.job_ping(id=id) if subprocess.call(["ffmpeg", "-loglevel", "error", "-y", "-ss", str(duration*0.4), "-i", inputfile, "-vf", "scale=640:-1", "-frames:v", "1", outputfile]) == 0: api.job_ping(id=id,state='finished') -- GitLab