28 lines
816 B
Python
28 lines
816 B
Python
# 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"
|
|
|
|
|
|
class ArtistPlaylist(playlist.Playlist):
|
|
def alloc_child(self, name, icon):
|
|
return playlist.Playlist(name, icon, [ "discnumber", "tracknumber" ])
|
|
|
|
def add(self, track):
|
|
playlist.Playlist.add(self, track)
|
|
self.find_child(track["album"], ALBUM_ICON).add(track)
|
|
|
|
|
|
class ArtistNode(tree.ETree):
|
|
def __init__(self):
|
|
tree.ETree.__init__(self, "Artists", ARTIST_ICON)
|
|
|
|
def alloc_child(self, name, icon):
|
|
return ArtistPlaylist(name, icon, [ "album", "discnumber", "tracknumber" ])
|
|
|
|
def new_track(self, track):
|
|
self.find_child(track["albumartist"], ARTIST_ICON).add(track)
|