Files
@ 9d5867bb16c4
Branch filter:
Location: light9/bin/ascoltami2 - annotation
9d5867bb16c4
1.8 KiB
text/plain
show config, new networking settings
Ignore-this: 6eb7d5cbc556df130730e2579e1a4479
Ignore-this: 6eb7d5cbc556df130730e2579e1a4479
1156d3531327 1156d3531327 1156d3531327 1156d3531327 1156d3531327 94039df5cdd9 9ec0396c6f1f 1156d3531327 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 | #!/usr/bin/python
import web, thread, gobject, sys, optparse, logging
from rdflib import URIRef
sys.path.append(".")
from light9.ascoltami.player import Player
from light9.ascoltami.playlist import Playlist, NoSuchSong
from light9.ascoltami.webapp import makeWebApp
from light9 import networking, showconfig
class App:
def __init__(self, graph, show):
self.graph = graph
self.player = Player(onEOS=self.onEOS)
self.show = show
self.playlist = Playlist.fromShow(graph, show)
def run(self, musicPort):
# the cherrypy server would wedge when vidref pounds on it; this
# one seems to run
thread.start_new(web.httpserver.runbasic,
(makeWebApp(self).wsgifunc(),
('0.0.0.0', musicPort)))
mainloop = gobject.MainLoop()
mainloop.run()
def onEOS(self, song):
self.player.pause()
self.player.seek(0)
try:
nextSong = self.playlist.nextSong(song)
except NoSuchSong: # we're at the end of the playlist
return
self.player.setSong(nextSong, play=False)
if __name__ == "__main__":
logging.basicConfig()
log = logging.getLogger()
gobject.threads_init()
parser = optparse.OptionParser()
parser.add_option('--show',
help='show URI, like http://light9.bigasterisk.com/show/dance2008')
parser.add_option("-v", "--verbose", action="store_true",
help="logging.DEBUG")
(options, args) = parser.parse_args()
log.setLevel(logging.DEBUG if options.verbose else logging.INFO)
if not options.show:
raise ValueError("missing --show http://...")
graph = showconfig.getGraph()
app = App(graph, URIRef(options.show))
musicPort = networking.musicPort()
app.run(musicPort)
|