diff options
author | Sergey M <dstftw@gmail.com> | 2016-01-16 07:20:03 +0600 |
---|---|---|
committer | Sergey M <dstftw@gmail.com> | 2016-01-16 07:20:03 +0600 |
commit | 30783c442de27dbab9f76a6293906daa8fa788d9 (patch) | |
tree | 7bbaa3bf4a2a7df569da31b34c3269cc4f07831f | |
parent | a50a8003a08bc67bc99363f6738147a394a43210 (diff) | |
parent | 33d2fc2f640c32b4b5469ecb3a48e7e209844407 (diff) | |
download | youtube-dl-30783c442de27dbab9f76a6293906daa8fa788d9.tar.xz |
Merge pull request #8245 from dstftw/auto-generate-title-fields
[YoutubeDL] Auto generate title fields corresponding to the *_number fields
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 6b73b8e06..0748fbba0 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1244,6 +1244,12 @@ class YoutubeDL(object): 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(): |