This commit is contained in:
Kepoor Hampond 2017-01-31 19:08:04 -08:00
parent 99658fde08
commit 65c7709e39
3 changed files with 13 additions and 4 deletions

View file

@ -15,7 +15,10 @@ CONFIG = dict(
client_id = '',
client_secret = '',
# For a custom directory. Note that `~` will not work as a shortcut.
additional_search_terms = 'lyrics',
# For a custom directory. Note that `~` will not work as a shortcut in a
# plain text manner.
directory = str(expanduser("~")) + "/Music",
# If you want numbered file names

View file

@ -64,7 +64,7 @@ class Manager:
print (color(song, ["BOLD", "UNDERLINE"]) + ' by ' + color(artist, ["BOLD", "UNDERLINE"]))
search_terms = song + " " + artist + " lyrics"
search_terms = song + " " + artist + " " + CONFIG["additional_search_terms"]
query_string = urlencode({"search_query" : (search_terms)})
html_content = urlopen("http://www.youtube.com/results?" + query_string)
@ -86,7 +86,7 @@ class Manager:
audio_url = ("http://www.youtube.com/watch?v=" + search_results[i])
except Exception:
print (bc.FAIL + "Could not find song." + bc.ENDC)
exit(1)
return False
title = strip_special_chars((BeautifulSoup(urlopen(audio_url), 'html.parser')).title.string.lower())
song_title = song.lower().split("/")
@ -227,6 +227,9 @@ class Manager:
tracknum=song["tracknum"], album_art_url=song["album_cover"], \
out_of="%s/%s - " % (song["tracknum"], len(songs)))
if song_loc == False:
continue
if self.args.one_folder:
one_folder = CONFIG["directory"] + "/" + strip_special_chars(name[:30])
@ -268,6 +271,9 @@ class Manager:
print (color(out_of, ["UNDERLINE"]), end="")
audio_code = self.find_mp3(song=song, artist=artist)
if audio_code == False:
return False
if CONFIG["numbered_file_names"] and tracknum:
track = str(tracknum) + " - "
else:

View file

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