Adding search service to zukebox-server.
authorHenry Bilby <henrymiller.engenheiro@gmail.com>
Sat, 23 May 2009 01:14:30 +0000 (21:14 -0400)
committerHenry Bilby <henrymiller.engenheiro@gmail.com>
Sat, 23 May 2009 01:14:30 +0000 (21:14 -0400)
zukebox_server/src/search/zukebox_search.py [new file with mode: 0644]

diff --git a/zukebox_server/src/search/zukebox_search.py b/zukebox_server/src/search/zukebox_search.py
new file mode 100644 (file)
index 0000000..705baef
--- /dev/null
@@ -0,0 +1,46 @@
+#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.upnp.device import Device, Service, ServiceController
+
+class Search(Service):
+       """Class Search
+           Implements a search service of zukebox-server
+       """
+
+       service_type = "urn:schemas-upnp-org:service:Search:1"
+       service_name = "Search"
+
+       def __init__(self, xml_path):
+           scpd_path = pjoin(xml_path, "zukebox-search-scpd.xml");
+           Service.__init__(self, service_name, service_type, '', scpd_path,
+               SearchController(service_type))
+
+       def get_list_audio(self):
+           return self.control_controller.get_list_audio()
+
+class SearchController(ServiceController):
+       """Class Search:
+           Implements a search service of zukebox-server
+       """
+       def __init__(self, service_type):
+           ServiceController.__init__(self, service_type)
+           self.genre_list = []
+           self.name_music_list = []
+           self.name_artist_list = []     
+
+       def soap_SearchGenreList(self, *args, **kargs):
+           rt = {"Genre_list": self.genre_list}
+           return {"SearchGenreList": rt}
+
+       def soap_SearchMusicList(self, *args, **kargs):
+           rt = {"Music_list": self.name_music_list}
+           return {"SearchMusicList": rt}
+
+       def soap_SearchArtistList(self, *args, **kargs):
+           rt = {"Artist_list": self.name_artist_list}
+           return {"SearchArtistList": rt}