SafeEyes icon indicating copy to clipboard operation
SafeEyes copied to clipboard

SafeEyes gets stuck because of the mediacontrol plugin sometimes

Open di72nn opened this issue 4 years ago • 7 comments

I use playerctl to control media players, and in some situations this happen:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/safeeyes/core.py", line 261, in __fire_start_break
    self.start_break.fire(self.break_queue.get_break())
  File "/usr/lib/python3.9/site-packages/safeeyes/model.py", line 287, in fire
    if not handler(*args, **keywargs):
  File "/usr/lib/python3.9/site-packages/safeeyes/safeeyes.py", line 268, in start_break
    actions = self.plugins_manager.get_break_screen_tray_actions(break_obj)
  File "/usr/lib/python3.9/site-packages/safeeyes/plugin_manager.py", line 192, in get_break_screen_tray_actions
    action = plugin['module'].get_tray_action(break_obj)
  File "/usr/lib/python3.9/site-packages/safeeyes/plugins/mediacontrol/plugin.py", line 73, in get_tray_action
    players = __active_players()
  File "/usr/lib/python3.9/site-packages/safeeyes/plugins/mediacontrol/plugin.py", line 46, in __active_players
    status = str(interface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')).lower()
  File "/usr/lib/python3.9/site-packages/dbus/proxies.py", line 72, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python3.9/site-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
  File "/usr/lib/python3.9/site-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: com.github.altdesktop.playerctld.NoActivePlayer: No player is being controlled by playerctld

This results in the break screen not appearing and the next break time stuck in the past.

I think I also had dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.DBus.Properties” on object at path /org/mpris/MediaPlayer2 (with the same stacktrace), so it's not exclusive to playerctl.

Expected behavior

  1. I'd think the main loop should be resilient to plugin errors.
  2. The mediacontrol plugin should handle exceptional situations.

Desktop:

  • Version: 2.1.3

Thanks for working on SafeEyes!

di72nn avatar Aug 25 '21 11:08 di72nn

Hi, I am working on Safe Eyes 3 (though the development is paused for a while due to my busy schedule). I will include the fix in the new version.

slgobinath avatar Aug 25 '21 11:08 slgobinath

btw did you modify the media control plugin to work with playerctl? If so, would you mind sharing the advantages of using playerctl?

If it is universally applicable for all Linux distributions and better than the current approach, I can integrate it with the media control plugin by default.

slgobinath avatar Aug 25 '21 11:08 slgobinath

btw did you modify the media control plugin to work with playerctl?

No. I should have said that it's the issue with playerctld (which pretends to be an MPRIS-player and proxies to the last active player), not the playerctl itself.

If so, would you mind sharing the advantages of using playerctl?

I'm using commands like playerctl --player=playerctld play-pause in my shortcuts and playerctld to track the last active player (because otherwise playerctl may act on a wrong player). I haven't looked into how the media control plugin works, so I don't know whether this information is of any use.

di72nn avatar Aug 25 '21 14:08 di72nn

Got it thank you for the details. The media control plugin is using DBus API to command the system to control the current player. I will fix the issue in the next release.

slgobinath avatar Aug 26 '21 10:08 slgobinath