Don't crash in FileDownloader if subtitles couldn't be found and errors are ignored

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-03-31 12:21:35 +02:00
parent ef767f9fd5
commit bafeed9f5d

View File

@ -485,6 +485,9 @@ def process_info(self, info_dict):
subtitle = info_dict['subtitles'][0]
(sub_error, sub_lang, sub) = subtitle
sub_format = self.params.get('subtitlesformat')
if sub_error:
self.report_warning("Some error while getting the subtitles")
else:
try:
sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.' + sub_format
self.report_writesubtitles(sub_filename)
@ -501,6 +504,9 @@ def process_info(self, info_dict):
sub_format = self.params.get('subtitlesformat')
for subtitle in subtitles:
(sub_error, sub_lang, sub) = subtitle
if sub_error:
self.report_warning("Some error while getting the subtitles")
else:
try:
sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.' + sub_format
self.report_writesubtitles(sub_filename)