Files
@ c6750f266536
Branch filter:
Location: light9/bin/ascoltami2 - annotation
c6750f266536
1.9 KiB
text/plain
howto notes
Ignore-this: 3d3336dced266822e3c748ea2c76b811
Ignore-this: 3d3336dced266822e3c748ea2c76b811
a301a0039c66 224d6cd7e1e4 cbfed4e684ef 1156d3531327 1156d3531327 1156d3531327 1156d3531327 94039df5cdd9 8d87a3528369 1156d3531327 1156d3531327 865532790e62 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 cbfed4e684ef cbfed4e684ef cbfed4e684ef cbfed4e684ef 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 8d87a3528369 8d87a3528369 94039df5cdd9 8d87a3528369 94039df5cdd9 94039df5cdd9 94039df5cdd9 8d87a3528369 94039df5cdd9 94039df5cdd9 cbfed4e684ef 1156d3531327 94039df5cdd9 94039df5cdd9 46d319974176 94039df5cdd9 94039df5cdd9 94039df5cdd9 1156d3531327 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 94039df5cdd9 46d319974176 | #!bin/python
from run_local import log
from twisted.internet import gtk2reactor, reactor
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, songUri, songLocation
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
#gtk2reactor.install(useGtk=False)
reactor.listenTCP(musicPort, makeWebApp(self))
log.info("listening on %s" % musicPort)
reactor.run()
def onEOS(self, song):
self.player.pause()
self.player.seek(0)
thisSongUri = songUri(graph, URIRef(song))
try:
nextSong = self.playlist.nextSong(thisSongUri)
except NoSuchSong: # we're at the end of the playlist
return
self.player.setSong(songLocation(graph, nextSong), play=False)
if __name__ == "__main__":
gobject.threads_init() # this is in gtk2reactor too
parser = optparse.OptionParser()
parser.add_option('--show',
help='show URI, like http://light9.bigasterisk.com/show/dance2008', default=showconfig.showUri())
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))
app.run(networking.musicPlayer.port)
|