Giter Club home page Giter Club logo

pulsectl-asyncio's People

Contributors

mbrea-c avatar mhthies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pulsectl-asyncio's Issues

time_t portability

For your FFI you define timeval as follows:

class timeval(c.Structure):
    _fields_ = [
        ('tv_sec', c.c_longlong),
        ('tv_usec', c.c_long),
    ]

This is, unfortunately not portable as tv_sec is of type time_t which may also be c_long (as it is in my case), and then overflowing like this later on:

  File "/usr/lib/python3.6/selectors.py", line 445, in select
    fd_event_list = self._epoll.poll(timeout, max_ev)
OverflowError: timestamp too large to convert to C _PyTime_t

because the upper bytes are undefined. Forcing c_long instead helps in my case but i suspect this is also not more portable - even though one might get away with it...

Connecting with Pulse Audio from service

Hi! I'm using the library to create an Ubuntu service that connects with Pulse Audio and automatically ducks music applications when something else is running.

When I run the script, it runs perfectly, but when I run it as a service, it fails to connect with the Pulse Audio server. Any ideas why please? This is the traceback:

Mar 08 21:52:11 nitro python[47240]: Traceback (most recent call last):
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/venv/lib/python3.8/site-packages/pulsectl_asyncio/pulsectl_async.py", line 129, in connect
Mar 08 21:52:11 nitro python[47240]:     c.pa.context_connect(self._ctx, self.server, flags, None)
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/venv/lib/python3.8/site-packages/pulsectl/_pulsectl.py", line 673, in _wrapper
Mar 08 21:52:11 nitro python[47240]:     raise self.CallError(*err)
Mar 08 21:52:11 nitro python[47240]: pulsectl._pulsectl.CallError: ('pa_context_connect', (<pulsectl._pulsectl.LP_PA_CONTEXT object at 0x7ff96e34aa40>, None, 1, None), -1, 'Connection refused [pulse errno 6]')
Mar 08 21:52:11 nitro python[47240]: The above exception was the direct cause of the following exception:
Mar 08 21:52:11 nitro python[47240]: Traceback (most recent call last):
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/main.py", line 81, in <module>
Mar 08 21:52:11 nitro python[47240]:     loop.run_until_complete(main())
Mar 08 21:52:11 nitro python[47240]:   File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
Mar 08 21:52:11 nitro python[47240]:     return future.result()
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/main.py", line 17, in main
Mar 08 21:52:11 nitro python[47240]:     async with pulsectl_asyncio.PulseAsync('volume-increaser') as pulse:
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/venv/lib/python3.8/site-packages/pulsectl_asyncio/pulsectl_async.py", line 163, in __aenter__
Mar 08 21:52:11 nitro python[47240]:     await self.connect()
Mar 08 21:52:11 nitro python[47240]:   File "/path/to/venv/lib/python3.8/site-packages/pulsectl_asyncio/pulsectl_async.py", line 136, in connect
Mar 08 21:52:11 nitro python[47240]:     raise PulseError('Failed to connect to pulseaudio server') from e
Mar 08 21:52:11 nitro python[47240]: pulsectl.pulsectl.PulseError: Failed to connect to pulseaudio server

This is my service:

[Unit]
Description=Auto-ducker
After=multi-user.target
[Service]
Type=simple
Restart=always
ExecStart=/path/to/venv/bin/python /path/to/main.py
[Install]
WantedBy=multi-user.target

I have tried:

  • Specifying the server manually. When I run pulse.server_info(), the server name shows as 'pulseaudio'. When I specify the server (async with pulsectl_asyncio.PulseAsync('volume-increaser', server='pulseaudio') as pulse:), it fails to connect.
  • Running the service with User=nicholas and Group=nicholas, my user and user group.

In both cases, the server fails to connect to the pulseaudio server.

not existing pulsectl versions in setup.cfg

guess, it should be:

[options]
packages = pulsectl_asyncio
python_requires = >=3.6
install_requires =
    pulsectl >=23.5.0,<=23.5.1
include_package_data = True

or currently:

[options]
packages = pulsectl_asyncio
python_requires = >=3.6
install_requires =
    pulsectl >=23.5.0,<=23.5.2
include_package_data = True

in setup.cfg?

else it can't be satisfied, it think...

Deprecation of module inspect on python 3.11

Python 3.11.3 on Arch Linux

File "/usr/lib/python3.11/site-packages/pulsectl_asyncio/__init__.py", line 1, in <module>
    from .pulsectl_async import PulseAsync
  File "/usr/lib/python3.11/site-packages/pulsectl_asyncio/pulsectl_async.py", line 66, in <module>
    class PulseAsync(object):
  File "/usr/lib/python3.11/site-packages/pulsectl_asyncio/pulsectl_async.py", line 311, in PulseAsync
    card_profile_set_by_index = _pulse_method_call(
                                ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pulsectl_asyncio/pulsectl_async.py", line 303, in _pulse_method_call
    func_args = list(inspect.getargspec(func or (lambda: None)))
                     ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.