db: Give Discs a "number" property

So we can access the disc number when displaying tracks in the tracklist

Implements: Issue #34 (Give Discs a "number" property)
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-03 16:14:08 -04:00
parent ea31e1539a
commit adfbf8fdbc
2 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,9 @@ class Disc(playlist.Playlist):
return f"{self._number}: {self._subtitle}"
return f"Disc {self._number}"
@GObject.Property
def number(self): return self._number
@GObject.Property
def subtitle(self):
return self._subtitle if self._subtitle else ""

View File

@ -22,7 +22,7 @@ class TestDisc(unittest.TestCase):
disc = self.make_disc("Test Artist", "Test Album", 1, "")
self.assertIsInstance(disc, db.playlist.Playlist)
self.assertEqual(disc.get_property("icon-name"), "media-optical")
self.assertEqual(disc._number, 1)
self.assertEqual(disc.get_property("number"), 1)
def test_delete(self):
artist = db.artist.Table.find("Test Artist", "Test Artist")