+++ /dev/null
-
-class Seeker(object):
- """This class implements a pointer for ZukeBox playlist
- A seeker response to a request about the current position, next
- or previous.
- """
- def __init__(self, playlist):
- if playlist is not None:
- self.playlist = playlist
- # the first time the previous position is the current
- self.current = playlist.current
- self.previous = self.current
- self.next = None
-
- def get_next_pos(self):
- next = self.current + 1
- self.next = next
-
- def get_previous_pos(self):
- prev = self.previous
- if prev != 0:
- prev = prev - 1
- self.previous = prev
-
- def get_next(self):
- self.get_next_pos()
- return self.playlist.pop(self.next)
-
- def get_prev(self):
- self.get_previous_pos()
- return self.playlist.pop(self.previous)
-
+++ /dev/null
-#The zukebox server search service implementation
-
-from brisa.core.reactors import install_default_reactor
-reactor = install_default_reactor()
-
-from os.path import join, dirname, abspath
-
-from brisa.core.config import manager
-from brisa.upnp.device import Device, Service, ServiceController
-from zukebox_server.src.plugins.zfacade import ZFacade
-
-plugin_section = 'zukebox_server_plugin-audio-library'
-db_path = manager.get_parameter(plugin_section, 'database_location')
-webserver = None
-
-class SearchOutBoundExcept(Exception):
- def __init__(self, *args, **kargs):
- Exception.__init__(self, *args, **kargs)
-
-
-class Search(Service):
- """Class Search
- Implements a search service of zukebox-server
- """
-
- service_type = "urn:schemas-upnp-org:service:Search:1"
- service_name = "Search"
- facade = ZFacade(db_path, webserver)
-
- def __init__(self, xml_path):
- scpd_path = pjoin(xml_path, "zukebox-search-scpd.xml");
- Service.__init__(self, service_name, service_type, '', scpd_path)
- log.info("Search service scpd_path = %s" % scpd_path)
-
- self.genre_list = []
- self.name_music_list = []
- self.name_artist_list = []
- self.all_audio_list = []
-
- def soap_SearchGenreList(self, *args, **kargs):
- self.genreType = kwargs['GenreType']
- self.genre_list = self.facade.get_audio_genre(self.genreType)
- rt = {"Genre_list": self.genre_list}
- return {"SearchGenreList": rt}
-
- def soap_SearchMusicList(self, *args, **kargs):
- self.musicName = kwargs['MusicName']
- self.name_music_list = self.facade.get_audio_item(self.musicName)
- rt = {"Music_list": self.name_music_list}
- return {"SearchMusicList": rt}
-
- def soap_SearchArtistList(self, *args, **kargs):
- self.artistName = kwargs['ArtistName']
- self.name_artist_list = self.facade.get_audio_artist(self.artistName)
- rt = {"Artist_list": self.name_artist_list}
- return {"SearchArtistList": rt}
-
- def soap_SearchAllAudioList(self, *args, **kargs):
- self.all_audio_list = self.facade.get_audio_all()
- rt = {"All_Audio_list": self.all_audio_list}
- return {"SearchAllAudioList": rt}
-