mirror of
https://github.com/cooperhammond/irs.git
synced 2024-12-23 17:45:27 +00:00
fixed it
This commit is contained in:
parent
d4204351c5
commit
6ec1de6251
|
@ -1,7 +1,6 @@
|
||||||
<div align="center"><img src ="http://i.imgur.com/VbsyTe7.png" /></div>
|
<div align="center"><img src ="http://i.imgur.com/VbsyTe7.png" /></div>
|
||||||
|
|
||||||
Ironic Redistribution System
|
# Ironic Redistribution System
|
||||||
===
|
|
||||||
|
|
||||||
[![License: GNU](https://img.shields.io/badge/license-gnu-yellow.svg?style=flat-square)](http://www.gnu.org/licenses/gpl.html)
|
[![License: GNU](https://img.shields.io/badge/license-gnu-yellow.svg?style=flat-square)](http://www.gnu.org/licenses/gpl.html)
|
||||||
[![Stars](https://img.shields.io/github/stars/kepoorhampond/irs.svg?style=flat-square)](https://github.com/kepoorhampond/irs/stargazers)
|
[![Stars](https://img.shields.io/github/stars/kepoorhampond/irs.svg?style=flat-square)](https://github.com/kepoorhampond/irs/stargazers)
|
||||||
|
@ -17,7 +16,6 @@ Ironic Redistribution System
|
||||||
A tool to download your music with metadata. It uses [Spotify](https://www.spotify.com/) for finding metadata and [Youtube](https://www.youtube.com/) for the actual audio source.
|
A tool to download your music with metadata. It uses [Spotify](https://www.spotify.com/) for finding metadata and [Youtube](https://www.youtube.com/) for the actual audio source.
|
||||||
|
|
||||||
Works with Python 2 and 3.
|
Works with Python 2 and 3.
|
||||||
___
|
|
||||||
|
|
||||||
## Demo and Usages
|
## Demo and Usages
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ $ irs -s "Bohemian Rhapsody"
|
||||||
$ irs -p "Best Nirvana"
|
$ irs -p "Best Nirvana"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install & The Dependencies <sub><sup>(my new band name)</sub></sup>
|
## Install & The Dependencies <sub><sup>(my new band name <sub><sup><sup><sub>\s</sub></sup></sup></sub>)</sub></sup>
|
||||||
|
|
||||||
Really there's only one actual external dependency: `ffmpeg`. For windows, you'll want to follow [this](http://www.wikihow.com/Install-FFmpeg-on-Windows) guide. For OSX, you'll want to install it through [`brew`](https://brew.sh/) with this command:
|
Really there's only one actual external dependency: `ffmpeg`. For windows, you'll want to follow [this](http://www.wikihow.com/Install-FFmpeg-on-Windows) guide. For OSX, you'll want to install it through [`brew`](https://brew.sh/) with this command:
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,6 +42,8 @@ class Ripper:
|
||||||
if self.args["hook-text"].get("converting") is not None:
|
if self.args["hook-text"].get("converting") is not None:
|
||||||
CONFIG["converting"] = self.args["hook-text"]["converting"]
|
CONFIG["converting"] = self.args["hook-text"]["converting"]
|
||||||
|
|
||||||
|
self.args = ObjManip.set_utf8_encoding(self.args)
|
||||||
|
|
||||||
self.locations = []
|
self.locations = []
|
||||||
self.type = None
|
self.type = None
|
||||||
try:
|
try:
|
||||||
|
@ -79,7 +81,7 @@ class Ripper:
|
||||||
# those flaws for being exclusive to them.
|
# those flaws for being exclusive to them.
|
||||||
# And if those flaws are really enough to turn you off of them,
|
# And if those flaws are really enough to turn you off of them,
|
||||||
# then you *probably* don't really want to be with them anyways.
|
# then you *probably* don't really want to be with them anyways.
|
||||||
# Either way, it's up to you.
|
# Either way, it's up to you. (I'd just ignore this)
|
||||||
|
|
||||||
if Config.parse_organize(self):
|
if Config.parse_organize(self):
|
||||||
if self.type in ("album", "song"):
|
if self.type in ("album", "song"):
|
||||||
|
@ -193,7 +195,7 @@ album".split(" ")
|
||||||
|
|
||||||
return ("https://youtube.com" + self.code["href"], self.code["title"])
|
return ("https://youtube.com" + self.code["href"], self.code["title"])
|
||||||
|
|
||||||
def album(self, title, artist=None): # Alias for `spotify_list("album", ...)`
|
def album(self, title, artist=None): # Alias for spotify_list("album", ..)
|
||||||
return self.spotify_list("album", title=title, artist=artist)
|
return self.spotify_list("album", title=title, artist=artist)
|
||||||
|
|
||||||
def playlist(self, title, username):
|
def playlist(self, title, username):
|
||||||
|
@ -248,7 +250,9 @@ with init, or in method arguments.")
|
||||||
if the_list is not None:
|
if the_list is not None:
|
||||||
YdlUtils.clear_line()
|
YdlUtils.clear_line()
|
||||||
|
|
||||||
print(self.args["hook-text"].get("list")
|
the_list = ObjManip.set_utf8_encoding(the_list)
|
||||||
|
|
||||||
|
print(unicode(self.args["hook-text"].get("list"))
|
||||||
.format(type.title(), the_list["name"],
|
.format(type.title(), the_list["name"],
|
||||||
the_list["artists"][0]["name"]))
|
the_list["artists"][0]["name"]))
|
||||||
|
|
||||||
|
@ -361,6 +365,7 @@ init, or in method arguments.")
|
||||||
if data == {}:
|
if data == {}:
|
||||||
data = self.parse_song_data(song, artist)
|
data = self.parse_song_data(song, artist)
|
||||||
if data != {}:
|
if data != {}:
|
||||||
|
data = ObjManip.set_utf8_encoding(data)
|
||||||
song = data["name"]
|
song = data["name"]
|
||||||
artist = data["artist"]
|
artist = data["artist"]
|
||||||
|
|
||||||
|
@ -369,7 +374,7 @@ init, or in method arguments.")
|
||||||
|
|
||||||
video_url, video_title = self.find_yt_url(song, artist)
|
video_url, video_title = self.find_yt_url(song, artist)
|
||||||
|
|
||||||
print(self.args["hook-text"].get("song").format(song, artist))
|
print(unicode(self.args["hook-text"].get("song")).format(song, artist))
|
||||||
|
|
||||||
file_name = str(data["file_prefix"] + ObjManip.blank(song, False) +
|
file_name = str(data["file_prefix"] + ObjManip.blank(song, False) +
|
||||||
".mp3")
|
".mp3")
|
||||||
|
|
17
irs/utils.py
17
irs/utils.py
|
@ -56,6 +56,20 @@ class YdlUtils:
|
||||||
# Object Manipulation and Checking
|
# Object Manipulation and Checking
|
||||||
# ================================
|
# ================================
|
||||||
|
|
||||||
|
def set_utf8_encoding(ld): # ld => a list or dictionary with strings in it
|
||||||
|
if type(ld) == dict:
|
||||||
|
for k, v in ld.iteritems():
|
||||||
|
if type(v) == dict or type(v) == list:
|
||||||
|
ld[k] = set_utf8_encoding(v)
|
||||||
|
elif type(v) == str:
|
||||||
|
ld[k] = v.encode('utf-8')
|
||||||
|
elif type(ld) == list:
|
||||||
|
for index, datum in enumerate(ld):
|
||||||
|
if type(datum) == str:
|
||||||
|
ld[index] = datum.encode('utf-8')
|
||||||
|
return ld
|
||||||
|
|
||||||
|
|
||||||
@staticmethods
|
@staticmethods
|
||||||
class ObjManip: # Object Manipulation
|
class ObjManip: # Object Manipulation
|
||||||
def limit_song_name(song):
|
def limit_song_name(song):
|
||||||
|
@ -118,11 +132,14 @@ class ObjManip: # Object Manipulation
|
||||||
del new_d[x]
|
del new_d[x]
|
||||||
return new_d
|
return new_d
|
||||||
|
|
||||||
|
def set_utf8_encoding(ld): # ld => a list or dictionary with strings in it
|
||||||
|
return set_utf8_encoding(ld)
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
# Download Log Reading/Updating/Formatting
|
# Download Log Reading/Updating/Formatting
|
||||||
# ========================================
|
# ========================================
|
||||||
|
|
||||||
|
|
||||||
@staticmethods
|
@staticmethods
|
||||||
class DLog:
|
class DLog:
|
||||||
def format_download_log_line(t, download_status="not downloaded"):
|
def format_download_log_line(t, download_status="not downloaded"):
|
||||||
|
|
Loading…
Reference in a new issue