|
|
@ -16,6 +16,7 @@ from .utils import (
|
|
|
|
expand_path,
|
|
|
|
expand_path,
|
|
|
|
get_executable_path,
|
|
|
|
get_executable_path,
|
|
|
|
OUTTMPL_TYPES,
|
|
|
|
OUTTMPL_TYPES,
|
|
|
|
|
|
|
|
POSTPROCESS_WHEN,
|
|
|
|
preferredencoding,
|
|
|
|
preferredencoding,
|
|
|
|
remove_end,
|
|
|
|
remove_end,
|
|
|
|
write_string,
|
|
|
|
write_string,
|
|
|
@ -1393,29 +1394,33 @@ def parseOpts(overrideArguments=None):
|
|
|
|
dest='ffmpeg_location',
|
|
|
|
dest='ffmpeg_location',
|
|
|
|
help='Location of the ffmpeg binary; either the path to the binary or its containing directory')
|
|
|
|
help='Location of the ffmpeg binary; either the path to the binary or its containing directory')
|
|
|
|
postproc.add_option(
|
|
|
|
postproc.add_option(
|
|
|
|
'--exec', metavar='CMD',
|
|
|
|
'--exec',
|
|
|
|
action='append', dest='exec_cmd',
|
|
|
|
metavar='[WHEN:]CMD', dest='exec_cmd', default={}, type='str',
|
|
|
|
help=(
|
|
|
|
action='callback', callback=_dict_from_options_callback,
|
|
|
|
'Execute a command on the file after downloading and post-processing. '
|
|
|
|
callback_kwargs={
|
|
|
|
|
|
|
|
'allowed_keys': '|'.join(map(re.escape, POSTPROCESS_WHEN)),
|
|
|
|
|
|
|
|
'default_key': 'after_move',
|
|
|
|
|
|
|
|
'multiple_keys': False,
|
|
|
|
|
|
|
|
'append': True,
|
|
|
|
|
|
|
|
}, help=(
|
|
|
|
|
|
|
|
'Execute a command, optionally prefixed with when to execute it (after_move if unspecified), separated by a ":". '
|
|
|
|
|
|
|
|
'Supported values of "WHEN" are the same as that of --use-postprocessor. '
|
|
|
|
'Same syntax as the output template can be used to pass any field as arguments to the command. '
|
|
|
|
'Same syntax as the output template can be used to pass any field as arguments to the command. '
|
|
|
|
'An additional field "filepath" that contains the final path of the downloaded file is also available. '
|
|
|
|
'After download, an additional field "filepath" that contains the final path of the downloaded file '
|
|
|
|
'If no fields are passed, %(filepath)q is appended to the end of the command. '
|
|
|
|
'is also available, and if no fields are passed, %(filepath)q is appended to the end of the command. '
|
|
|
|
'This option can be used multiple times'))
|
|
|
|
'This option can be used multiple times'))
|
|
|
|
postproc.add_option(
|
|
|
|
postproc.add_option(
|
|
|
|
'--no-exec',
|
|
|
|
'--no-exec',
|
|
|
|
action='store_const', dest='exec_cmd', const=[],
|
|
|
|
action='store_const', dest='exec_cmd', const={},
|
|
|
|
help='Remove any previously defined --exec')
|
|
|
|
help='Remove any previously defined --exec')
|
|
|
|
postproc.add_option(
|
|
|
|
postproc.add_option(
|
|
|
|
'--exec-before-download', metavar='CMD',
|
|
|
|
'--exec-before-download', metavar='CMD',
|
|
|
|
action='append', dest='exec_before_dl_cmd',
|
|
|
|
action='append', dest='exec_before_dl_cmd',
|
|
|
|
help=(
|
|
|
|
help=optparse.SUPPRESS_HELP)
|
|
|
|
'Execute a command before the actual download. '
|
|
|
|
|
|
|
|
'The syntax is the same as --exec but "filepath" is not available. '
|
|
|
|
|
|
|
|
'This option can be used multiple times'))
|
|
|
|
|
|
|
|
postproc.add_option(
|
|
|
|
postproc.add_option(
|
|
|
|
'--no-exec-before-download',
|
|
|
|
'--no-exec-before-download',
|
|
|
|
action='store_const', dest='exec_before_dl_cmd', const=[],
|
|
|
|
action='store_const', dest='exec_before_dl_cmd', const=[],
|
|
|
|
help='Remove any previously defined --exec-before-download')
|
|
|
|
help=optparse.SUPPRESS_HELP)
|
|
|
|
postproc.add_option(
|
|
|
|
postproc.add_option(
|
|
|
|
'--convert-subs', '--convert-sub', '--convert-subtitles',
|
|
|
|
'--convert-subs', '--convert-sub', '--convert-subtitles',
|
|
|
|
metavar='FORMAT', dest='convertsubtitles', default=None,
|
|
|
|
metavar='FORMAT', dest='convertsubtitles', default=None,
|
|
|
|