mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-19 01:45:13 +00:00
Merge pull request #8245 from dstftw/auto-generate-title-fields
[YoutubeDL] Auto generate title fields corresponding to the *_number fields
This commit is contained in:
commit
30783c442d
1 changed files with 6 additions and 0 deletions
|
@ -1244,6 +1244,12 @@ def process_video_result(self, info_dict, download=True):
|
||||||
except (ValueError, OverflowError, OSError):
|
except (ValueError, OverflowError, OSError):
|
||||||
pass
|
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')
|
subtitles = info_dict.get('subtitles')
|
||||||
if subtitles:
|
if subtitles:
|
||||||
for _, subtitle in subtitles.items():
|
for _, subtitle in subtitles.items():
|
||||||
|
|
Loading…
Reference in a new issue