Misc fixes - See desc

* Remove unnecessary uses of _list_from_options_callback
* Fix download tests - Bug from 6e84b21559
* Rename ExecAfterDownloadPP to ExecPP and refactor its tests
* Ensure _write_ytdl_file closes file handle on error - Potential fix for #517
This commit is contained in:
pukkandan
2021-08-09 17:40:24 +05:30
parent 2831b4686c
commit ad3dc496bb
8 changed files with 43 additions and 41 deletions

View File

@@ -23,7 +23,7 @@ from .cookies import SUPPORTED_BROWSERS
from .version import __version__
from .downloader.external import list_external_downloaders
from .postprocessor.ffmpeg import (
from .postprocessor import (
FFmpegExtractAudioPP,
FFmpegSubtitlesConvertorPP,
FFmpegThumbnailsConvertorPP,
@@ -803,9 +803,8 @@ def parseOpts(overrideArguments=None):
action='store_true', dest='skip_download', default=False,
help='Do not download the video but write all related files (Alias: --no-download)')
verbosity.add_option(
'-O', '--print', metavar='TEMPLATE',
action='callback', dest='forceprint', type='str', default=[],
callback=_list_from_options_callback, callback_kwargs={'delim': None},
'-O', '--print',
metavar='TEMPLATE', action='append', dest='forceprint',
help=(
'Quiet, but print the given fields for each video. Simulate unless --no-simulate is used. '
'Either a field name or same syntax as the output template can be used'))
@@ -1276,8 +1275,7 @@ def parseOpts(overrideArguments=None):
help='Location of the ffmpeg binary; either the path to the binary or its containing directory')
postproc.add_option(
'--exec', metavar='CMD',
action='callback', dest='exec_cmd', default=[], type='str',
callback=_list_from_options_callback, callback_kwargs={'delim': None},
action='append', dest='exec_cmd',
help=(
'Execute a command on the file after downloading and post-processing. '
'Same syntax as the output template can be used to pass any field as arguments to the command. '
@@ -1290,8 +1288,7 @@ def parseOpts(overrideArguments=None):
help='Remove any previously defined --exec')
postproc.add_option(
'--exec-before-download', metavar='CMD',
action='callback', dest='exec_before_dl_cmd', default=[], type='str',
callback=_list_from_options_callback, callback_kwargs={'delim': None},
action='append', dest='exec_before_dl_cmd',
help=(
'Execute a command before the actual download. '
'The syntax is the same as --exec but "filepath" is not available. '