curds: Artist node cleanups
- Use constants for the sort list - Have alloc_child() set the icon directly, rather than using the one passed in Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
803cb6f186
commit
e7e1838b13
|
@ -1,19 +1,21 @@
|
|||
# Copyright 2019 (c) Anna Schumaker.
|
||||
from . import playlist
|
||||
from .. import notify
|
||||
from .. import tree
|
||||
|
||||
ALBUM_ICON = "media-optical-cd-audio"
|
||||
ARTIST_ICON = "avatar-default-symbolic"
|
||||
ALBUM_ICON = "media-optical-cd-audio"
|
||||
ALBUM_SORT = [ "discnumber", "tracknumber" ]
|
||||
|
||||
ARTIST_ICON = "avatar-default-symbolic"
|
||||
ARTIST_SORT = [ "album", "discnumber", "tracknumber" ]
|
||||
|
||||
|
||||
class ArtistPlaylist(playlist.Playlist):
|
||||
def alloc_child(self, name, icon):
|
||||
return playlist.Playlist(name, icon, [ "discnumber", "tracknumber" ])
|
||||
return playlist.Playlist(name, ALBUM_ICON, ALBUM_SORT)
|
||||
|
||||
def add(self, track):
|
||||
playlist.Playlist.add(self, track)
|
||||
self.lookup(track["album"], ALBUM_ICON).add(track)
|
||||
self.lookup(track["album"]).add(track)
|
||||
|
||||
|
||||
class ArtistNode(tree.ETree):
|
||||
|
@ -21,7 +23,7 @@ class ArtistNode(tree.ETree):
|
|||
tree.ETree.__init__(self, "Artists", ARTIST_ICON)
|
||||
|
||||
def alloc_child(self, name, icon):
|
||||
return ArtistPlaylist(name, icon, [ "album", "discnumber", "tracknumber" ])
|
||||
return ArtistPlaylist(name, ARTIST_ICON, ARTIST_SORT)
|
||||
|
||||
def new_track(self, track):
|
||||
self.lookup(track["albumartist"], ARTIST_ICON).add(track)
|
||||
self.lookup(track["albumartist"]).add(track)
|
||||
|
|
|
@ -7,7 +7,7 @@ from .. import tree
|
|||
import os
|
||||
import unittest
|
||||
|
||||
test_album = os.path.join("./trier/Test Library/Test Artist 01/Test Album 1")
|
||||
test_album = os.path.join("./trier/Test Library/Test Artist 01/Test Album 1")
|
||||
|
||||
class TestArtistPlaylist(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Reference in New Issue