0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-29 01:51:06 +00:00

[EmbedSubtitle, SubtitlesConvertor] Fix error when subtitle file is missing

Closes #1152, #1134
Bug from 8e25d624df
This commit is contained in:
pukkandan 2021-10-02 22:36:31 +05:30
parent e919569e67
commit a1c3967307
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -555,7 +555,7 @@ def run(self, information):
mp4_ass_warn = False
for lang, sub_info in subtitles.items():
if not os.path.exists(information.get('filepath', '')):
if not os.path.exists(sub_info.get('filepath', '')):
self.report_warning(f'Skipping embedding {lang} subtitle because the file is missing')
continue
sub_ext = sub_info['ext']
@ -845,6 +845,9 @@ def run(self, info):
self.to_screen('Converting subtitles')
sub_filenames = []
for lang, sub in subs.items():
if not os.path.exists(sub.get('filepath', '')):
self.report_warning(f'Skipping embedding {lang} subtitle because the file is missing')
continue
ext = sub['ext']
if ext == new_ext:
self.to_screen('Subtitle file for %s is already in the requested format' % new_ext)