(request: WSGIRequest)
return JsonResponse({"message": message, "key": queue_key})
Endpoint to request music. Calls internal function.
Endpoint to request music. Calls internal function.
Endpoint to request music . Calls internal function .
def request_music(request: WSGIRequest) -> HttpResponse:
    """Endpoint to request music. Calls internal function."""
    key = request.POST.get("key")
    query = request.POST.get("query")
    playlist = request.POST.get("playlist") == "true"
    platform = request.POST.get("platform")

    if query is None or not platform:
        return HttpResponseBadRequest(
            "query, playlist and platform have to be specified."
        )
    ikey = None
    if key:
        ikey = int(key)

    successful, message, queue_key = do_request_music(
        request.session.session_key, query, ikey, playlist, platform
    )
    if not successful:
        return HttpResponseBadRequest(message)

    if storage.get("ip_checking") and not playlist:
        user_manager.try_vote(user_manager.get_client_ip(request), queue_key, 1)

    return JsonResponse({"message": message, "key": queue_key})
def request_music ( request : WSGIRequest ) -> HttpResponse : key = request . POST . get ( "key" ) query = request . POST . get ( "query" ) playlist = request . POST . get ( "playlist" ) == "true" platform = request . POST . get ( "platform" ) if query is None or not platform : return HttpResponseBadRequest ( "query, playlist and platform have to be specified." ) ikey = None if key : ikey = int ( key ) successful , message , queue_key = do_request_music ( request . session . session_key , query , ikey , playlist , platform ) if not successful : return HttpResponseBadRequest ( message ) if storage . get ( "ip_checking" ) and not playlist : user_manager . try_vote ( user_manager . get_client_ip ( request ) , queue_key , 1 ) return JsonResponse ( { "message" : message , "key" : queue_key } )