(_request: WSGIRequest)
return JsonResponse(sinks, safe=False)
Returns a list of all sound output devices currently available.
Returns a list of all sound output devices currently available.
Returns a list of all sound output devices currently available .
def list_outputs(_request: WSGIRequest) -> JsonResponse:
    """Returns a list of all sound output devices currently available."""
    output = subprocess.check_output(
        "pactl list short sinks".split(),
        env={"PULSE_SERVER": "127.0.0.1"},
        universal_newlines=True,
    )
    tokenized_lines = [line.split() for line in output.splitlines()]

    sinks = ["fakesink", "icecast", "snapcast"]
    sinks.extend([sink[1] for sink in tokenized_lines if len(sink) >= 2])

    return JsonResponse(sinks, safe=False)
def list_outputs ( _request : WSGIRequest ) -> JsonResponse : output = subprocess . check_output ( "pactl list short sinks" . split ( ) , env = { "PULSE_SERVER" : "127.0.0.1" } , universal_newlines = True , ) tokenized_lines = [ line . split ( ) for line in output . splitlines ( ) ] sinks = [ "fakesink" , "icecast" , "snapcast" ] sinks . extend ( [ sink [ 1 ] for sink in tokenized_lines if len ( sink ) >= 2 ] ) return JsonResponse ( sinks , safe = False )