stefano-m / lua-pulseaudio_dbus

Control PulseAudio devices using DBus

Home Page:https://stefano-m.github.io/lua-pulseaudio_dbus/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shouldn't `pulse.get_device` use `connection` instead of `address`?

doronbehar opened this issue · comments

I'm trying to make a PR which will elevate the usefulness of this lua module for manipulating pulseaudio users with multiple sinks. But I'm running into a few problems.

First of all, I think there is a problem with the usage example of pulse.get_device in the beginning and near the function as well.

Check out the following test of the lua shell commands:

> pcall(require, "luarocks.loader")
> pulse = require("pulseaudio_dbus")
> address = pulse.get_address()
> connection = pulse.get_connection(address)
> core = pulse.get_core(connection)
> sink = {}
> sink_device = {}
> sink[1] = assert(core.Sinks[1])
> sink_device[1] = pulse.get_device(address, sink[1])
/home/doron/.luarocks/share/lua/5.3/dbus_proxy/init.lua:433: bad argument #2 to 'new_sync' (Gio.DBusConnection expected, got string)                                                                               
stack traceback:
        [C]: in field 'new_sync'
        /home/doron/.luarocks/share/lua/5.3/dbus_proxy/init.lua:433: in method 'new'
        ./pulseaudio_dbus.lua:348: in function 'pulseaudio_dbus.get_device'
        stdin:1: in main chunk
        [C]: in ?
> sink_device[1] = pulse.get_device(connection, sink[1])
> sink_device[1]
table: 0x222b430
>

In addition, I noticed your busted function before_each uses connection instead of address as the argument to pulse.get_device.

What do you think?

Hi, thanks for reporting this.

This is a documentation bug, the docs are correct in the description of the functions' signatures but the examples are outdated.