1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-14 05:25:12 +00:00

Multiple output templates for different file types

Syntax: -o common_template -o type:type_template
Types supported: subtitle|thumbnail|description|annotation|infojson|pl_description|pl_infojson
This commit is contained in:
pukkandan
2021-02-03 19:06:09 +05:30
parent ff88a05cff
commit de6000d913
8 changed files with 136 additions and 98 deletions

View File

@@ -25,6 +25,7 @@ class MoveFilesAfterDownloadPP(PostProcessor):
dl_path, dl_name = os.path.split(encodeFilename(info['filepath']))
finaldir = info.get('__finaldir', dl_path)
finalpath = os.path.join(finaldir, dl_name)
self.files_to_move.update(info['__files_to_move'])
self.files_to_move[info['filepath']] = finalpath
for oldfile, newfile in self.files_to_move.items():
@@ -39,7 +40,7 @@ class MoveFilesAfterDownloadPP(PostProcessor):
if os.path.exists(encodeFilename(newfile)):
if self.get_param('overwrites', True):
self.report_warning('Replacing existing file "%s"' % newfile)
os.path.remove(encodeFilename(newfile))
os.remove(encodeFilename(newfile))
else:
self.report_warning(
'Cannot move file "%s" out of temporary directory since "%s" already exists. '