From 07b5b2821504d921704cd6b8c3122cb60e67d471 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Fri, 28 Jul 2023 12:30:55 -0700 Subject: [PATCH] return if no download thumb path --- src/ytdl_sub/entries/entry.py | 4 ++-- src/ytdl_sub/utils/thumbnail.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ytdl_sub/entries/entry.py b/src/ytdl_sub/entries/entry.py index 2432b85d..0538c66c 100644 --- a/src/ytdl_sub/entries/entry.py +++ b/src/ytdl_sub/entries/entry.py @@ -54,7 +54,7 @@ class Entry(EntryVariables, BaseEntry): """Returns the entry's thumbnail's file path to where it was downloaded""" return str(Path(self.working_directory()) / self.get_download_thumbnail_name()) - def get_ytdlp_download_thumbnail_path(self) -> Optional[str]: + def try_get_ytdlp_download_thumbnail_path(self) -> Optional[str]: """ The source `thumbnail` value and the actual downloaded thumbnail extension sometimes do not match. Return the actual downloaded thumbnail path. @@ -90,7 +90,7 @@ class Entry(EntryVariables, BaseEntry): ------- True if ANY thumbnail file exist locally. False otherwise. """ - return self.get_ytdlp_download_thumbnail_path() is not None + return self.try_get_ytdlp_download_thumbnail_path() is not None @final def is_thumbnail_downloaded(self) -> bool: diff --git a/src/ytdl_sub/utils/thumbnail.py b/src/ytdl_sub/utils/thumbnail.py index 0f87a56a..a999f01c 100644 --- a/src/ytdl_sub/utils/thumbnail.py +++ b/src/ytdl_sub/utils/thumbnail.py @@ -29,7 +29,7 @@ def try_convert_download_thumbnail(entry: Entry) -> None: entry Entry with the thumbnail """ - download_thumbnail_path = entry.get_ytdlp_download_thumbnail_path() + download_thumbnail_path: Optional[str] = entry.try_get_ytdlp_download_thumbnail_path() download_thumbnail_path_as_jpg = entry.get_download_thumbnail_path() # If it was already converted, do not convert again @@ -38,6 +38,7 @@ def try_convert_download_thumbnail(entry: Entry) -> None: if not download_thumbnail_path: logger.warning("Thumbnail for '%s' was not downloaded", entry.title) + return if not download_thumbnail_path == download_thumbnail_path_as_jpg: try: