(request: WSGIRequest)
return HttpResponse(f"started scanning in {library_path}. This could take a while")
Scan the folder at the given path and add all its sound files to the database.
Scan the folder at the given path and add all its sound files to the database.
Scan the folder at the given path and add all its sound files to the database .
def scan_library(request: WSGIRequest) -> HttpResponse:
    """Scan the folder at the given path and add all its sound files to the database."""
    library_path = request.POST.get("library_path")
    if library_path is None:
        return HttpResponseBadRequest("library path was not supplied.")

    if not os.path.isdir(library_path):
        return HttpResponseBadRequest("not a directory")
    library_path = os.path.abspath(library_path)

    _set_scan_progress("0 / 0 / 0")

    _scan_library.delay(library_path)

    return HttpResponse(f"started scanning in {library_path}. This could take a while")
def scan_library ( request : WSGIRequest ) -> HttpResponse : library_path = request . POST . get ( "library_path" ) if library_path is None : return HttpResponseBadRequest ( "library path was not supplied." ) if not os . path . isdir ( library_path ) : return HttpResponseBadRequest ( "not a directory" ) library_path = os . path . abspath ( library_path ) _set_scan_progress ( "0 / 0 / 0" ) _scan_library . delay ( library_path ) return HttpResponse ( f"started scanning in {library_path}. This could take a while" )