mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
fixed .cue compatibility with MPD 0.22
This commit is contained in:
parent
37d2c3161f
commit
741f2bbf40
16
bin/mpdevil
16
bin/mpdevil
@ -415,6 +415,10 @@ class ClientHelper():
|
|||||||
"date": "",
|
"date": "",
|
||||||
"genre": ""
|
"genre": ""
|
||||||
}
|
}
|
||||||
|
if "range" in song: # translate .cue 'range' to 'duration' if needed
|
||||||
|
start, end=song["range"].split("-")
|
||||||
|
if start != "" and end != "":
|
||||||
|
base_song["duration"]=str((float(end)-float(start)))
|
||||||
base_song.update(song)
|
base_song.update(song)
|
||||||
base_song["human_duration"]=ClientHelper.seconds_to_display_time(int(float(base_song["duration"])))
|
base_song["human_duration"]=ClientHelper.seconds_to_display_time(int(float(base_song["duration"])))
|
||||||
return base_song
|
return base_song
|
||||||
@ -552,8 +556,11 @@ class Client(MPDClient):
|
|||||||
|
|
||||||
def get_metadata(self, uri):
|
def get_metadata(self, uri):
|
||||||
meta_base=self.lsinfo(uri)[0]
|
meta_base=self.lsinfo(uri)[0]
|
||||||
meta_extra=self.readcomments(uri) # contains comment tag
|
try: # .cue files produce an error here
|
||||||
meta_base.update(meta_extra)
|
meta_extra=self.readcomments(uri) # contains comment tag
|
||||||
|
meta_base.update(meta_extra)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return meta_base
|
return meta_base
|
||||||
|
|
||||||
def toggle_play(self):
|
def toggle_play(self):
|
||||||
@ -1389,8 +1396,9 @@ class Cover(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if song_file is not None:
|
if song_file is not None:
|
||||||
head, tail=os.path.split(song_file)
|
song_dir=os.path.join(lib_path, os.path.dirname(song_file))
|
||||||
song_dir=os.path.join(lib_path, head)
|
if song_dir.endswith(".cue"):
|
||||||
|
song_dir=os.path.dirname(song_dir) # get actual directory of .cue file
|
||||||
if os.path.exists(song_dir):
|
if os.path.exists(song_dir):
|
||||||
for f in os.listdir(song_dir):
|
for f in os.listdir(song_dir):
|
||||||
if regex.match(f):
|
if regex.match(f):
|
||||||
|
Loading…
Reference in New Issue
Block a user