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: if tracknum:
mp3.add_track_number(tracknum) mp3.add_track_number(tracknum)
image_url = mp3.add_album_art(self.get_album_art(artist, mp3.get_attr('album'))) try:
exclaim_good("Album art: ", image_url) 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) print (color(song, ["BOLD", "UNDERLINE"]) + bc.OKGREEN + ' downloaded successfully!'+ bc.ENDC)

View file

@ -107,19 +107,22 @@ class Metadata:
pass pass
if not image_url: 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( try:
APIC( mp3.tags.add(
encoding = 3, APIC(
mime = 'image/png', encoding = 3,
type = 3, mime = 'image/png',
desc = 'cover', type = 3,
data = urlopen(image_url).read() desc = 'cover',
data = urlopen(image_url).read()
)
) )
) mp3.save()
mp3.save() return image_url
return image_url except Exception:
return False
def search_google(self, search_terms=""): def search_google(self, search_terms=""):

View file

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