mirror of
https://github.com/cooperhammond/irs.git
synced 2025-03-22 16:15:05 +00:00
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.
This commit is contained in:
parent
e745f086ce
commit
f2966b3e34
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue