diff --git a/musik.py b/musik.py
index 80bb014..61401b7 100755
--- a/musik.py
+++ b/musik.py
@@ -35,6 +35,7 @@ class Track:
m = mutagen.mp3.EasyMP3(filepath)
else:
m = mutagen.File(filepath)
+ self.tracknumber = m.get('tracknumber', [''])[0]
self.title = m.get('title', [''])[0]
self.artist = m.get('artist', [''])[0]
self.album = m.get('album', [''])[0]
@@ -55,6 +56,7 @@ def build_library(root_dir):
filepath = os.path.join(root_dir, dir_name, file)
track = Track(filepath)
tracks.append(track)
+ print("Done")
return tracks
@@ -133,7 +135,9 @@ class Selection(Resource):
found.append(track)
if not found:
abort(404, message="Album does not exist.")
- return [t.title for t in found]
+ found = [t.tracknumber + " - " + t.title for t in found]
+ found.sort()
+ return found
elif args.get('artist'):
found = []
diff --git a/static/musik.js b/static/musik.js
index ab1d2e2..e58a5ad 100644
--- a/static/musik.js
+++ b/static/musik.js
@@ -43,7 +43,7 @@ function select_album(select) {
nav_items = JSON.parse(httpRequest.responseText);
let html_str = '';
for (let i = 0; i < nav_items.length; i++) {
- html_str += '';
+ html_str += '';
}
document.getElementById('trackList').innerHTML = html_str;
};
@@ -59,7 +59,6 @@ function select_track(select) {
if (httpRequest.status !== 200) { return; }
let track = JSON.parse(httpRequest.responseText);
- console.log(track);
let source = document.getElementById('stream');
source.src = track.streampath;
let player = document.getElementById('player');