Skip to content

Commit c04998b

Browse files
author
E.S. Rosenberg a.k.a. Keeper of the Keys
committed
Modify get_cover to allow it to download episode art
1 parent eced6cb commit c04998b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/gpodder/coverart.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,20 @@ class CoverDownloader(object):
4444
def __init__(self, core):
4545
self.core = core
4646

47-
def get_cover(self, podcast, download=False):
48-
filename = podcast.cover_file
49-
cover_url = podcast.cover_url
47+
def get_cover(self, podcast, download=False, episode = None):
48+
if episode != None:
49+
# Get episode art.
50+
filename = episode.art_file
51+
cover_url = episode.episode_art_url
52+
if cover_url is None:
53+
return None
54+
else:
55+
# Get podcast cover.
56+
filename = podcast.cover_file
57+
cover_url = podcast.cover_url
58+
59+
username = podcast.auth_username
60+
password = podcast.auth_password
5061

5162
# Return already existing files
5263
for extension in self.EXTENSIONS:
@@ -62,8 +73,7 @@ def get_cover(self, podcast, download=False):
6273

6374
# We have to add username/password, because password-protected
6475
# feeds might keep their cover art also protected (bug 1521)
65-
cover_url = util.url_add_authentication(cover_url, podcast.auth_username,
66-
podcast.auth_password)
76+
cover_url = util.url_add_authentication(cover_url, username, password)
6777

6878
try:
6979
logger.info('Downloading cover art: %s', cover_url)

0 commit comments

Comments
 (0)