PEP8 formatting

This commit is contained in:
Francesco Siddi 2016-03-17 12:21:13 +01:00
parent b8bcd0c5fe
commit b495552ae4

View File

@ -117,15 +117,16 @@ def resize_and_crop(img_path, modified_path, size, crop_type='middle'):
def get_video_data(filepath): def get_video_data(filepath):
"""Return video duration and resolution given an input file path""" """Return video duration and resolution given an input file path"""
outdata = None outdata = None
ffprobe_ouput = json.loads( ffprobe_inspect = [
subprocess.check_output( app.config['BIN_FFPROBE'],
[app.config['BIN_FFPROBE'], '-loglevel',
'-loglevel', 'error',
'error', '-show_streams',
'-show_streams', filepath,
filepath, '-print_format',
'-print_format', 'json']
'json']))
ffprobe_ouput = json.loads(subprocess.check_output(ffprobe_inspect))
video_stream = None video_stream = None
# Loop throught audio and video streams searching for the video # Loop throught audio and video streams searching for the video
@ -134,15 +135,16 @@ def get_video_data(filepath):
video_stream = stream video_stream = stream
if video_stream: if video_stream:
# If video is webm we can't get the duration (seems to be an ffprobe issue) # If video is webm we can't get the duration (seems to be an ffprobe
# issue)
if video_stream['codec_name'] == 'vp8': if video_stream['codec_name'] == 'vp8':
duration = None duration = None
else: else:
duration = int(float(video_stream['duration'])) duration = int(float(video_stream['duration']))
outdata = dict( outdata = dict(
duration = duration, duration=duration,
res_x = video_stream['width'], res_x=video_stream['width'],
res_y = video_stream['height'], res_y=video_stream['height'],
) )
if video_stream['sample_aspect_ratio'] != '1:1': if video_stream['sample_aspect_ratio'] != '1:1':
print '[warning] Pixel aspect ratio is not square!' print '[warning] Pixel aspect ratio is not square!'