Added a catch for album art.

This commit is contained in:
Kepoor Hampond 2017-01-17 19:57:48 -08:00
parent 9c171efb12
commit afac16a0bf
3 changed files with 20 additions and 14 deletions

View file

@ -317,8 +317,11 @@ class Manager:
if tracknum:
mp3.add_track_number(tracknum)
image_url = mp3.add_album_art(self.get_album_art(artist, mp3.get_attr('album')))
exclaim_good("Album art: ", image_url)
try:
image_url = mp3.add_album_art(self.get_album_art(artist, mp3.get_attr('album')))
exclaim_good("Album art: ", image_url)
except Exception:
print (bc.FAIL + "Album art not added." + bc.ENDC)
print (color(song, ["BOLD", "UNDERLINE"]) + bc.OKGREEN + ' downloaded successfully!'+ bc.ENDC)

View file

@ -107,19 +107,22 @@ class Metadata:
pass
if not image_url:
image_url = self.get_album_art(self.args.artist, self.mp3["album"][0])
image_url = self.get_album_art(self.artist, self.mp3["album"][0])
mp3.tags.add(
APIC(
encoding = 3,
mime = 'image/png',
type = 3,
desc = 'cover',
data = urlopen(image_url).read()
try:
mp3.tags.add(
APIC(
encoding = 3,
mime = 'image/png',
type = 3,
desc = 'cover',
data = urlopen(image_url).read()
)
)
)
mp3.save()
return image_url
mp3.save()
return image_url
except Exception:
return False
def search_google(self, search_terms=""):

View file

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='irs',
version='2.7.18',
version='2.7.19',
description='A music downloader that just gets metadata.',
url='https://github.com/kepoorhampond/irs',
author='Kepoor Hampond',