1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 01:02:48 +01:00

Do more processing in --flat-playlist

This commit is contained in:
pukkandan 2022-10-13 04:21:50 +05:30
parent a71b812f53
commit 94dc8604dd
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

View File

@ -1621,6 +1621,7 @@ def process_ie_result(self, ie_result, download=True, extra_info=None):
self.add_default_extra_info(info_copy, ie, ie_result['url']) self.add_default_extra_info(info_copy, ie, ie_result['url'])
self.add_extra_info(info_copy, extra_info) self.add_extra_info(info_copy, extra_info)
info_copy, _ = self.pre_process(info_copy) info_copy, _ = self.pre_process(info_copy)
self._fill_common_fields(info_copy, False)
self.__forced_printings(info_copy, self.prepare_filename(info_copy), incomplete=True) self.__forced_printings(info_copy, self.prepare_filename(info_copy), incomplete=True)
self._raise_pending_errors(info_copy) self._raise_pending_errors(info_copy)
if self.params.get('force_write_download_archive', False): if self.params.get('force_write_download_archive', False):
@ -2379,10 +2380,9 @@ def check_thumbnails(thumbnails):
else: else:
info_dict['thumbnails'] = thumbnails info_dict['thumbnails'] = thumbnails
def _fill_common_fields(self, info_dict, is_video=True): def _fill_common_fields(self, info_dict, final=True):
# TODO: move sanitization here # TODO: move sanitization here
if is_video: if final:
# playlists are allowed to lack "title"
title = info_dict.get('title', NO_DEFAULT) title = info_dict.get('title', NO_DEFAULT)
if title is NO_DEFAULT: if title is NO_DEFAULT:
raise ExtractorError('Missing "title" field in extractor result', raise ExtractorError('Missing "title" field in extractor result',
@ -2432,7 +2432,7 @@ def _fill_common_fields(self, info_dict, is_video=True):
# Auto generate title fields corresponding to the *_number fields when missing # 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. # in order to always have clean titles. This is very common for TV series.
for field in ('chapter', 'season', 'episode'): for field in ('chapter', 'season', 'episode'):
if info_dict.get('%s_number' % field) is not None and not info_dict.get(field): if final and 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]) info_dict[field] = '%s %d' % (field.capitalize(), info_dict['%s_number' % field])
def _raise_pending_errors(self, info): def _raise_pending_errors(self, info):