#TODO: Add parameter verification username = str(args.get('userName')) blob = str(args.get('blob')) clientKey = str(args.get('clientKey')) connect_app.login(username, zeroconf=(blob, clientKey)) return jsonify({ 'status': 101, 'spotifyError': 0, 'statusString': 'ERROR-OK' }) #Loop to pump events def pump_events(): lib.SpPumpEvents() spawn_later(0.1, pump_events) pump_events() #Only run if script is run directly and not by an import if __name__ == "__main__": #Can be run on any port as long as it matches the one used in avahi-publish-service http_server = WSGIServer(('', 4000), app) http_server.serve_forever() #TODO: Add signal catcher lib.SpFree()
def signal_handler(signal, frame): lib.SpConnectionLogout() lib.SpFree() sys.exit(0)