mirror of
https://github.com/cooperhammond/irs.git
synced 2025-01-08 20:05:27 +00:00
Added feature based off of https://github.com/kepoorhampond/irs/issues/8
This commit is contained in:
parent
99658fde08
commit
65c7709e39
|
@ -15,7 +15,10 @@ CONFIG = dict(
|
||||||
client_id = '',
|
client_id = '',
|
||||||
client_secret = '',
|
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",
|
directory = str(expanduser("~")) + "/Music",
|
||||||
|
|
||||||
# If you want numbered file names
|
# If you want numbered file names
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Manager:
|
||||||
|
|
||||||
print (color(song, ["BOLD", "UNDERLINE"]) + ' by ' + color(artist, ["BOLD", "UNDERLINE"]))
|
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)})
|
query_string = urlencode({"search_query" : (search_terms)})
|
||||||
|
|
||||||
html_content = urlopen("http://www.youtube.com/results?" + query_string)
|
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])
|
audio_url = ("http://www.youtube.com/watch?v=" + search_results[i])
|
||||||
except Exception:
|
except Exception:
|
||||||
print (bc.FAIL + "Could not find song." + bc.ENDC)
|
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())
|
title = strip_special_chars((BeautifulSoup(urlopen(audio_url), 'html.parser')).title.string.lower())
|
||||||
song_title = song.lower().split("/")
|
song_title = song.lower().split("/")
|
||||||
|
@ -227,6 +227,9 @@ class Manager:
|
||||||
tracknum=song["tracknum"], album_art_url=song["album_cover"], \
|
tracknum=song["tracknum"], album_art_url=song["album_cover"], \
|
||||||
out_of="%s/%s - " % (song["tracknum"], len(songs)))
|
out_of="%s/%s - " % (song["tracknum"], len(songs)))
|
||||||
|
|
||||||
|
if song_loc == False:
|
||||||
|
continue
|
||||||
|
|
||||||
if self.args.one_folder:
|
if self.args.one_folder:
|
||||||
|
|
||||||
one_folder = CONFIG["directory"] + "/" + strip_special_chars(name[:30])
|
one_folder = CONFIG["directory"] + "/" + strip_special_chars(name[:30])
|
||||||
|
@ -268,6 +271,9 @@ class Manager:
|
||||||
print (color(out_of, ["UNDERLINE"]), end="")
|
print (color(out_of, ["UNDERLINE"]), end="")
|
||||||
audio_code = self.find_mp3(song=song, artist=artist)
|
audio_code = self.find_mp3(song=song, artist=artist)
|
||||||
|
|
||||||
|
if audio_code == False:
|
||||||
|
return False
|
||||||
|
|
||||||
if CONFIG["numbered_file_names"] and tracknum:
|
if CONFIG["numbered_file_names"] and tracknum:
|
||||||
track = str(tracknum) + " - "
|
track = str(tracknum) + " - "
|
||||||
else:
|
else:
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='irs',
|
name='irs',
|
||||||
version='3.1.1',
|
version='3.2.1',
|
||||||
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',
|
||||||
|
|
Loading…
Reference in a new issue