mirror of
https://github.com/cooperhammond/irs.git
synced 2025-01-02 19:15:26 +00:00
Fixed issue #11
This commit is contained in:
parent
df86541d62
commit
42b5818d1b
|
@ -33,12 +33,12 @@ class Metadata:
|
|||
self.location = location
|
||||
#self.mp3 = MP3(self.location, ID3=EasyID3)
|
||||
self.mp3 = EasyID3(self.location)
|
||||
|
||||
|
||||
def add_tag(self, tag, data):
|
||||
# For valid tags: `EasyID3.valid_keys.keys()`
|
||||
self.mp3[tag] = data
|
||||
self.mp3.save()
|
||||
|
||||
|
||||
def read_tag(self, tag):
|
||||
try:
|
||||
return self.mp3[tag]
|
||||
|
@ -57,7 +57,7 @@ class Metadata:
|
|||
)
|
||||
)
|
||||
mp3.save()
|
||||
|
||||
|
||||
def find_album_and_track(song, artist):
|
||||
tracks = spotipy.Spotify().search(q=song, type="track")["tracks"]["items"]
|
||||
for track in tracks:
|
||||
|
@ -65,7 +65,7 @@ def find_album_and_track(song, artist):
|
|||
if blank_include(track["artists"][0]["name"], artist):
|
||||
return track["album"], track
|
||||
return False, False
|
||||
|
||||
|
||||
def parse_genre(genres):
|
||||
if genres != []:
|
||||
genres.reverse()
|
||||
|
|
|
@ -288,8 +288,9 @@ class Ripper:
|
|||
|
||||
if data == {}:
|
||||
data = self.parse_song_data(song, artist)
|
||||
song = data["name"]
|
||||
artist = data["artist"]
|
||||
if data != {}:
|
||||
song = data["name"]
|
||||
artist = data["artist"]
|
||||
|
||||
if "file_prefix" not in data:
|
||||
data["file_prefix"] = ""
|
||||
|
|
|
@ -40,7 +40,7 @@ def blank(string, downcase=True):
|
|||
regex = re.compile('[^a-zA-Z0-9\ ]')
|
||||
string = regex.sub('', string)
|
||||
if downcase: string = string.lower()
|
||||
return string
|
||||
return ' '.join(string.split())
|
||||
|
||||
def blank_include(this, includes_this):
|
||||
this = blank(this)
|
||||
|
@ -300,10 +300,10 @@ from .config import CONFIG
|
|||
def check_sources(ripper, key, default=None, environment=False, where=None):
|
||||
tmp_args = ripper.args
|
||||
if where != None and ripper.args.get(where):
|
||||
tmp_args = ripper.args.get(where)
|
||||
tmp_args = ripper.args.get("where")
|
||||
|
||||
if tmp_args.get(key):
|
||||
return tmp_args.get(key)
|
||||
if ripper.args.get(key):
|
||||
return ripper.args.get(key)
|
||||
elif CONFIG.get(key):
|
||||
return CONFIG.get(key)
|
||||
elif os.environ.get(key) and environment == True:
|
||||
|
|
Loading…
Reference in a new issue