marioortizmanero / polybar-pulseaudio-control

A feature-full Polybar module to control PulseAudio
MIT License
478 stars 49 forks source link

/sbin/pulseaudio-control: line 313: [: : Expected an integer expression #48

Closed brerk closed 3 years ago

brerk commented 3 years ago

When i run the command:

$ pulseaudio-control --icons-volume " , " --icon-muted " " --sink-nicknames-from "device.description" --sink-nickname "alsa_output.pci-0000_00_1f.3.analog-stereo: Volume" listen

I get 2 errors: /sbin/pulseaudio-control: line 313: [: : Expected integer expression /sbin/pulseaudio-control: line 313: [: : Expected integer expression

The output of pactl list sinks short | cut -f2 is: alsa_output.pci-0000_00_1f.3.analog-stereo

inspecting the line 313 of the script it looks like it compares 2 different volumes

marioortizmanero commented 3 years ago

Can you show me the output of pactl list sinks? VOL_LEVEL is probably failing to be parsed

brerk commented 3 years ago

Sure, my system is in spanish, so maybe that its the source of the problem

$ pactl list sinks
Destino #0
    Estado: RUNNING
    Nombre: alsa_output.pci-0000_00_1f.3.analog-stereo
    Descripción: Audio Interno Estéreo analógico
    Controlador: module-alsa-card.c
    Especificación de muestra: s16le 2ch 44100Hz
    Mapa de canales: front-left,front-right
    Módulo propietario: 6
    Silencio: no
    Volumen: front-left: 29868 /  46% / -20.48 dB,   front-right: 29868 /  46% / -20.48 dB
            balance 0.00
    Volumen base: 65536 / 100% / 0.00 dB
    Fuente que lo monitoriza: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
    Latencia: 76799 usec, configurados 105000 usec
    Indicadores: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
    Propiedades:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC3204 Analog"
        alsa.id = "ALC3204 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0x91620000 irq 140"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1f.3"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "34c8"
        device.product.name = "Ice Lake-LP Smart Sound Technology Audio Controller"
        device.form_factor = "internal"
        device.string = "front:0"
        device.buffering.buffer_size = "352800"
        device.buffering.fragment_size = "176400"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Estéreo analógico"
        device.description = "Audio Interno Estéreo analógico"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    Puertos:
        analog-output-speaker: Speakers (type: Altavoz, priority: 10000, availability unknown)
        analog-output-headphones: Headphones (type: Auriculares, priority: 9900, availability group: Legacy 2, not available)
    Puerto Activo: analog-output-speaker
    Formatos:
        pcm
marioortizmanero commented 3 years ago

Ah yup that must be it. We do use LANG=$LANGUAGE in listen() to get events in english, but the rest of the calls don't have that. Can you try it with LANG=en_US pactl list sinks?

marioortizmanero commented 3 years ago

Or rather, try running the script with the prefix LANG=en_US and see if it works that way. I can make a PR to fix that later. Or maybe with LC_ALL=C, I don't know which one is best.

brerk commented 3 years ago

Yes, this command works as expected:

$ LANG=en_US pulseaudio-control --sink-nickname "alsa_output.pci-0000_00_1f.3.analog-stereo:  Volume"  listen

61% Volume

Thanks for the help :)

marioortizmanero commented 3 years ago

No problem! Can you try one last thing?

Try adding after the LANGUAGE=en_US line in the script a line with export LANG=en_US. That should make it work for every comand without needing to add it as a prefix, but I want to make sure before adding it to the script.

brerk commented 3 years ago

Just added the export LANG=en_US in the script, it works as expected.

marioortizmanero commented 3 years ago

Great thanks! I'll update the script then.

marioortizmanero commented 3 years ago

The new update v2.2.1 (also available on the AUR) should fix this issue.