1
0
Fork 0
mirror of https://github.com/mwalbeck/podfox.git synced 2025-04-07 07:35:35 +00:00

Add option to download cover image

This commit is contained in:
Magnus Walbeck 2017-06-29 15:27:13 +02:00
parent 0ef9138b7a
commit ea09982aae

View file

@ -131,6 +131,8 @@ def import_feed(url, shortname=''):
print('imported ' +
Fore.GREEN + feed['title'] + Fore.RESET + ' with shortname ' +
Fore.BLUE + feed['shortname'] + Fore.RESET)
if CONFIGURATION["cover_image"]:
get_cover_image(shortname, d["feed"]["image"]["url"])
def update_feed(feed):
@ -151,6 +153,25 @@ def update_feed(feed):
print('new episode.')
feed = sort_feed(feed)
overwrite_config(feed)
if CONFIGURATION["cover_image"]:
get_cover_image(feed["shortname"], d["feed"]["image"]["url"])
def get_cover_image(shortname, url):
'''
download the cover image of podcast
'''
# Check if an image name is set in the config file
if "cover_image_name" in CONFIGURATION:
filename = CONFIGURATION["cover_image_name"]
else:
filename = "folder"
filename += get_extenstion(url)
# Only download if the image doesn't exists in the podcast folder
if not file_exists(shortname, filename):
download_single(shortname, url, filename)
def overwrite_config(feed):