From 46ced5572db19728f4ab298a99a8e84eae04c0f4 Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 21 Mar 2019 08:15:24 -0400 Subject: [PATCH] added disc number --- musik.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/musik.py b/musik.py index e6abd15..58039ff 100755 --- a/musik.py +++ b/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