--- /dev/null
+
+import dbus.service
+
+from brisa.core import log
+
+class PlayList(list, dbus.service.Object):
+ """Class PlayList
+ Introduction
+ ============
+ Implements a playlist for ZukeBox server.
+ """
+
+ DBUS_SERVICE_NAME = "br.org.zagaia.PlayList"
+ DBUS_OBJ_PATH = "br/org/zagaia/playlist"
+ DBUS_IFACE = "br.org.zagaia.PlayList"
+
+ def __init__(self, name="", positions=10):
+ self.name = name
+ self.positions = positions
+
+ def is_locked(self):
+ if not len(self) == self.positions:
+ return False
+ return True
+
+ def is_availble(self):
+ if not len(self) == 0:
+ return True
+ return False
+
+ @dbus.service.method(DBUS_IFACE)
+ def append(self, obj):
+ """Put a object in the playlist"""
+ if not self.is_locked():
+ log.info("object in playlist")
+ self.append(obj)
+
+ @dbus.service.method(DBUS_IFACE)
+ def drop(self):
+ """Always pop the first object from list"""
+ if self.is_availble():
+ self.pop(0)
+
+ @dbus.service.method(DBUS_IFACE)
+ def get_size(self):
+ """Return the size of playlist"""
+ return len(self)
+
+ @dbus.service.method(DBUS_IFACE)
+ def previous(self):
+ if self.is_availble():
+ pass
+
+