diff --git a/downloader.py b/downloader.py index 924c8f3..60d80dd 100755 --- a/downloader.py +++ b/downloader.py @@ -37,6 +37,7 @@ parser.add_argument('--threads', type=int, default=cpu_count(), help='How many d parser.add_argument('--daemon', '-d', action='store_true', help="Run in daemon mode. Disables progress bars sleeps for the amount of time specified in --sleep.") parser.add_argument('--sleep', type=float, default=60, help='How many minutes to sleep when in daemon mode.') parser.add_argument('--silence-errors', '-s', action='store_true', help="Don't print any error messages to the console.") +parser.add_argument('--ignore-downloaded', '-i', action='store_true', help='Ignore videos that have been already downloaded and let YouTubeDL handle everything.') args = parser.parse_args() if args.threads <= 0: @@ -225,13 +226,14 @@ while True: # sys.exit() # Remove already downloaded files from the to-do list. - download_queue = [] - s = set() - for p, video in enumerate(playlist['entries']): - if video['id'] not in downloaded_videos and video['id'] not in s: - download_queue.append(video) - s.add(video['id']) - playlist_bar.update(len(downloaded_videos)) + if not args.ignore_downloaded: + download_queue = [] + s = set() + for p, video in enumerate(playlist['entries']): + if video['id'] not in downloaded_videos and video['id'] not in s: + download_queue.append(video) + s.add(video['id']) + playlist_bar.update(len(downloaded_videos)) if len(download_queue): # Don't mess with multiprocessing if all videos are already downloaded with Pool(processes=args.threads) as pool: