curds: Genre node cleanups

- Use constants for the sort fields list
- Have alloc_child() set the icon directly, rather than using the one
  passed in by lookup()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-12-17 08:54:51 -05:00
parent e7e1838b13
commit d380a6f329
1 changed files with 4 additions and 5 deletions

View File

@ -1,17 +1,16 @@
# Copyright 2019 (c) Anna Schumaker.
from . import playlist
from .. import notify
from .. import tree
GENRE_ICON = "emblem-generic"
GENRE_ICON = "emblem-generic"
GENRE_SORT = [ "artist", "date", "album", "discnumber", "tracknumber" ]
class GenreNode(tree.ETree):
def __init__(self):
tree.ETree.__init__(self, "Genres", GENRE_ICON)
def alloc_child(self, name, icon):
return playlist.Playlist(name, icon,
[ "artist", "date", "album", "discnumber", "tracknumber" ])
return playlist.Playlist(name, GENRE_ICON, GENRE_SORT)
def new_track(self, track):
self.lookup(track["genre"], GENRE_ICON).add(track)
self.lookup(track["genre"]).add(track)