def main(store=False, metadata=False, port=6601): win = Gtk.Window() # Connect to the test-server boot_base( verbosity=logging.DEBUG, protocol_machine='idle', host='localhost', port=port ) if store: boot_store() if metadata: boot_metadata() win.connect('destroy', Gtk.main_quit) try: yield win except: raise else: win.show_all() Gtk.main() finally: shutdown_application()
def __init__(self): Gtk.Application.__init__(self) # Bring up the core! boot_base( verbosity=logging.DEBUG, protocol_machine='idle', host='localhost', port=6601 ) boot_store()
try: import docopt except ImportError: print('-- docopt not found. Please run:') print('-- pip install docopt ') sys.exit(-1) if __name__ == '__main__': args = docopt.docopt(__doc__, version='moocat 0.1') logger = logging.getLogger('moocat') verbosity = 2 + args['--verbose'] - args['--quiet'] boot_base(verbosity=verbosity_to_loglevel(verbosity)) command = args['<command>'] if command == 'next': g.client.player_next() elif command == 'prev': g.client.player_previous() elif command == 'status': print(g.client.status) elif command == 'outputs': for output in g.client.outputs: print('#{oid}\t{name}\t{on}'.format(oid=output.oid, name=output.name, on=output.enabled)) elif command == 'view': g.client.store_initialize('/tmp') store = g.client.store store.wait_mode = True