def do_GET_Update(self,params): #fixme revision number means the revision of playlists, so when new playlists update etc hang etc if(params["revision-number"]==str(1)): mupd = do('dmap.updateresponse', [do('dmap.status',200), do('dmap.serverrevision',40)]) self.h(mupd.encode())
def do_GET_login(self,params): if(self.storage.deviceIsKnown(params['pairing-guid'])): sID=self.storage.addSession() mlog= do('dmap.loginresponse', [ do('dmap.status',200), do('dmap.sessionid',sID) ]) self.h(mlog.encode())
def do_CTRL_INT_S(self,params): #who knows what that is? sending same as my itunes-... if(params==None): caci = do('dmap.caci', [do('dmap.status',200), do('dmap.updatetype',0), do('dmap.specifiedtotalcount',1), do('dmap.returnedcount',1), do('dmap.listing', [do('dmap.listingitem', [do('dmap.itemid',1), do('dmap.cmik',1), do('dmap.cmsp',1), do('dmap.cmsv',1), do('cass',1), do('casu',1), do('ceSG',1), ]) ]) ]) self.h(caci.encode())
def do_CTRL_INT(self,params,url,query): if(re.match("/ctrl-int/1/getproperty",url)):#okay we want to get something if(params["properties"]=="dmcp.volume"): cmgt = do('dmap.cmgt', [do('dmap.status',200), do('dmap.cmvo',self.storage.getRBVolume()) ]) self.h(cmgt.encode()) else: print url+query+" unimplemented" elif(re.match("/ctrl-int/1/getspeakers",url)): #we only have 1 speaker _ever_ so static... casp = do('dmap.casp', [do('dmap.status',200), do('dmap.dictionary', [do('dmap.caia',1), do('dmap.itemname',"Rhythmbox"), do('dmap.msma',0) ]) ]) self.h(casp.encode()) elif(re.match("/ctrl-int/1/playstatusupdate",url)): if(self.storage.isshuffleactive()): shufflestatus=1 else: shufflestatus=0 if(self.storage.isrepeatactive()): repeat=2 else: repeat=0 if(self.storage.isplaying()): if(self.storage.ispaused()): playstatus=3 else: playstatus=4 n=self.storage.getNowPlayingInformation() cmst = do('dmap.cmst', [do('dmap.status',200), do('dmap.cmsr',1), do('dmap.caps',2),#playstatus do('dmap.cash',shufflestatus), do('dmap.carp',repeat), do('dmap.cavc',1), do('dmap.caas',2), do('dmap.caar',6), do('dmap.canp',"1"), do('dmap.cann',p[0][1]), do('dmap.cana',p[0][2]), do('dmap.canl',p[0][3]), do('dmap.cang',p[0][4]), do('dmap.asai',0), do('dmap.cmmk',1), do('dmap.ceGS',1), do('dmap.cant',p[2]-p[1]), do('dmap.cast',p[1]) ]) else: cmst = do('dmap.cmst', [do('dmap.status',200), do('dmap.cmsr',1), do('dmap.caps',2),#playstatus do('dmap.cash',shufflestatus), do('dmap.carp',repeat), do('dmap.cavc',1), do('dmap.caas',2), do('caar',6) ]) self.h(cmst.encode()) elif(re.match("setproperty",url)):#okay something to set... print url+query+" unimplemented" else: print str(url)+query+"What the hack is that!?!"
def do_GET_Server_Info(self,query): print "Sending Server Info" msrv = do('dmap.serverinforesponse', [ do('dmap.status', 200), do('dmap.protocolversion', '2.0'), do('daap.protocolversion', '3.0'), do('dmap.timeoutinterval', 1800), do('dmap.itemname', "TomsRB"), do('dmap.loginrequired', 0), do('dmap.authenticationmethod', 0), do('dmap.supportsextensions', 0), do('dmap.supportsindex', 0), do('dmap.supportsbrowse', 0), do('dmap.supportsquery', 0), do('dmap.supportspersistentids', 0), do('dmap.databasescount', 1), #do('dmap.supportsautologout', 0), #do('dmap.supportsupdate', 0), #do('dmap.supportsresolve', 0), ]) self.h(msrv.encode())
def do_GET_DATABASES_S(self,params): print "Get Databases Query Processing....." avdb = do('daap.serverdatabases', [do('dmap.status',200), do('dmap.updatetype',0), do('dmap.specifiedtotalcount',1), do('dmap.returnedcount',1), do('dmap.listing', [do('dmap.listingitem', [do('dmap.itemid',1), do('dmap.persistentid',000001), do('dmap.itemname',str(self.storage.getDBName())), do('dmap.itemcount',1), do('dmap.containercount',3),#fixme, need to get containercount do('dmap.editcommandssupported',1)#?? ]) ]) ]) self.h(avdb.encode())