mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-22 17:35:28 +00:00
Testing Travis CI
This commit is contained in:
parent
9d345c1672
commit
31993abc5f
11
.travis.yml
Normal file
11
.travis.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.5"
|
||||
|
||||
install: "pip install irs"
|
||||
|
||||
script:
|
||||
- python tests/song.py
|
||||
- python tests/album.py
|
||||
- python tests/playlist.py
|
|
@ -0,0 +1 @@
|
|||
from .ripper import Ripper
|
|
@ -40,9 +40,13 @@ class Ripper:
|
|||
try:
|
||||
if not song: song = self.args["song_title"]
|
||||
if not artist: artist = self.args["artist"]
|
||||
except ValueError:
|
||||
except KeyError:
|
||||
raise ValueError("Must specify song_title/artist in `args` with init, or in method arguments.")
|
||||
|
||||
clear_line()
|
||||
sys.stdout.write("Finding Youtube Link ...\r")
|
||||
sys.stdout.flush()
|
||||
|
||||
search_terms = song + " " + artist + " " + additional_search
|
||||
query_string = urlencode({"search_query" : (search_terms)})
|
||||
link = "http://www.youtube.com/results?" + query_string
|
||||
|
@ -117,7 +121,9 @@ class Ripper:
|
|||
the_list["artists"] = [{"name": username}]
|
||||
break
|
||||
if the_list != None:
|
||||
print ('"%s" by "%s"' % (the_list["name"], the_list["artists"][0]["name"]))
|
||||
clear_line()
|
||||
sys.stdout.write(type.title() + ': "%s" by "%s"\r' % (the_list["name"], the_list["artists"][0]["name"]))
|
||||
sys.stdout.flush()
|
||||
compilation = ""
|
||||
if type == "album":
|
||||
tmp_artists = []
|
||||
|
@ -215,7 +221,9 @@ class Ripper:
|
|||
|
||||
video_url, video_title = self.find_yt_url(song, artist)
|
||||
|
||||
print ('Downloading "%s" by "%s" ...' % (song, artist))
|
||||
clear_line()
|
||||
sys.stdout.write('Downloading "%s" by "%s" ...\r' % (song, artist))
|
||||
sys.stdout.flush()
|
||||
|
||||
file_name = str(data["file_prefix"] + blank(song, False) + ".mp3")
|
||||
|
||||
|
@ -229,14 +237,14 @@ class Ripper:
|
|||
}],
|
||||
'logger': MyLogger(),
|
||||
'progress_hooks': [my_hook],
|
||||
'output': "tmp_file",
|
||||
}
|
||||
|
||||
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
||||
ydl.download([video_url])
|
||||
|
||||
print ("./*%s*" % video_title.split("/watch?v=")[-1])
|
||||
|
||||
for file in glob.glob("./*%s*" % video_title.split("/watch?v=")[-1]):
|
||||
for file in glob.glob("./*%s*" % video_url.split("/watch?v=")[-1]):
|
||||
os.rename(file, file_name)
|
||||
|
||||
# Ease of Variables (copyright) (patent pending) (git yer filthy hands off)
|
||||
|
@ -255,4 +263,7 @@ class Ripper:
|
|||
m.add_tag("tracknumber", str(data["track_number"]))
|
||||
m.add_tag("discnumber", str(data["disc_number"]))
|
||||
m.add_tag("compilation", data["compilation"])
|
||||
m.add_album_art( str(data["album_art"]))
|
||||
m.add_album_art( str(data["album_art"]))
|
||||
|
||||
|
||||
return file_name
|
|
@ -5,6 +5,9 @@
|
|||
# Youtube-DL Logs and Hooks
|
||||
#==========================
|
||||
|
||||
def clear_line():
|
||||
sys.stdout.write("\x1b[2K\r")
|
||||
|
||||
class MyLogger(object):
|
||||
def debug(self, msg):
|
||||
pass
|
||||
|
@ -18,7 +21,9 @@ class MyLogger(object):
|
|||
|
||||
def my_hook(d):
|
||||
if d['status'] == 'finished':
|
||||
print ("Converting to mp3 ...")
|
||||
clear_line() # TODO: Make this into a method.
|
||||
sys.stdout.write("Converting to mp3 ...\r")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
#=================================
|
||||
|
@ -212,7 +217,7 @@ def banner():
|
|||
flush_puts(center_colors("{0}Ironic Redistribution System ({1}IRS{2})"\
|
||||
.format(BYELLOW, BRED, BYELLOW), COLS))
|
||||
|
||||
flush_puts(center_colors("{0}Made with 😈 by: {1}Kepoor Hampond ({2}kepoorhampond{3})\r"\
|
||||
flush_puts(center_colors("{0}Made with 😈 by: {1}Kepoor Hampond ({2}kepoorhampond{3})"\
|
||||
.format(BBLUE, BYELLOW, BRED, BYELLOW) + END, COLS))
|
||||
|
||||
flush_puts(center_colors("{0}Version: {1}".format(BBLUE, BYELLOW) + pkg_resources.get_distribution("irs").version, COLS))
|
||||
|
|
3
tests/album.py
Normal file
3
tests/album.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from irs import Ripper
|
||||
|
||||
locations = Ripper().spotify_list("album", "Da Frame 2R / Matador")
|
3
tests/playlist.py
Normal file
3
tests/playlist.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from irs import Ripper
|
||||
|
||||
Ripper().spotify_list("playlist", "Jamboree Jams", "prakkillian")
|
3
tests/song.py
Normal file
3
tests/song.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from irs import Ripper
|
||||
|
||||
Ripper().song("Bohemian Rhapsody", "Queen")
|
Loading…
Reference in a new issue