diff options
author | pukkandan <pukkandan@gmail.com> | 2021-02-03 19:06:09 +0530 |
---|---|---|
committer | pukkandan <pukkandan@gmail.com> | 2021-02-05 04:11:39 +0530 |
commit | de6000d913fd35643cb6faf89919665ddd9ab225 (patch) | |
tree | 6960b6211f37df02e81189f88bdcbd3267edfcfd /youtube_dlc/options.py | |
parent | ff88a05cff49ec1a2d6b93c0a420b63537fd6f42 (diff) | |
download | hypervideo-pre-de6000d913fd35643cb6faf89919665ddd9ab225.tar.lz hypervideo-pre-de6000d913fd35643cb6faf89919665ddd9ab225.tar.xz hypervideo-pre-de6000d913fd35643cb6faf89919665ddd9ab225.zip |
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
Diffstat (limited to 'youtube_dlc/options.py')
-rw-r--r-- | youtube_dlc/options.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index 98946666d..06fbaa3cd 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -16,6 +16,7 @@ from .compat import ( from .utils import ( expand_path, get_executable_path, + OUTTMPL_TYPES, preferredencoding, write_string, ) @@ -831,19 +832,23 @@ def parseOpts(overrideArguments=None): metavar='TYPE:PATH', dest='paths', default={}, type='str', action='callback', callback=_dict_from_multiple_values_options_callback, callback_kwargs={ - 'allowed_keys': 'home|temp|config|description|annotation|subtitle|infojson|thumbnail', + 'allowed_keys': 'home|temp|%s' % '|'.join(OUTTMPL_TYPES.keys()), 'process': lambda x: x.strip()}, help=( 'The paths where the files should be downloaded. ' - 'Specify the type of file and the path separated by a colon ":" ' - '(supported: description|annotation|subtitle|infojson|thumbnail). ' + 'Specify the type of file and the path separated by a colon ":". ' + 'All the same types as --output are supported. ' 'Additionally, you can also provide "home" and "temp" paths. ' 'All intermediary files are first downloaded to the temp path and ' 'then the final files are moved over to the home path after download is finished. ' - 'Note that this option is ignored if --output is an absolute path')) + 'This option is ignored if --output is an absolute path')) filesystem.add_option( '-o', '--output', - dest='outtmpl', metavar='TEMPLATE', + metavar='[TYPE:]TEMPLATE', dest='outtmpl', default={}, type='str', + action='callback', callback=_dict_from_multiple_values_options_callback, + callback_kwargs={ + 'allowed_keys': '|'.join(OUTTMPL_TYPES.keys()), + 'default_key': 'default', 'process': lambda x: x.strip()}, help='Output filename template, see "OUTPUT TEMPLATE" for details') filesystem.add_option( '--output-na-placeholder', |