Skip to content
Snippets Groups Projects
Commit 2e021a88 authored by Andreas Valder's avatar Andreas Valder
Browse files

added error handling

parent a025a52a
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,10 @@ if (jobtype == 'thumbnail'): ...@@ -24,7 +24,10 @@ if (jobtype == 'thumbnail'):
inputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+data['path'] inputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+data['path']
outputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+config['thumbnail']['folder']+'/'+'l_'+str(data['lectureid'])+'.jpg' outputfile = config['MAIN']['VIDEOS_RELEASED']+'/'+config['thumbnail']['folder']+'/'+'l_'+str(data['lectureid'])+'.jpg'
api.job_ping(id=id) api.job_ping(id=id)
try:
duration = float(subprocess.check_output(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", inputfile])) 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) 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: 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') api.job_ping(id=id,state='finished')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment