diff --git a/src/ytdl_sub/downloaders/downloader.py b/src/ytdl_sub/downloaders/downloader.py index 919fd288..eb73b43c 100644 --- a/src/ytdl_sub/downloaders/downloader.py +++ b/src/ytdl_sub/downloaders/downloader.py @@ -1,5 +1,6 @@ import abc import contextlib +import copy import json import os import time @@ -185,6 +186,7 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT, DownloaderEntryT] """ num_tries = 0 entry_files_exist = False + ytdl_options_overrides = copy.deepcopy(ytdl_options_overrides) while not entry_files_exist and num_tries < self._extract_entry_num_retries: entry_dict = self.extract_info(ytdl_options_overrides=ytdl_options_overrides, **kwargs) @@ -193,6 +195,11 @@ class Downloader(DownloadArchiver, Generic[DownloaderOptionsT, DownloaderEntryT] time.sleep(self._extract_entry_retry_wait_sec) num_tries += 1 + + # Remove the download archive so it can retry without thinking its already downloaded, + # even though it is not + ytdl_options_overrides["download_archive"] = None + if num_tries < self._extract_entry_retry_wait_sec: download_logger.debug( "Failed to download entry. Retrying %d / %d", diff --git a/src/ytdl_sub/entries/entry.py b/src/ytdl_sub/entries/entry.py index ab3dd954..5970bc26 100644 --- a/src/ytdl_sub/entries/entry.py +++ b/src/ytdl_sub/entries/entry.py @@ -65,8 +65,8 @@ class Entry(EntryVariables, BaseEntry): ------- True if the file and thumbnail exist locally. False otherwise. """ - thumbnail_exists = os.path.isfile( - self.get_download_thumbnail_path() + thumbnail_exists = ( + os.path.isfile(self.get_download_thumbnail_path()) or self.get_ytdlp_download_thumbnail_path() is not None ) file_exists = os.path.isfile(self.get_download_file_path()) diff --git a/tests/e2e/youtube/test_channel_as_kodi_tv_show.py b/tests/e2e/youtube/test_channel.py similarity index 100% rename from tests/e2e/youtube/test_channel_as_kodi_tv_show.py rename to tests/e2e/youtube/test_channel.py