Commit 627a9394 authored by Andre Julius's avatar Andre Julius 👀
Browse files

Remove unused imports. Index refresh does not happen at script startup anymore,

but at each / or /index request. Return queue_size on successfull enque
parent 514a3935
...@@ -2,9 +2,7 @@ import logging ...@@ -2,9 +2,7 @@ import logging
from api.player import player from api.player import player
from web import web from web import web
from api.index import reload_index
reload_index()
logging.basicConfig( logging.basicConfig(
level=logging.DEBUG, level=logging.DEBUG,
...@@ -14,4 +12,4 @@ logging.basicConfig( ...@@ -14,4 +12,4 @@ logging.basicConfig(
player.start() player.start()
web.run(debug=True, host="0.0.0.0", port=80) web.run(debug=True, host="0.0.0.0", port=80)
\ No newline at end of file
from flask import redirect, abort, request, jsonify, Response from flask import redirect, abort, request, jsonify, Response, make_response
from web import web from web import web
import api.index import api.index
import api.player import api.player
...@@ -20,6 +20,7 @@ def catch_all(path): ...@@ -20,6 +20,7 @@ def catch_all(path):
@web.route("/") @web.route("/")
@web.route("/index/") @web.route("/index/")
def index(): def index():
api.index.reload_index()
return jsonify(api.index.index) return jsonify(api.index.index)
...@@ -31,6 +32,6 @@ def play(file): ...@@ -31,6 +32,6 @@ def play(file):
logger.info(api.queue.q.qsize()) logger.info(api.queue.q.qsize())
except Full: except Full:
return abort(403) return abort(403)
return Response(200) return jsonify({"queue_size": api.queue.q.qsize()})
else: else:
return abort(404) return abort(404)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment