snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

meta_mpd.py: missing information about additional required dependencies

Open tgurr opened this issue 2 years ago • 5 comments

Describe the bug https://github.com/badaix/snapcast/blob/master/server/etc/plug-ins/meta_mpd.py#L27 states

# Dependencies:
# - python-mpd2
# - musicbrainzngs

However both

  • https://pypi.org/project/dbus-python/
  • https://pypi.org/project/PyGObject/

are also required as can be seen when trying to run without them being installed:

Jan 05 16:32:42 host snapserver[633225]: Stream: streamname, message: Traceback (most recent call last):
Jan 05 16:32:42 host snapserver[633225]: Stream: streamname, message:   File "/usr/share/snapserver/plug-ins/meta_mpd.py", line 36, in <module>
Jan 05 16:32:42 host snapserver[633225]: Stream: streamname, message:     from dbus.mainloop.glib import DBusGMainLoop
Jan 05 16:32:42 host snapserver[633225]: Stream: streamname, message: ModuleNotFoundError: No module named 'dbus'
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message: Traceback (most recent call last):
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message:   File "/usr/share/snapserver/plug-ins/meta_mpd.py", line 56, in <module>
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message:     from gi.repository import GLib
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message: ModuleNotFoundError: No module named 'gi'
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message: During handling of the above exception, another exception occurred:
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message: Traceback (most recent call last):
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message:   File "/usr/share/snapserver/plug-ins/meta_mpd.py", line 59, in <module>
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message:     import glib as GLib
Jan 05 16:53:30 host snapserver[646317]: Stream: streamname, message: ModuleNotFoundError: No module named 'glib'

Environment details

  • OS: Exherbo Linux
  • Snapcast version: 0.26.0
  • Source-based distribution package

tgurr avatar Jan 05 '22 15:01 tgurr

It would also be a good idea to mention somewhere that these dependencies have to be installed at all to use the included script ^^
Took me a while to debug this :)

Chaphasilor avatar Jan 07 '22 12:01 Chaphasilor

@tgurr how did you install these other dependencies? I'm getting all kinds of errors installing pip3 install dbus-python PyGObject; there seems to be a heap of third-party dependencies required to get this script operating.

I assume you've managed to get your control script operating though?

jaedb avatar Feb 16 '22 07:02 jaedb

@tgurr how did you install these other dependencies? I'm getting all kinds of errors installing pip3 install dbus-python PyGObject; there seems to be a heap of third-party dependencies required to get this script operating.

I assume you've managed to get your control script operating though?

Installing dbus-python musicbrainzngs pygobject:3 python-mpd2 worked for me, though on the system are already other Python packages installed for running e.g. Mopidy. But after installing these the script didn't throw out any errors on startup anymore. However after adding the controlscript to my Mopidy stream like:

-stream = tcp://127.0.0.1?name=Mopidy&port=4953
+stream = tcp://127.0.0.1?name=Mopidy&port=4953&controlscript=meta_mpd.py

My meta stream (or just the Notifications - I don't quire remember anymore) didn't play at all anymore (and even if it was I'm not sure if the controlscript metadata is transfered over to the meta stream which is the one I've selected in Iris) so I wasn't able to do further testing, my whole stream config looks like this

stream = tcp://127.0.0.1?name=Mopidy&port=4953
stream = alsa://?name=Notification&sampleformat=48000:16:2&device=hw:0,1,0&volume=100
stream = spotify:///librespot?name=Librespot&devicename=Multiroom&bitrate=320&volume=100&cache=/var/lib/snapserver
stream = meta:///Notification/Librespot/Mopidy?name=Meta&control_url=http://192.168.0.10:6680

and Notification is priorised over everything else since Notification is my doorbell which should play even if listening to music otherwise but after adding the controlscript it stayed silent. I'm not sure if I was hit by https://github.com/badaix/snapcast/issues/966 (which doesn't mention the controlscript) which got fixed with b4a41e0fd7b1478411a0eea1a5ebca4982343b49 or if it's an entirely different issue. I didn't come around having a closer look and opening another bug report.

tgurr avatar Feb 16 '22 09:02 tgurr

Cool thanks for that extra info. I am creating a new Docker image for Snapserver (to work nicely with Iris) so need to get the minimal necessary dependencies.

As an aside to the meta issue, it seems that Snapserver 0.26 removes the AddMeta method that Iris uses to push metadata to the Snapcast stream, and make available to peer Iris instances. So if you're running 0.26 you won't see metadata anymore.

Once I have the Docker image for Snapserver I'll release an update to Iris to resolve this.

jaedb avatar Feb 19 '22 07:02 jaedb

@tgurr thanks for reporting this. I couldn't spent much time the last few month into Snapcast. @jaedb I'm sorry to hear that I broke the Iris integration, but I guess this will happen when changing the public interface :( This AddMeta came in with a pull request and could be called by any control instance, while this is actually a per stream related information, so that only the stream should be able to change the meta information. I've also seen your issue #997, and don't really have a clue what is causing this. As mentioned in the script, it's based on mpDris. For me it's working fine for months using mpd. Maybe a simple try except block will fix this. If you need the AddMeta functionality, you could create a stream meta script, that opens a websocket and listens for AddMeta like commands.

badaix avatar Jun 24 '22 08:06 badaix

Fixed in snapcast v0.27.0

badaix avatar Feb 05 '23 12:02 badaix