I am unable to re-create a dbus-send command in Python. dbus-send does the expected, running:
#!/bin/bash
dbus-send \
--type=method_call \
--dest=org.mpris.MediaPlayer2.spotify \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri \
string:spotify:playlist:74sUjcvpGfdOvCHvgzNEDO
- Changes the Spotify player over to viewing the requested playlist
- Starts playing the first song in the playlist
When re-creating in Python, the oddest thing happens - it half works. It changes the Spotify player to the playlist but doesn't play the first song (and sort of breaks the player). This also happens when manually running the call from the QDbusViewer debug application.
In a minimal python example, that looks like:
#!/usr/bin/python3
import dbus
session_bus = dbus.SessionBus()
spotify = session_bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
spotify_iface = dbus.Interface(spotify, dbus_interface='org.mpris.MediaPlayer2.Player')
spotify_iface.OpenUri("string:spotify:playlist:74sUjcvpGfdOvCHvgzNEDO")
- Changes the Spotify player over to viewing the Playlist
- Audio of playing song stops, yet display still says playing
- Unable to control current song via play/pause/next buttons in player
- No exceptions are thrown, exits 0
- Other method calls like
PlayPause()seem to work as expected
This is super strange to me because I would have thought the messages sent to DBus would have been identical. Does anyone know where the discrepancy might come from?