Changeset - 5db8e7698d6a
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 20 months ago 2023-05-20 00:00:06
drewp@bigasterisk.com
reformat
2 files changed with 11 insertions and 14 deletions:
0 comments (0 inline, 0 general)
light9/ascoltami/musictime_client.py
Show inline comments
 
@@ -14,16 +14,13 @@ log = logging.getLogger()
 
class MusicTime(object):
 
    """
 
    fetch times from ascoltami in a background thread; return times
 
    upon request, adjusted to be more precise with the system clock
 
    """
 

	
 
    def __init__(self,
 
                 period=.2,
 
                 onChange=lambda position: None,
 
                 pollCurvecalc='ignored'):
 
    def __init__(self, period=.2, onChange=lambda position: None, pollCurvecalc='ignored'):
 
        """period is the seconds between
 
        http time requests.
 

	
 
        We call onChange with the time in seconds and the total time
 

	
 
        The choice of period doesn't need to be tied to framerate,
 
@@ -64,14 +61,13 @@ class MusicTime(object):
 
    def pollMusicTime(self):
 

	
 
        @inlineCallbacks
 
        def cb(response):
 

	
 
            if response.code != 200:
 
                raise ValueError("%s %s", response.code,
 
                                 (yield response.content()))
 
                raise ValueError("%s %s", response.code, (yield response.content()))
 

	
 
            position = yield response.json()
 

	
 
            # this is meant to be the time when the server gave me its
 
            # report, and I don't know if that's closer to the
 
            # beginning of my request or the end of it (or some
light9/ascoltami/webapp.py
Show inline comments
 
@@ -31,20 +31,21 @@ def songUri(graph, locationUri):
 

	
 
class config(cyclone.web.RequestHandler):
 

	
 
    def get(self):
 
        self.set_header("Content-Type", "application/json")
 
        self.write(
 
            json.dumps(dict(
 
                host=socket.gethostname(),
 
                show=str(showUri()),
 
                times={
 
                    # these are just for the web display. True values are on Player.__init__
 
                    'intro': 4,
 
                    'post': 0
 
                })))
 
            json.dumps(
 
                dict(
 
                    host=socket.gethostname(),
 
                    show=str(showUri()),
 
                    times={
 
                        # these are just for the web display. True values are on Player.__init__
 
                        'intro': 4,
 
                        'post': 0
 
                    })))
 

	
 

	
 
def playerSongUri(graph, player):
 
    """or None"""
 

	
 
    playingLocation = player.getSong()
0 comments (0 inline, 0 general)