From f2966b3e34c9d8c2437d0dbe6da7b0f9cb5d3c70 Mon Sep 17 00:00:00 2001 From: Kepoor Hampond Date: Tue, 13 Dec 2016 19:05:57 -0800 Subject: [PATCH] When downloading an album, it now tells you what status it is in the album, and rather than pausing tells you when it's downloading the album art after listing the album contents. --- irs/manage.py | 5 ++++- irs/metadata.py | 11 +++++++++-- irs/utils.py | 4 ++++ setup.py | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/irs/manage.py b/irs/manage.py index 2c1e2b4..f2175dc 100644 --- a/irs/manage.py +++ b/irs/manage.py @@ -15,7 +15,7 @@ from .utils import * from .metadata import * def find_mp3(song, artist): - print ('\n' + color(song, ["BOLD", "UNDERLINE"]) + ' by ' + color(artist, ["BOLD", "UNDERLINE"]) + '\n') + print (color(song, ["BOLD", "UNDERLINE"]) + ' by ' + color(artist, ["BOLD", "UNDERLINE"]) + '\n') search_terms = song + " " + artist query_string = urlencode({"search_query" : (search_terms)}) @@ -79,10 +79,13 @@ def rip_album(album, artist, for i, j in enumerate(songs): print (bc.OKBLUE + " - " + j + bc.ENDC) + print (bc.YELLOW + "\nFinding album cover ... " + bc.ENDC, end="") album_art_url = get_albumart_url(album, artist) + print (bc.OKGREEN + "\rAlbum cover found: " + bc.ENDC + album_art_url) for i, j in enumerate(songs): song = j + print (color("\n%s/%s - " % (i + 1, len(songs)), ["UNDERLINE"]), end="") rip_mp3(j, artist, part_of_album=True, album=album, tracknum=i + 1, album_art_url=album_art_url) if errors.size > 0: diff --git a/irs/metadata.py b/irs/metadata.py index 6cfc116..607c444 100644 --- a/irs/metadata.py +++ b/irs/metadata.py @@ -36,7 +36,11 @@ def search_google(song, artist, search_terms=""): return list(filter(visible, texts)) -def parse_metadata(song, artist, location, filename, tracknum="", album="", album_art_url=""): +def parse_metadata(song, artist, location, filename, + tracknum="", + album="", + album_art_url="" + ): googled = search_google(song, artist) mp3file = MP3("%s/%s" % (location, filename), ID3=EasyID3) @@ -97,7 +101,10 @@ def parse_metadata(song, artist, location, filename, tracknum="", album="", albu else: # If part of an album, it should do this. embed_mp3(album_art_url, location + "/" + filename) - print (bc.OKGREEN + "Album art parsed: " + bc.ENDC + album_art_url) + if album_art_url: + print (bc.OKGREEN + "Album art parsed!" + bc.ENDC) + else: + print (bc.OKGREEN + "Album art parsed: " + bc.ENDC + album_art_url) except Exception as e: print (bc.FAIL + "Album art not parsed: " + bc.ENDC + e) diff --git a/irs/utils.py b/irs/utils.py index 5700abc..545c3b2 100644 --- a/irs/utils.py +++ b/irs/utils.py @@ -1,3 +1,5 @@ +import sys + def strip_special_chars(string): special_chars = "\ / : * ? \" < > | - ( )".split(" ") for char in special_chars: @@ -44,6 +46,8 @@ else: YELLOW = '' def color(text, colors=[]): + if colors == []: + raise "Must have definitions when calling color(text, colors=[])" color_string = "" for color in colors: color_string += "bc.%s + " % color diff --git a/setup.py b/setup.py index d0286e7..fdd6e8e 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name='irs', - version='1.2.4', + version='1.2.7', description='A music downloader that just gets metadata.', url='https://github.com/kepoorhampond/irs', author='Kepoor Hampond',