http: Switch to HTTP method dispatcher for /api
This commit is contained in:
parent
9d2732703d
commit
5458c1271f
@ -57,6 +57,9 @@ class HttpFrontend(pykka.ThreadingActor, CoreListener):
|
||||
'tools.staticdir.index': 'index.html',
|
||||
'tools.staticdir.dir': static_dir,
|
||||
},
|
||||
'/api': {
|
||||
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
|
||||
},
|
||||
'/ws': {
|
||||
'tools.websocket.on': True,
|
||||
'tools.websocket.handler_cls': ws.WebSocketHandler,
|
||||
|
||||
@ -7,12 +7,13 @@ except ImportError as import_error:
|
||||
|
||||
|
||||
class ApiResource(object):
|
||||
exposed = True
|
||||
|
||||
def __init__(self, core):
|
||||
self.core = core
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def index(self):
|
||||
def GET(self):
|
||||
playback_state = self.core.playback.state.get()
|
||||
track = self.core.playback.current_track.get()
|
||||
if track:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user