Add --force-download-archive by by h-h-h-h

Authored-by: h-h-h-h
pull/6/head^2
pukkandan 4 years ago
parent 732044afb2
commit 2d30509fc8

@ -353,6 +353,10 @@ I will add some memorable short links to the binaries so you can download them e
playlist information in a single line. playlist information in a single line.
--print-json Be quiet and print the video information as --print-json Be quiet and print the video information as
JSON (video is still being downloaded). JSON (video is still being downloaded).
--force-write-archive Force download archive entries to be written
as far as no errors occur, even if -s or
another simulation switch is used.
(Same as --force-download-archive)
--newline Output progress bar as new lines --newline Output progress bar as new lines
--no-progress Do not print progress bar --no-progress Do not print progress bar
--console-title Display progress in console titlebar --console-title Display progress in console titlebar

@ -7,6 +7,7 @@
"forcethumbnail": false, "forcethumbnail": false,
"forcetitle": false, "forcetitle": false,
"forceurl": false, "forceurl": false,
"force_write_download_archive": false,
"format": "best", "format": "best",
"ignoreerrors": false, "ignoreerrors": false,
"listformats": null, "listformats": null,

@ -166,6 +166,8 @@ class YoutubeDL(object):
forcejson: Force printing info_dict as JSON. forcejson: Force printing info_dict as JSON.
dump_single_json: Force printing the info_dict of the whole playlist dump_single_json: Force printing the info_dict of the whole playlist
(or video) as a single JSON line. (or video) as a single JSON line.
force_write_download_archive: Force writing download archive regardless of
'skip_download' or 'simulate'.
simulate: Do not download the video files. simulate: Do not download the video files.
format: Video format code. see "FORMAT SELECTION" for more details. format: Video format code. see "FORMAT SELECTION" for more details.
format_sort: How to sort the video formats. see "Sorting Formats" for more details. format_sort: How to sort the video formats. see "Sorting Formats" for more details.
@ -1856,8 +1858,11 @@ class YoutubeDL(object):
# Forced printings # Forced printings
self.__forced_printings(info_dict, filename, incomplete=False) self.__forced_printings(info_dict, filename, incomplete=False)
# Do nothing else if in simulate mode
if self.params.get('simulate', False): if self.params.get('simulate', False):
if self.params.get('force_write_download_archive', False):
self.record_download_archive(info_dict)
# Do nothing else if in simulate mode
return return
if filename is None: if filename is None:
@ -2188,7 +2193,10 @@ class YoutubeDL(object):
except (PostProcessingError) as err: except (PostProcessingError) as err:
self.report_error('postprocessing: %s' % str(err)) self.report_error('postprocessing: %s' % str(err))
return return
self.record_download_archive(info_dict) must_record_download_archive = True
if must_record_download_archive or self.params.get('force_write_download_archive', False):
self.record_download_archive(info_dict)
def download(self, url_list): def download(self, url_list):
"""Download a given list of URLs.""" """Download a given list of URLs."""

@ -349,6 +349,7 @@ def _real_main(argv=None):
'forceformat': opts.getformat, 'forceformat': opts.getformat,
'forcejson': opts.dumpjson or opts.print_json, 'forcejson': opts.dumpjson or opts.print_json,
'dump_single_json': opts.dump_single_json, 'dump_single_json': opts.dump_single_json,
'force_write_download_archive': opts.force_write_download_archive,
'simulate': opts.simulate or any_getting, 'simulate': opts.simulate or any_getting,
'skip_download': opts.skip_download, 'skip_download': opts.skip_download,
'format': opts.format, 'format': opts.format,

@ -682,8 +682,13 @@ def parseOpts(overrideArguments=None):
verbosity.add_option( verbosity.add_option(
'--print-json', '--print-json',
action='store_true', dest='print_json', default=False, action='store_true', dest='print_json', default=False,
help='Be quiet and print the video information as JSON (video is still being downloaded).', help='Be quiet and print the video information as JSON (video is still being downloaded).')
) verbosity.add_option(
'--force-write-download-archive', '--force-write-archive', '--force-download-archive',
action='store_true', dest='force_write_download_archive', default=False,
help=(
'Force download archive entries to be written as far as no errors occur,'
'even if -s or another simulation switch is used.'))
verbosity.add_option( verbosity.add_option(
'--newline', '--newline',
action='store_true', dest='progress_with_newline', default=False, action='store_true', dest='progress_with_newline', default=False,

Loading…
Cancel
Save