]> jfr.im git - yt-dlp.git/commitdiff
Add --force-download-archive by by h-h-h-h
authorpukkandan <redacted>
Thu, 5 Nov 2020 17:43:21 +0000 (23:13 +0530)
committerpukkandan <redacted>
Sun, 13 Dec 2020 14:35:04 +0000 (20:05 +0530)
Authored-by: h-h-h-h
README.md
test/parameters.json
youtube_dlc/YoutubeDL.py
youtube_dlc/__init__.py
youtube_dlc/options.py

index f46c65dff8973fa66abb77e6c2ac57f8a10c6b34..04ad40f1a1697adb9c216b9f404f3ad599e4d950 100644 (file)
--- a/README.md
+++ b/README.md
@@ -353,6 +353,10 @@ ## Verbosity / Simulation Options:
                                      playlist information in a single line.
     --print-json                     Be quiet and print the video information as
                                      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
     --no-progress                    Do not print progress bar
     --console-title                  Display progress in console titlebar
index 76c2a9ae77cbfa5e87360e75382f9537b2af13b6..f8abed2dd4cb1e8249e1c6dded90a0b6d22f7b5b 100644 (file)
@@ -7,6 +7,7 @@
     "forcethumbnail": false, 
     "forcetitle": false, 
     "forceurl": false, 
+    "force_write_download_archive": false,
     "format": "best",
     "ignoreerrors": false, 
     "listformats": null, 
index 97e4f451f1e74bc8b7b1f9c95023adf5dc6e945a..8fe608fc968dfd20e86076e7631c1e3fb3755a00 100644 (file)
@@ -166,6 +166,8 @@ class YoutubeDL(object):
     forcejson:         Force printing info_dict as JSON.
     dump_single_json:  Force printing the info_dict of the whole playlist
                        (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.
     format:            Video format code. see "FORMAT SELECTION" for more details.
     format_sort:       How to sort the video formats. see "Sorting Formats" for more details.
@@ -1856,8 +1858,11 @@ def process_info(self, info_dict):
         # Forced printings
         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('force_write_download_archive', False):
+                self.record_download_archive(info_dict)
+
+            # Do nothing else if in simulate mode
             return
 
         if filename is None:
@@ -2188,7 +2193,10 @@ def compatible_formats(formats):
                 except (PostProcessingError) as err:
                     self.report_error('postprocessing: %s' % str(err))
                     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):
         """Download a given list of URLs."""
index d183016b6ea300599f183c28373d2bd671ac4273..4f57ac6a80254518bcd868197da046d798e8fde4 100644 (file)
@@ -349,6 +349,7 @@ def parse_retries(retries):
         'forceformat': opts.getformat,
         'forcejson': opts.dumpjson or opts.print_json,
         'dump_single_json': opts.dump_single_json,
+        'force_write_download_archive': opts.force_write_download_archive,
         'simulate': opts.simulate or any_getting,
         'skip_download': opts.skip_download,
         'format': opts.format,
index bd85abd3a850d229c4e008815c87a66db5a9f589..e85006a87130b86633cdc4b568b3ca858dffa8ca 100644 (file)
@@ -682,8 +682,13 @@ def _comma_separated_values_options_callback(option, opt_str, value, parser):
     verbosity.add_option(
         '--print-json',
         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(
         '--newline',
         action='store_true', dest='progress_with_newline', default=False,