Mercurial > hg > mood-conductor
comparison mcserver/mcserver.py @ 54:c0b34039917a tip
Server: added an exposed function to log the start time of a performance (for log-to-audio sync)
author | Mathieu Barthet <mathieu.barthet@eecs.qmul.ac.uk> |
---|---|
date | Wed, 14 Oct 2015 19:20:08 +0100 |
parents | fe04ff3547c7 |
children |
comparison
equal
deleted
inserted
replaced
50:9e3579db2906 | 54:c0b34039917a |
---|---|
2 # encoding: utf-8 | 2 # encoding: utf-8 |
3 """ | 3 """ |
4 mcserver.py | 4 mcserver.py |
5 | 5 |
6 Created by George Fazekas on 2012-06-16. | 6 Created by George Fazekas on 2012-06-16. |
7 Modifications by Mathieu Barthet. | |
7 Copyright (c) 2012 . All rights reserved. | 8 Copyright (c) 2012 . All rights reserved. |
8 """ | 9 """ |
9 | 10 |
10 import os,sys,optparse,signal,time,math | 11 import os,sys,optparse,signal,time,math |
11 import cherrypy as cp | 12 import cherrypy as cp |
106 def getconf(self): | 107 def getconf(self): |
107 self.config_list = ['age','dist','ninp'] | 108 self.config_list = ['age','dist','ninp'] |
108 cp.log.error(str(map(lambda x: (x,"%.3f" % self.__dict__[x]),self.config_list))) | 109 cp.log.error(str(map(lambda x: (x,"%.3f" % self.__dict__[x]),self.config_list))) |
109 return str(map(lambda x: (x,"%.3f" % self.__dict__[x]),self.config_list)) #+ " Sessions: " + str(cp.tools.sessions) | 110 return str(map(lambda x: (x,"%.3f" % self.__dict__[x]),self.config_list)) #+ " Sessions: " + str(cp.tools.sessions) |
110 | 111 |
111 | 112 @cp.expose |
113 def start(self): | |
114 timelog = "Performance start time: %s"%time.time() | |
115 print "Start function accessed." | |
116 cp.log.error(timelog) | |
117 return timelog | |
112 | 118 |
113 | 119 |
114 def getProcessPids(port,kill=False): | 120 def getProcessPids(port,kill=False): |
115 '''Get the pid of the offending Python process given a port after an unsuccessful restart.''' | 121 '''Get the pid of the offending Python process given a port after an unsuccessful restart.''' |
116 print "Running lsof -i :"+str(port)," ...\n\n" | 122 print "Running lsof -i :"+str(port)," ...\n\n" |