|
|
|
Lhugsereg
|
Hello there,
as I've announced in the ticket system (#240), I'm currently trying to write a simple DAAP Backend for Coherence. It's basic functionality is implemented (based on lolcats and ampache backends)and I'd like to do some testing. However, I can't get it running, it simply says "Can't enable DaapStore plugin, not found!". Till now, I've tried a symling in the directory where all the other backends are place,but it didn't help. I have attached my code, would be nice if someone could have a look at it :) Thanks in advance Flows [coherence-daap.py] # -*- coding: utf-8 -*- # Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # Copyright 2009, Florian Wiesweg <[hidden email]> from coherence.backend import BackendStore from coherence.backend import BackendItem from coherence.upnp.core import DIDLLite from daap import DAAPClient class DaapMusicTrack(BackendItem): def __init__(self, id, parent_id, track): self.track = track self.update_id = 0 self.id = id self.parent_id = parent_id self.item = DIDLLite.MusicTrack(id, parent_id, name) def get_id(self): return self.id def get_name(self): return self.tracks.__getattr__('name') class DaapContainer(BackendItem): def __init__(self, parent_id, id): BackendItem.__init__(self) self.parent_id = parent_id self.id = id self.name = name self.mimetype = 'directory' self.children = [] self.item.childCount = None self.update_id = 0 self.item = DIDLLite.Container(id, parent_id, self.name) def get_children(self, start=0, end=0): if end != 0: return self.children[start:end] return self.children[start:] def get_child_count(self): return len(self.children) def get_id(self): return self.id def get_item(self): return self.item class DaapPlaylist(DaapContainer): def __init__(self, id, parent_id, name): DaapContainer.__init__(self, id, parent_id) self.name = name def get_name(self): return self.name class DaapStore(BackendStore): implements = ["MediaServer"] logCategory = 'daap_store' daapd_url = None ROOT_ID = 0 databaseName = None next_id = 1000 def __init__(self, server, **kwargs): BackendStore.__init__(self, server, **kwargs) self.name = kwargs.get('name', 'Daap' ) self.refresh = int(kwargs.get('refresh', 10)) self.remoteServer = kwargs.get('server', 'localhost') self.remotePort = int(kwargs.get('port', 3689)) self.databaseName = kwargs.get('database', None) self.password = kwargs.get('password', None) self.musictracks = {} self.container= DaapContainer(None, self.ROOT_ID, 'root' ) self.wmc_mapping = {'16': 0} self.update_data() def __repr__(self): return str(self.__class__).split('.')[-1] def upnp_init(self): self.current_connection_id = None if self.server: self.server.connection_manager_server.set_variable(0, 'SourceProtocolInfo', 'internal:%s:audio/mpeg:*' % self.server.coherence.hostname, 'http-get:*:audio/mpeg:*', 'internal:%s:application/ogg:*' % self.server.coherence.hostname, 'http-get:*:application/ogg:*', default=True) def _update_container(self, result=None): if self.server: self.server.content_directory_server.set_variable(0, 'SystemUpdateID', self.update_id) value = (self.ROOT_ID,self.container.update_id) self.server.content_directory_server.set_variable(0, 'ContainerUpdateIDs', value) return result def update_data(self): self.client = DaapClient() client.connect(self.server, self.port, self.password) self.session = client if session is None: self.warning('could not connect to daap server %s, port %d', self.server, self.port) return databases = self.session.databases() if session is None: self.databaseName = self.session.library().name self.database=None for d in databases: if d.name == self.databaseName: self.database = d if database is None: self.warning('database not found: %s', self.databaseName) tracks = self.database.tracks() self.musictracks = {} self.container= DaapContainer(None, self.ROOT_ID, 'root' ) for t in self.tracks: musicTrack = DaapMusicTrack(self.next_id, self.ROOT_ID, t) self.container.children.append(musicTrack) self.images[self.next_id] = image self.next_id += 1 self.container.update_id += 1 self.update_id += 1 def get_by_id(self, id): if isinstance(id, basestring): id = id.split('@',1) id = id[0] if int(id) == self.ROOT_ID: return self.container return self.musicTracks.get(int(id), None) if __name__ == '__main__': from coherence.base import Coherence from twisted.internet import reactor def main(): def got_result(result): print "got_result" def call_browse(ObjectID=0,StartingIndex=0,RequestedCount=0): # r = f.backend.upnp_Browse(BrowseFlag='BrowseDirectChildren', # RequestedCount=RequestedCount, # StartingIndex=StartingIndex, # ObjectID=ObjectID, # SortCriteria='*', # Filter='') # r.addCallback(got_result) # r.addErrback(got_result) pass def call_test(start,count): #r = f.backend.ampache_query_artists(start,count) #r.addCallback(got_result) #r.addErrback(got_result) pass config = {} config['logmode'] = 'warning' c = Coherence(config) f = c.add_plugin('DaapStore', server='homeserver.local', port='3689') reactor.callLater(3, call_browse, 0, 0, 0) #reactor.callLater(3, call_browse, AUDIO_ALL_CONTAINER_ID, 0, 0) #reactor.callLater(3, call_browse, AUDIO_ARTIST_CONTAINER_ID, 0, 10) #reactor.callLater(3, call_browse, AUDIO_ALBUM_CONTAINER_ID, 0, 10) #reactor.callLater(3, call_test, 0, 10) reactor.callWhenRunning(main) reactor.run() _______________________________________________ coherence-dev mailing list [hidden email] http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev |
||||||||||||||||
|
Jean-Michel Sizun
|
Hi,
you need to "register" your plugin in the 2 following files: coherence/setup.py coherence/coherence.egg-info/entry_points.txt any chance there are some public DAAP servers somewhere to test your plugin? Good luck, Jean-Michel Lhugsereg wrote: > Hello there, > > as I've announced in the ticket system (#240), I'm currently trying to write a > simple DAAP Backend for Coherence. It's basic functionality is implemented > (based on lolcats and ampache backends)and I'd like to do some testing. However, > I can't get it running, it simply says "Can't enable DaapStore plugin, not > found!". > > Till now, I've tried a symling in the directory where all the other backends > are place,but it didn't help. > > I have attached my code, would be nice if someone could have a look at it :) > Thanks in advance > > Flows > > ------------------------------------------------------------------------ > > _______________________________________________ > coherence-dev mailing list > [hidden email] > http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev _______________________________________________ coherence-dev mailing list [hidden email] http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev |
||||||||||||||||
|
Lhugsereg
|
It works fine now, thanks a lot :)
As far as I know, there are none, but setting one up is fairly easy. At least on Debian-based distros, it should be sufficient to install the package mt-daapd and change set the mp3_dir variable in /etc/mt-daapd.conf to the path of the directory containing your music. When I'm done (at some point in the future), where could I publish my results? Am Montag 06 Juli 2009 21:50:41 schrieb Jean-Michel Sizun: > Hi, > > you need to "register" your plugin in the 2 following files: > coherence/setup.py > coherence/coherence.egg-info/entry_points.txt > > any chance there are some public DAAP servers somewhere to test your > plugin? > > Good luck, > > Jean-Michel > > Lhugsereg wrote: > > Hello there, > > > > as I've announced in the ticket system (#240), I'm currently trying to > > write a simple DAAP Backend for Coherence. It's basic functionality is > > implemented (based on lolcats and ampache backends)and I'd like to do > > some testing. However, I can't get it running, it simply says "Can't > > enable DaapStore plugin, not found!". > > > > Till now, I've tried a symling in the directory where all the other > > backends are place,but it didn't help. > > > > I have attached my code, would be nice if someone could have a look at it > > :) Thanks in advance > > > > Flows > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > coherence-dev mailing list > > [hidden email] > > http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev > > _______________________________________________ > coherence-dev mailing list > [hidden email] > http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev coherence-dev mailing list [hidden email] http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev |
||||||||||||||||
|
Jean-Michel Sizun
|
Fantastic!
Once satisfied, you may attach the backend file to your ticket. regards, Jean-Michel 2009/7/7 Lhugsereg <[hidden email]> It works fine now, thanks a lot :) _______________________________________________ coherence-dev mailing list [hidden email] http://lists.beebits.net/cgi-bin/mailman/listinfo/coherence-dev |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |