Commit d10e689c authored by Marinus Schraal's avatar Marinus Schraal

widgets: Use track number tags

Music was using a count system to calculate the track number of songs,
resulting in incorrect track numbers if songs were missing and on
multi-disc albums. Use Grilo track number property instead and have
tracker look them up from tags.
parent e7fe2b7c
...@@ -56,6 +56,7 @@ class Grilo(GObject.GObject): ...@@ -56,6 +56,7 @@ class Grilo(GObject.GObject):
Grl.METADATA_KEY_LYRICS, Grl.METADATA_KEY_LYRICS,
Grl.METADATA_KEY_THUMBNAIL, Grl.METADATA_KEY_THUMBNAIL,
Grl.METADATA_KEY_TITLE, Grl.METADATA_KEY_TITLE,
Grl.METADATA_KEY_TRACK_NUMBER,
Grl.METADATA_KEY_URL Grl.METADATA_KEY_URL
] ]
......
...@@ -272,6 +272,7 @@ class Query(): ...@@ -272,6 +272,7 @@ class Query():
nmm:artistName(nmm:performer(?song)) AS ?artist nmm:artistName(nmm:performer(?song)) AS ?artist
nie:title(nmm:musicAlbum(?song)) AS ?album nie:title(nmm:musicAlbum(?song)) AS ?album
nfo:duration(?song) AS ?duration nfo:duration(?song) AS ?duration
nmm:trackNumber(?song) AS ?track_number
nmm:setNumber(nmm:musicAlbumDisc(?song)) AS ?album_disc_number nmm:setNumber(nmm:musicAlbumDisc(?song)) AS ?album_disc_number
IF(bound(?tag), 'truth!', '') AS ?lyrics IF(bound(?tag), 'truth!', '') AS ?lyrics
WHERE { WHERE {
......
...@@ -304,7 +304,7 @@ class DiscBox(Gtk.Box): ...@@ -304,7 +304,7 @@ class DiscBox(Gtk.Box):
song_widget.number = builder.get_object('num') song_widget.number = builder.get_object('num')
song_widget.number.set_markup( song_widget.number.set_markup(
'<span color=\'grey\'>{}</span>'.format(len(self._songs))) '<span color=\'grey\'>{}</span>'.format(track.get_track_number()))
song_widget.number.set_no_show_all(True) song_widget.number.set_no_show_all(True)
song_widget.title = builder.get_object('title') song_widget.title = builder.get_object('title')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment