Mercurial > code > home > repos > light9
diff bin/ascoltami2 @ 1858:7772cc48e016
reformat all python
Ignore-this: 1135b78893f8b3d31badddda7f45678f
author | drewp@bigasterisk.com |
---|---|
date | Tue, 21 May 2019 23:56:12 +0000 |
parents | c962f19c7328 |
children | f066d6e874db |
line wrap: on
line diff
--- a/bin/ascoltami2 Tue May 21 23:55:35 2019 +0000 +++ b/bin/ascoltami2 Tue May 21 23:56:12 2019 +0000 @@ -4,7 +4,7 @@ import web, thread, sys, optparse, logging from rdflib import URIRef sys.path.append(".") -sys.path.append('/usr/lib/python2.7/dist-packages') # For gi +sys.path.append('/usr/lib/python2.7/dist-packages') # For gi import gi gi.require_version('Gst', '1.0') @@ -17,7 +17,9 @@ from gi.repository import GObject, Gst, Gtk + class App(object): + def __init__(self, graph, show): self.graph = graph self.player = Player(onEOS=self.onEOS) @@ -32,21 +34,27 @@ try: nextSong = self.playlist.nextSong(thisSongUri) - except NoSuchSong: # we're at the end of the playlist + 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() Gst.init(None) 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", + 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") - parser.add_option("--twistedlog", action="store_true", + parser.add_option("--twistedlog", + action="store_true", help="twisted logging") (options, args) = parser.parse_args() @@ -54,7 +62,7 @@ if not options.show: raise ValueError("missing --show http://...") - + graph = showconfig.getGraph() app = App(graph, URIRef(options.show)) if options.twistedlog: