Hi,
I’m trying to package my programs that tries to use DBus for retrieving the current song from Spotify. But when the connections is tried in the snap version I get an error from AppArmor:
AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.733" (uid=1000 pid=22081 comm="/snap/lyricfier/x22/bin/lyricfier " label="snap.lyricfier.lyricfier (complain)") interface="org.freedesktop.DBus.Properties" member="Get" error name="(unset)" requested_reply="0" destination="org.mpris.MediaPlayer2.spotify" (uid=1000 pid=16486 comm="/snap/spotify/36/usr/share/spotify/spotify " label="snap.spotify.spotify (enforce)")
AFAICT the spotify snap needs to expose a mpris slot, while your snap needs a similar plug. Once connected it should be able to use the media player interface from your confined snap.
It may well be the case that spotify does not have the right slot declared in the snap. I would suggest reaching out to spotify and asking them to add it. Seems like functionality that many folks would be interested in.
Doing some more tests. There is a problem in the snap version. I can read the song data from:
org.mpris.MediaPlayer2.Player.Metadata
But lyricfier is not notified of changes using the matching singal: "org.freedesktop.DBus.Properties", "PropertiesChanged".
This only occurs in the snap version. Is not a big problem for me because I’ve changed to use a an interval timer for getting the metadata. Not sure if I need another perm or just a bug in snapd.
That looks correct to me. Your second and third examples are trying to assert a specific combination of interface connections. All you can discern from within a snap is whether an interface is connected, not to where it is connected.
Oh ok.
If I understand there is no way to know if snap is correctly connected to spotify using snapctl . I was looking for a way to warn my users to run the correct command.
thanks.