curds: Convert the Playlist class into a PlaylistNode
We just make it inherit from the base class Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
3a89ff8885
commit
261b08f3f4
|
@ -9,9 +9,12 @@ library_thread = threadqueue.ThreadQueue()
|
|||
|
||||
class LibraryPlaylist(playlist.Playlist):
|
||||
def __init__(self, path):
|
||||
playlist.Playlist.__init__(self, os.path.abspath(path), "folder-music")
|
||||
playlist.Playlist.__init__(self, path, "folder-music")
|
||||
self.scan()
|
||||
|
||||
def __normalize__(self, name):
|
||||
return os.path.abspath(name)
|
||||
|
||||
def scan(self):
|
||||
library_thread.push(self.thread_scan)
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Copyright 2019 (c) Anna Schumaker.
|
||||
from . import node
|
||||
from .. import notify
|
||||
import random
|
||||
|
||||
class Playlist():
|
||||
class Playlist(node.PlaylistNode):
|
||||
def __init__(self, name, icon=""):
|
||||
self.name = name
|
||||
self.icon = icon
|
||||
node.PlaylistNode.__init__(self, name, icon)
|
||||
self.list = [ ]
|
||||
self.current = -1
|
||||
self.iter = -1
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2019 (c) Anna Schumaker.
|
||||
from . import node
|
||||
from . import playlist
|
||||
from .. import notify
|
||||
from .. import tags
|
||||
|
@ -32,6 +33,7 @@ class TestPlaylist(unittest.TestCase):
|
|||
|
||||
def test_playlist_init(self):
|
||||
plist = playlist.Playlist("Test Playlist")
|
||||
self.assertIsInstance(plist, node.PlaylistNode)
|
||||
self.assertEqual(plist.name, "Test Playlist")
|
||||
self.assertEqual(plist.icon, "")
|
||||
self.assertEqual(plist.list, [ ])
|
||||
|
|
Loading…
Reference in New Issue