From 105b0b700e9d187475a236dc951ed0dd907186cd Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 29 Jan 2021 01:57:14 +0530 Subject: [PATCH] Populate "playlist_*" fields for setting playlist metadata filename Related: #36 --- youtube_dlc/YoutubeDL.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index e88299f19..d396ed8ba 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -1108,13 +1108,22 @@ def __process_playlist(self, ie_result, download): # We process each entry in the playlist playlist = ie_result.get('title') or ie_result.get('id') self.to_screen('[download] Downloading playlist: %s' % playlist) + ie_copy = { + 'playlist': playlist, + 'playlist_id': ie_result.get('id'), + 'playlist_title': ie_result.get('title'), + 'playlist_uploader': ie_result.get('uploader'), + 'playlist_uploader_id': ie_result.get('uploader_id'), + 'playlist_index': 0 + } + ie_copy.update(dict(ie_result)) def ensure_dir_exists(path): return make_dir(path, self.report_error) if self.params.get('writeinfojson', False): infofn = replace_extension( - self.prepare_filepath(self.prepare_filename(ie_result), 'infojson'), + self.prepare_filepath(self.prepare_filename(ie_copy), 'infojson'), 'info.json', ie_result.get('ext')) if not ensure_dir_exists(encodeFilename(infofn)): return @@ -1131,7 +1140,7 @@ def ensure_dir_exists(path): if self.params.get('writedescription', False): descfn = replace_extension( - self.prepare_filepath(self.prepare_filename(ie_result), 'description'), + self.prepare_filepath(self.prepare_filename(ie_copy), 'description'), 'description', ie_result.get('ext')) if not ensure_dir_exists(encodeFilename(descfn)): return