Changeset - 65405b3311f6
[Not reviewed]
default
0 1 0
Drew Perttula - 11 years ago 2014-06-15 07:42:51
drewp@bigasterisk.com
dead code
Ignore-this: 19fc9344a2ffe34598ccccd5738bd1a6
1 file changed with 0 insertions and 9 deletions:
0 comments (0 inline, 0 general)
light9/curvecalc/musicaccess.py
Show inline comments
 
import restkit
 
import json
 
from louie import dispatcher
 
from rdflib import URIRef
 
from light9 import networking
 
from twisted.internet import reactor
 
from twisted.web.client import Agent
 
from twisted.internet.protocol import Protocol
 
from twisted.internet.defer import Deferred     
 
from zope.interface import implements
 
from twisted.internet.defer import succeed
 
from twisted.web.iweb import IBodyProducer
 

	
 
@@ -67,20 +66,12 @@ class Music:
 
        if 'song' in data and data['song']:
 
            dispatcher.send("current_player_song", song=URIRef(data['song']))
 
        return data['t'] # pass along to the real receiver
 
    
 
    def playOrPause(self, t=None):
 
        if t is None:
 
            # could be better
 
            self.current_time().addCallback(lambda t: self.playOrPause(t))
 
        else:
 
            self.player.request("POST",
 
                                networking.musicPlayer.path("seekPlayOrPause"),
 
                                bodyProducer=StringProducer(json.dumps({"t" : t})))
 

	
 
def currentlyPlayingSong():
 
    """ask the music player what song it's on"""
 
    player = restkit.Resource(networking.musicPlayer.url)
 
    t = json.loads(player.get("time").body_string())
 
    if t['song'] is None:
 
        raise ValueError("music player is not playing any song")
 
    return URIRef(t['song'])
0 comments (0 inline, 0 general)