alexdelorenzo / cast_control

📺 Control Chromecasts from Linux and D-Bus

Home Page:https://alexdelorenzo.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When started, chromecast_mpris mutes my Chromecast sometimes

logix2 opened this issue · comments

When starting chromecast_mpris, it sometimes (most times, but not always) mutes my Chromecast. I also get this when I run it (but this is also shown when it doesn't mute my Chromecast, so it shouldn't be related, but I'll post it here anyway, in case it helps), but it doesn't prevent chromecast_mpris from working:

chromecast_mpris
/usr/lib/python3/dist-packages/gi/overrides/GLib.py:123: Warning: g_variant_builder_end: assertion 'GVSB(builder)->offset >= GVSB(builder)->min_items' failed
  return builder.end()
ERROR:pydbus.registration:Exception while handling org.freedesktop.DBus.Properties.GetAll()
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pydbus/registration.py", line 81, in call_method
    result = method(*parameters, **kwargs)
  File "/usr/lib/python3/dist-packages/pydbus/registration.py", line 110, in GetAll
    ret[local] = GLib.Variant(type, getattr(self.object, local))
  File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 190, in __new__
    v.format_string = format_string
AttributeError: 'NoneType' object has no attribute 'format_string'

I'm using Ubuntu 20.10 with GNOME 3.38.2.

[[Edit]] One more thing: when casting something, e.g. YouTube, there's no volume slider in the Mpris Indicator Button I'm using on my GNOME Shell desktop. However, when I close the Chromecast application, the volume slider appears in Mpris Indicator Button, and it allows controlling the Chromecast volume with no issues.

Hi @logix2, thanks for including logs with your bug report. Can you provide the output of the following two commands?

$ python3 --version
$ python3 -m pip show chromecast_mpris mpris_server PyGObject pydbus

Sure:

$ python3 --version

Python 3.8.6
$ python3 -m pip show chromecast_mpris mpris_server PyGObject pydbus

Name: chromecast-mpris
Version: 0.7.3
Summary: 📺 Control Chromecasts from Linux and D-Bus
Home-page: https://github.com/alexdelorenzo/chromecast_mpris
Author: Alex DeLorenzo
Author-email: None
License: AGPL-3.0
Location: /home/logix/.local/lib/python3.8/site-packages
Requires: PyChromecast, pydbus, click, PyGObject, mpris-server
Required-by: 
---
Name: mpris-server
Version: 0.2.16
Summary: Publish a MediaPlayer2 MPRIS device to D-Bus.
Home-page: https://alexdelorenzo.dev
Author: Alex DeLorenzo
Author-email: None
License: AGPL-3.0
Location: /home/logix/.local/lib/python3.8/site-packages
Requires: unidecode, pydbus, PyGObject, emoji
Required-by: chromecast-mpris
---
Name: PyGObject
Version: 3.38.0
Summary: Python bindings for GObject Introspection
Home-page: https://pygobject.readthedocs.io
Author: James Henstridge
Author-email: james@daa.com.au
License: GNU LGPL
Location: /usr/lib/python3/dist-packages
Requires: pycairo
Required-by: mpris-server, chromecast-mpris, terminator, screenkey
---
Name: pydbus
Version: 0.6.0
Summary: Pythonic DBus library
Home-page: https://github.com/LEW21/pydbus
Author: Linus Lewandowski
Author-email: linus@lew21.net
License: LGPLv2+
Location: /usr/lib/python3/dist-packages
Requires: 
Required-by: mpris-server, chromecast-mpris, key-mapper

Thanks, @logix2

As for the second bug, I've introduced an update to a chromecast_mpris dependency, mpris_server, that should address the bug that's causing this error:

AttributeError: 'NoneType' object has no attribute 'format_string'

You can install it like so:

$ python3 -m pip install mpris_server==0.2.17

Ignore the pip warning about chromecast_mpris requiring version 0.2.16 of the library.

As for the first bug that causes muting, I'm having trouble reproducing it myself. If you run:

$ python3 -m chromecast_mpris --log-level debug | tee > debug_log.txt

and leave it running until you encounter the bug again, it might be able to tell us more about what's causing it.

Desktops like Plasma or GNOME might trigger a pause or a mute command via D-Bus and MPRIS, for example when I shut my laptop's lid Plasma tells MPRIS devices to pause, which pauses my Chromecast. This bug might be related to that, as well.

There's no version 0.2.17 though:

ERROR: Could not find a version that satisfies the requirement mpris_server==0.2.17 (from versions: 0.0.2, 0.0.3, 0.1.0, 0.1.1, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.2.0, 0.2.1, 0.2.2, 0.2.4, 0.2.7, 0.2.8, 0.2.11, 0.2.12, 0.2.14, 0.2.16)
ERROR: No matching distribution found for mpris_server==0.2.17

@logix2, sorry about that, I didn't push the update to PyPI. It's there now, though.

If you're still getting AttributeError after updating mpris_server, share a link to whatever media is triggering it that way I can debug it further.