added disc number
This commit is contained in:
parent
9152ed1c83
commit
46ced5572d
4
musik.py
4
musik.py
|
@ -38,6 +38,7 @@ class Track:
|
|||
else:
|
||||
m = mutagen.File(filepath)
|
||||
self.tracknumber = m.get('tracknumber', [''])[0]
|
||||
self.discnumber = m.get('discnumber', [''])[0]
|
||||
self.title = m.get('title', [''])[0]
|
||||
if m.get('albumartist'):
|
||||
self.artist = m.get('albumartist', [''])[0]
|
||||
|
@ -45,6 +46,7 @@ class Track:
|
|||
self.artist = m.get('artist', [''])[0]
|
||||
self.album = m.get('album', [''])[0]
|
||||
self.date = m.get('date', [''])[0]
|
||||
self.genre = m.get('genre', [''])[0]
|
||||
self.length = str(int(m.info.length) // 60) + ":"
|
||||
self.length += str(int(m.info.length) % 60)
|
||||
self.filepath = filepath
|
||||
|
@ -174,7 +176,7 @@ class Selection(Resource):
|
|||
found.append(track)
|
||||
if not found:
|
||||
abort(404, message="Album does not exist.")
|
||||
found = [t.tracknumber + " - " + t.title for t in found]
|
||||
found = [f"{t.discnumber}.{t.tracknumber} - {t.title}" for t in found]
|
||||
found.sort()
|
||||
return found
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user