altdesktop / playerctl

🎧 mpris media player command-line controller for vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify and others.
GNU Lesser General Public License v3.0
2.43k stars 79 forks source link

Setting volume with library doesn't emit volume changed events #313

Open jdholtz opened 1 year ago

jdholtz commented 1 year ago

The player I am using is cmus.

When setting the volume with either player.set_volume or player.props.volume = .., the volume gets changed correctly on the player, but the player volume property does not update to the new volume. Here are steps to reproduce it:

  1. Have a player (cmus) open
  2. Follow volume changes using playerctl volume --follow
  3. Use the following code to change the volume of the player using the Python library
    from gi.repository import GLib, Playerctl
    manager = Playerctl.PlayerManager()
    player = Playerctl.Player.new_from_name(manager.props.player_names[0])  # Make sure cmus is the only open player
    player.set_volume(0.8)  # Set to a different volume
  4. Notice how the volume changes correctly in cmus, but it does not change in player.props.volume nor are there updates from the --follow command executed in step 2

Edit: I also see very similar issues with the shuffle and loop_status properties (shuffle events don’t even work at all). This could be a problem with how cmus integrates with MPRIS.

jdholtz commented 1 year ago

This seems to be an issue with cmus only. It works perfectly fine with Spotify, so I will close this issue.

jdholtz commented 1 year ago

However, I wonder why playerctl detects volume updates when using playerctl volume 0.1 compared to not detecting volume updates when using player.set_volume(0.1). I’ll reopen this issue due to this inconsistency.