[YoutubeDL] Fix bug in the detection of formats that don't contain video (fixes #4150)

If the format requested was not available, we called the method '.get' in None.
This commit is contained in:
Jaime Marquínez Ferrándiz 2014-11-12 09:42:35 +01:00
parent eb4cb42a02
commit c295490830

View File

@ -837,14 +837,14 @@ def process_video_result(self, info_dict, download=True):
format_1, format_2 = rf.split('+') format_1, format_2 = rf.split('+')
formats_info = (self.select_format(format_1, formats), formats_info = (self.select_format(format_1, formats),
self.select_format(format_2, formats)) self.select_format(format_2, formats))
if all(formats_info):
# The first format must contain the video and the # The first format must contain the video and the
# second the audio # second the audio
if formats_info[0].get('vcodec') == 'none': if formats_info[0].get('vcodec') == 'none':
self.report_error('The first format must contain ' self.report_error('The first format must '
'the video, try using "-f %s+%s"' % 'contain the video, try using '
(format_2, format_1)) '"-f %s+%s"' % (format_2, format_1))
return return
if all(formats_info):
selected_format = { selected_format = {
'requested_formats': formats_info, 'requested_formats': formats_info,
'format': rf, 'format': rf,