0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-22 02:15:12 +00:00

[YoutubeDL] Auto generate title fields corresponding to the *_number fields

Auto generate title fields corresponding to the *_number fields when missing in order to always have clean titles. This is very common for TV series.
This commit is contained in:
Sergey M․ 2016-01-16 00:09:54 +06:00
parent a78d6a9bb1
commit 33d2fc2f64

View file

@ -1244,6 +1244,12 @@ def process_video_result(self, info_dict, download=True):
except (ValueError, OverflowError, OSError):
pass
# Auto generate title fields corresponding to the *_number fields when missing
# in order to always have clean titles. This is very common for TV series.
for field in ('chapter', 'season', 'episode'):
if info_dict.get('%s_number' % field) is not None and not info_dict.get(field):
info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field])
subtitles = info_dict.get('subtitles')
if subtitles:
for _, subtitle in subtitles.items():