Commit 63f2bdc8 authored by Andre Julius's avatar Andre Julius 👀
Browse files

Remove unnecessary imports in Improve and add further documentation in

parent 627a9394
from flask import redirect, abort, request, jsonify, Response, make_response
from flask import redirect, abort, jsonify
from web import web
import api.index
import api.player
......@@ -12,7 +12,7 @@ logger = logging.getLogger("queue")
@web.route('/', defaults={'path': ''})
def catch_all(path):
""" Catches all requests that are not handled by any other method """
""" Catch all requests that are not handled by any other method """
return redirect("/")
......@@ -20,12 +20,21 @@ def catch_all(path):
def index():
""" Return a list of all available sound files as a json array.
The list is refreshed with each request. """
return jsonify(api.index.index)
def play(file):
""" Try enqueing a song. If given file name can not be found in the index,
return 404 not found. If the queue is full drop the request and return
403 not allowed as you may not enque any further songs at this time.
If queing is successfull return the position in the queue. Play the
oldest song in the queue. """
if api.index.is_indexed(file):
api.queue.q.put(file, False)
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