diff --git a/src/gpodder/coverart.py b/src/gpodder/coverart.py index 84796b3..beaf3df 100644 --- a/src/gpodder/coverart.py +++ b/src/gpodder/coverart.py @@ -46,12 +46,9 @@ def __init__(self, core): def get_cover(self, podcast, download=False, episode=None): if episode: - if podcast.download_episode_art == True: - # Get episode art. - filename = episode.art_file - cover_url = episode.episode_art_url - else: - cover_url = None + # Get episode art. + filename = episode.art_file + cover_url = episode.episode_art_url else: # Get podcast cover. @@ -67,7 +64,7 @@ def get_cover(self, podcast, download=False, episode=None): # Return already existing files for extension in self.EXTENSIONS: if os.path.exists(filename + extension): - return filename + extension + return 'file://' + filename + extension # If allowed to download files, do so here if download: @@ -104,8 +101,10 @@ def get_cover(self, podcast, download=False, episode=None): with open(temp_filename, 'wb') as fp: fp.write(data) - return filename + extension + return 'file://' + filename + extension except Exception as e: logger.warn('Cannot save cover art', exc_info=True) + else: + return cover_url return None diff --git a/src/gpodder/model.py b/src/gpodder/model.py index 0ac1dae..9c3a4a4 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -271,6 +271,13 @@ def delete_download(self): if filename is not None: util.delete_file(filename) + art_filename = self.art_file + if art_filename is not None: + for extension in self.podcast.model.core.cover_downloader.EXTENSIONS: + if os.path.exists(art_filename + extension): + art_filename = art_filename + extension + util.delete_file(art_filename) + self.state = gpodder.STATE_DELETED self.is_new = False self.save() @@ -758,10 +765,6 @@ 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)