From ae5d438f83b48b963173a77235f80e73095ae6cf Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 03:53:26 +0300 Subject: [PATCH 01/17] Improve quality of podcast cover retrieved to original. --- src/gpodder/plugins/soundcloud.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gpodder/plugins/soundcloud.py b/src/gpodder/plugins/soundcloud.py index 2492e53..109595c 100644 --- a/src/gpodder/plugins/soundcloud.py +++ b/src/gpodder/plugins/soundcloud.py @@ -107,7 +107,12 @@ def get_user_info(self): def get_coverart(self): user_info = self.get_user_info() - return user_info.get('avatar_url', None) + avatar_url = user_info.get('avatar_url', None) + if avatar_url != None: + # Soundcloud API by default returns the URL to "large" artwork - 100x100 + # by replacing "-large" with "-original" in the URL we get unresized files. + return avatar_url.replace("-large", "-original") + return avatar_url def get_user_id(self): user_info = self.get_user_info() From e693d8f5d64a4a58c1d5a1aff8708ed85af92a0d Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 03:58:25 +0300 Subject: [PATCH 02/17] Add episode art url field --- src/gpodder/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index e0b715f..6424420 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -94,7 +94,7 @@ class EpisodeModelFields(minidb.Model): chapters = minidb.JSON subtitle = str description_html = str - + episode_art_url = str class PodcastModelFields(minidb.Model): title = str From 5d4036af2ca4d7031284e64e4c27480bf139ddc9 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:04:59 +0300 Subject: [PATCH 03/17] Add per episode art work in soundcloud plugin. --- src/gpodder/plugins/soundcloud.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gpodder/plugins/soundcloud.py b/src/gpodder/plugins/soundcloud.py index 109595c..46b638c 100644 --- a/src/gpodder/plugins/soundcloud.py +++ b/src/gpodder/plugins/soundcloud.py @@ -179,6 +179,10 @@ def get_tracks(self, feed, channel): filetype = self.cache['episodes'][track_guid]['filetype'] read_from_cache += 1 + artwork_url = track.get('artwork_url') + if artwork_url != None and artwork_url != '': + artwork_url = artwork_url.replace("-large", "-original") + yield { 'title': track.get('title', track.get('permalink')) or ('Unknown track'), 'link': track.get('permalink_url') or 'https://soundcloud.com/' + self.username, @@ -189,6 +193,7 @@ def get_tracks(self, feed, channel): 'guid': track_guid, 'published': soundcloud_parsedate(track.get('created_at', None)), 'total_time': int(track.get('duration') / 1000), + 'episode_art_url' : artwork_url, } logger.debug('Read %d episodes from %d cached episodes', read_from_cache, len(self.cache['episodes'])) From 4d28ef8387aa561be8ca26fde919d73ea8c9e7c2 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:10:36 +0300 Subject: [PATCH 04/17] Add art_file() property to PodcastEpisode, attempts to get the filename from the URL, if it fails uses guid. --- src/gpodder/model.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index 6424420..dc6e879 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -45,6 +45,8 @@ import minidb +from urllib.parse import urlparse + class NoHandlerForURL(Exception): pass @@ -96,6 +98,7 @@ class EpisodeModelFields(minidb.Model): description_html = str episode_art_url = str + class PodcastModelFields(minidb.Model): title = str url = str @@ -462,6 +465,19 @@ def update_from_dict(self, episode_dict): if k in episode_dict: setattr(self, k, episode_dict[k]) + @property + def art_file(self): + if self.episode_art_url != None and self.episode_art_url != '': + filename = self.guid + try: + url = urlparse(self.episode_art_url) + filename = os.path.basename(url.path) + except: + logger.debug('urlparse failed for episode_art_url: %s', self.episode_art_url) + + return os.path.join(self.podcast.save_dir, filename) + return None + class PodcastChannel(PodcastModelFields, PodcastModelMixin): _common_prefix = str From 6593dff599c7602ae2bf082ad8aec125e8286819 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:15:01 +0300 Subject: [PATCH 05/17] Changes podcast cover art to also be based on URL while maintaining old behavior ('folder') upon failure --- src/gpodder/model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index dc6e879..68058d3 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -936,7 +936,14 @@ def remove_downloaded(self): @property def cover_file(self): - return os.path.join(self.save_dir, 'folder') + filename = 'folder' + try: + url = urlparse(self.cover_url) + filename = os.path.basename(url.path) + except: + logger.debug('urlparse failed for cover_url: %s', self.cover_url) + + return os.path.join(self.save_dir, filename) class Model(object): From eced6cb97b9517a2227335cfdbf7c551201626bf Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:17:35 +0300 Subject: [PATCH 06/17] Only run get_cover after a directory name has been established --- src/gpodder/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index 68058d3..527843c 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -769,8 +769,9 @@ def update(self): logger.info('URL updated: {} -> {}'.format(old_url, self.url)) self._consume_custom_feed(result) - # Download the cover art if it's not yet available - self.model.core.cover_downloader.get_cover(self, download=True) + # Download the cover art if it's not yet available, don't run if no save_dir was created yet. + if self.save_dir != None: + self.model.core.cover_downloader.get_cover(self, download=True) self.save() From c04998b451b5d5ff90b68f218cbedb6e48239e30 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:23:30 +0300 Subject: [PATCH 07/17] Modify get_cover to allow it to download episode art --- src/gpodder/coverart.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index e7a05b9..a6908cb 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -44,9 +44,20 @@ class CoverDownloader(object): def __init__(self, core): self.core = core - def get_cover(self, podcast, download=False): - filename = podcast.cover_file - cover_url = podcast.cover_url + def get_cover(self, podcast, download=False, episode = None): + if episode != None: + # Get episode art. + filename = episode.art_file + cover_url = episode.episode_art_url + if cover_url is None: + return None + else: + # Get podcast cover. + filename = podcast.cover_file + cover_url = podcast.cover_url + + username = podcast.auth_username + password = podcast.auth_password # Return already existing files for extension in self.EXTENSIONS: @@ -62,8 +73,7 @@ def get_cover(self, podcast, download=False): # We have to add username/password, because password-protected # feeds might keep their cover art also protected (bug 1521) - cover_url = util.url_add_authentication(cover_url, podcast.auth_username, - podcast.auth_password) + cover_url = util.url_add_authentication(cover_url, username, password) try: logger.info('Downloading cover art: %s', cover_url) From 5d5966c1209a456d32c0d6c433142f1ad5845acf Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 04:26:04 +0300 Subject: [PATCH 08/17] Scan for episode art --- src/gpodder/model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index 527843c..af88dc3 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -753,6 +753,10 @@ def _consume_custom_feed(self, custom_feed): # Add new episodes to episodes self.episodes.extend(new_episodes) + # Verify that all episode art is up-to-date + for episode in self.episodes: + self.model.core.cover_downloader.get_cover(self, download=True, episode=episode) + # Sort episodes by pubdate, descending self.episodes.sort(key=lambda e: e.published, reverse=True) From 3719e8abe3938c596749f7ed76981290001a9217 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 20:31:34 +0300 Subject: [PATCH 09/17] Fix double file extension issue --- src/gpodder/coverart.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index a6908cb..6875d3e 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -60,6 +60,9 @@ def get_cover(self, podcast, download=False, episode = None): password = podcast.auth_password # Return already existing files + if os.path.exists(filename): + return filename + for extension in self.EXTENSIONS: if os.path.exists(filename + extension): return filename + extension @@ -85,10 +88,27 @@ def get_cover(self, podcast, download=False, episode = None): try: extension = None - for filetype, check in list(self.SUPPORTED_EXTENSIONS.items()): - if check(data): - extension = filetype - break + fname, ext = os.path.splitext(filename) + + # Check if an extension is part of the filename and that it matches the filetype + if ext != None and ext != '' : + ext_unchanged = ext + # Assume last part of filename parts is extension + ext = ext.lower() + # Deal with alternative extensions for supported format, + # should more cases need to be added a mapping dictionary can be created. + if ext == '.jpeg': + ext = '.jpg' + if ext in self.SUPPORTED_EXTENSIONS: + if self.SUPPORTED_EXTENSIONS[ext](data): + filename = fname + extension = ext_unchanged + # Filename did not include an extension or the extension did not match the filetype + if extension is None: + for filetype, check in list(self.SUPPORTED_EXTENSIONS.items()): + if check(data): + extension = filetype + break if extension is None: msg = 'Unknown file type: %s (%r)' % (cover_url, data[:6]) From 7f5c2ab7d508c215911aac4cbeebd198707a3a29 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 21:06:06 +0300 Subject: [PATCH 10/17] Add most relevant paths to known files. It could be that the event where filename still gets an extension added by the system is missed. --- src/gpodder/model.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index af88dc3..a9492cc 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -569,8 +569,16 @@ def check_download_folder(self): known_files.add(filename) - known_files.update(os.path.join(self.save_dir, 'folder' + ext) - for ext in coverart.CoverDownloader.EXTENSIONS) + if self.cover_file != 'folder': + known_files.add(os.path.join(self.save_dir, self.cover_file)) + else: + known_files.update(os.path.join(self.save_dir, 'folder' + ext) + for ext in coverart.CoverDownloader.EXTENSIONS) + + for episode in self.episodes: + filename = episode.art_file + if filename != None and filename != '': + known_files.add(os.path.join(self.save_dir, filename)) existing_files = {filename for filename in glob.glob(os.path.join(self.save_dir, '*')) From 649fc5a6ff5b39e47c0695a3ccf7185c4bfff9d1 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Tue, 31 Mar 2020 21:11:28 +0300 Subject: [PATCH 11/17] Version number bump to 4.11.0 - "Geshem" --- share/man/man1/gpo.1 | 2 +- src/gpodder/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man1/gpo.1 b/share/man/man1/gpo.1 index 1e51169..ad1770c 100644 --- a/share/man/man1/gpo.1 +++ b/share/man/man1/gpo.1 @@ -1,4 +1,4 @@ -.TH GPO "1" "March 2020" "gpodder 4.10.0" "User Commands" +.TH GPO "1" "March 2020" "gpodder 4.11.0" "User Commands" .SH NAME gpo \- gPodder command-line interface .SH SYNOPSIS diff --git a/src/gpodder/__init__.py b/src/gpodder/__init__.py index f27a2fd..94a33fc 100644 --- a/src/gpodder/__init__.py +++ b/src/gpodder/__init__.py @@ -50,9 +50,9 @@ # This metadata block gets parsed by setup.py - use single quotes only __tagline__ = 'Media and podcast aggregator' __author__ = 'Thomas Perl ' -__version__ = '4.10.0' -__date__ = '2020-03-03' -__relname__ = 'Matar' +__version__ = '4.11.0' +__date__ = '2020-03-31' +__relname__ = 'Geshem' __copyright__ = '© 2005-2020 Thomas Perl and the gPodder Team' __license__ = 'ISC / GPLv3 or later' __url__ = 'http://gpodder.org/' From 1014d2ea6fdb0a893b44a79ae1cbc972d57d7175 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 00:25:22 +0300 Subject: [PATCH 12/17] conditional statement cleanup as suggested by @elelay --- src/gpodder/coverart.py | 10 +++++----- src/gpodder/model.py | 8 ++++---- src/gpodder/plugins/soundcloud.py | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 6875d3e..150694d 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -45,11 +45,11 @@ def __init__(self, core): self.core = core def get_cover(self, podcast, download=False, episode = None): - if episode != None: + if episode: # Get episode art. filename = episode.art_file cover_url = episode.episode_art_url - if cover_url is None: + if not cover_url: return None else: # Get podcast cover. @@ -91,7 +91,7 @@ def get_cover(self, podcast, download=False, episode = None): fname, ext = os.path.splitext(filename) # Check if an extension is part of the filename and that it matches the filetype - if ext != None and ext != '' : + if ext: ext_unchanged = ext # Assume last part of filename parts is extension ext = ext.lower() @@ -104,13 +104,13 @@ def get_cover(self, podcast, download=False, episode = None): filename = fname extension = ext_unchanged # Filename did not include an extension or the extension did not match the filetype - if extension is None: + if not extension: for filetype, check in list(self.SUPPORTED_EXTENSIONS.items()): if check(data): extension = filetype break - if extension is None: + if not extension: msg = 'Unknown file type: %s (%r)' % (cover_url, data[:6]) raise ValueError(msg) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index a9492cc..f473230 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -467,12 +467,12 @@ def update_from_dict(self, episode_dict): @property def art_file(self): - if self.episode_art_url != None and self.episode_art_url != '': + if self.episode_art_url: filename = self.guid try: url = urlparse(self.episode_art_url) filename = os.path.basename(url.path) - except: + except Exception: logger.debug('urlparse failed for episode_art_url: %s', self.episode_art_url) return os.path.join(self.podcast.save_dir, filename) @@ -577,7 +577,7 @@ def check_download_folder(self): for episode in self.episodes: filename = episode.art_file - if filename != None and filename != '': + if filename: known_files.add(os.path.join(self.save_dir, filename)) existing_files = {filename for filename in @@ -782,7 +782,7 @@ def update(self): self._consume_custom_feed(result) # Download the cover art if it's not yet available, don't run if no save_dir was created yet. - if self.save_dir != None: + if self.save_dir: self.model.core.cover_downloader.get_cover(self, download=True) self.save() diff --git a/src/gpodder/plugins/soundcloud.py b/src/gpodder/plugins/soundcloud.py index 46b638c..9d06460 100644 --- a/src/gpodder/plugins/soundcloud.py +++ b/src/gpodder/plugins/soundcloud.py @@ -108,7 +108,7 @@ def get_user_info(self): def get_coverart(self): user_info = self.get_user_info() avatar_url = user_info.get('avatar_url', None) - if avatar_url != None: + if avatar_url: # Soundcloud API by default returns the URL to "large" artwork - 100x100 # by replacing "-large" with "-original" in the URL we get unresized files. return avatar_url.replace("-large", "-original") @@ -164,7 +164,7 @@ def get_tracks(self, feed, channel): for track in tracks: # Prefer stream URL (MP3), fallback to download URL base_url = track.get('stream_url') if track['streamable'] else track.get('download_url') - if base_url != None: + if base_url: url = base_url + '?consumer_key=%(consumer_key)s' % {'consumer_key': CONSUMER_KEY} else: logger.debug('Skipping track with no base_url') @@ -180,7 +180,7 @@ def get_tracks(self, feed, channel): read_from_cache += 1 artwork_url = track.get('artwork_url') - if artwork_url != None and artwork_url != '': + if artwork_url: artwork_url = artwork_url.replace("-large", "-original") yield { From b369ec4983055f8b21d48f66a054b033b8ed7d47 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 00:27:39 +0300 Subject: [PATCH 13/17] Formatting --- src/gpodder/coverart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 150694d..085bb1b 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -44,7 +44,7 @@ class CoverDownloader(object): def __init__(self, core): self.core = core - def get_cover(self, podcast, download=False, episode = None): + def get_cover(self, podcast, download=False, episode=None): if episode: # Get episode art. filename = episode.art_file From b653308ade8cb0aba4dea7261ce3d24ca4946c6f Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 01:45:34 +0300 Subject: [PATCH 14/17] Improved handling of cover/art filenames, functions now behave the same. Dropped 'folder.ext' in favor of sha512 hash of url when no filename is available. --- src/gpodder/coverart.py | 25 ++++--------------------- src/gpodder/model.py | 35 +++++++++++++++-------------------- 2 files changed, 19 insertions(+), 41 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 085bb1b..576f4fd 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -88,27 +88,10 @@ def get_cover(self, podcast, download=False, episode=None): try: extension = None - fname, ext = os.path.splitext(filename) - - # Check if an extension is part of the filename and that it matches the filetype - if ext: - ext_unchanged = ext - # Assume last part of filename parts is extension - ext = ext.lower() - # Deal with alternative extensions for supported format, - # should more cases need to be added a mapping dictionary can be created. - if ext == '.jpeg': - ext = '.jpg' - if ext in self.SUPPORTED_EXTENSIONS: - if self.SUPPORTED_EXTENSIONS[ext](data): - filename = fname - extension = ext_unchanged - # Filename did not include an extension or the extension did not match the filetype - if not extension: - for filetype, check in list(self.SUPPORTED_EXTENSIONS.items()): - if check(data): - extension = filetype - break + for filetype, check in list(self.SUPPORTED_EXTENSIONS.items()): + if check(data): + extension = filetype + break if not extension: msg = 'Unknown file type: %s (%r)' % (cover_url, data[:6]) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index f473230..a71bc85 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -151,6 +151,7 @@ class __minidb_defaults__: current_position = 0 current_position_updated = 0 last_playback = 0 + episode_art_url = '' def __init__(self, channel): self._parent = channel @@ -468,12 +469,10 @@ def update_from_dict(self, episode_dict): @property def art_file(self): if self.episode_art_url: - filename = self.guid - try: - url = urlparse(self.episode_art_url) - filename = os.path.basename(url.path) - except Exception: - logger.debug('urlparse failed for episode_art_url: %s', self.episode_art_url) + filename, extension = util.filename_from_url(self.episode_art_url) + + if not filename: + filename = hashlib.sha512(self.episode_art_url.encode('utf-8')).hexdigest() return os.path.join(self.podcast.save_dir, filename) return None @@ -569,16 +568,14 @@ def check_download_folder(self): known_files.add(filename) - if self.cover_file != 'folder': - known_files.add(os.path.join(self.save_dir, self.cover_file)) - else: - known_files.update(os.path.join(self.save_dir, 'folder' + ext) - for ext in coverart.CoverDownloader.EXTENSIONS) + known_files.update(os.path.join(self.cover_file + ext) + for ext in coverart.CoverDownloader.EXTENSIONS) for episode in self.episodes: filename = episode.art_file if filename: - known_files.add(os.path.join(self.save_dir, filename)) + known_files.update(os.path.join(episode.art_file + ext) + for ext in coverart.CoverDownloader.EXTENSIONS) existing_files = {filename for filename in glob.glob(os.path.join(self.save_dir, '*')) @@ -949,14 +946,12 @@ def remove_downloaded(self): @property def cover_file(self): - filename = 'folder' - try: - url = urlparse(self.cover_url) - filename = os.path.basename(url.path) - except: - logger.debug('urlparse failed for cover_url: %s', self.cover_url) - - return os.path.join(self.save_dir, filename) + if self.cover_url: + filename, extension = util.filename_from_url(self.cover_url) + if not filename: + filename = hashlib.sha512(self.cover_url.encode('utf-8')).hexdigest() + return os.path.join(self.save_dir, filename) + return None class Model(object): From c6e5676c2336a63eee31c7a35518a9e33c5d81e4 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 01:52:31 +0300 Subject: [PATCH 15/17] Remove unused import --- src/gpodder/model.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gpodder/model.py b/src/gpodder/model.py index a71bc85..62d4439 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -45,8 +45,6 @@ import minidb -from urllib.parse import urlparse - class NoHandlerForURL(Exception): pass From 61f04fdbc3a5055f46f246b77cb8c0346faea7e3 Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 02:09:31 +0300 Subject: [PATCH 16/17] Tweak logic since now both cover_file and art_file may return None. --- src/gpodder/coverart.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 576f4fd..30591d2 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -49,13 +49,14 @@ def get_cover(self, podcast, download=False, episode=None): # Get episode art. filename = episode.art_file cover_url = episode.episode_art_url - if not cover_url: - return None else: # Get podcast cover. filename = podcast.cover_file cover_url = podcast.cover_url + if not cover_url: + return None + username = podcast.auth_username password = podcast.auth_password From 857a4cc64beb00492ac5f3ed09b06ef96ed7445f Mon Sep 17 00:00:00 2001 From: "E.S. Rosenberg a.k.a. Keeper of the Keys" Date: Wed, 1 Apr 2020 02:12:07 +0300 Subject: [PATCH 17/17] Removed check made obsolete by new behavior of art_file and cover_file --- src/gpodder/coverart.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 30591d2..bfb1dfe 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -61,9 +61,6 @@ def get_cover(self, podcast, download=False, episode=None): password = podcast.auth_password # Return already existing files - if os.path.exists(filename): - return filename - for extension in self.EXTENSIONS: if os.path.exists(filename + extension): return filename + extension