Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SafeEyes gets stuck because of the mediacontrol plugin sometimes #459

Open
di72nn opened this issue Aug 25, 2021 · 6 comments
Open

SafeEyes gets stuck because of the mediacontrol plugin sometimes #459

di72nn opened this issue Aug 25, 2021 · 6 comments
Labels

Comments

@di72nn
Copy link
Contributor

di72nn commented Aug 25, 2021

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 di72nn added the bug label Aug 25, 2021
@slgobinath
Copy link
Owner

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
Copy link
Owner

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.

@di72nn
Copy link
Contributor Author

di72nn commented Aug 25, 2021

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.

@slgobinath
Copy link
Owner

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.

@archisman-panigrahi
Copy link
Collaborator

@di72nn Is this issue present with the latest version (2.2.2)?

@di72nn
Copy link
Contributor Author

di72nn commented Aug 12, 2024

I haven't been monitoring it closely lately, but I'll try to check.

It may be slightly related that I caught this today:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/safeeyes/utility.py", line 106, in <lambda>
    GLib.idle_add(lambda: target_function(*args, **kwargs))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/safeeyes/core.py", line 277, in __fire_start_break
    self.start_break.fire(break_obj)
  File "/usr/lib/python3.12/site-packages/safeeyes/model.py", line 293, in fire
    if not handler(*args, **keywargs):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/safeeyes/safeeyes.py", line 356, in start_break
    actions = self.plugins_manager.get_break_screen_tray_actions(break_obj)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/safeeyes/plugin_manager.py", line 209, in get_break_screen_tray_actions
    action = plugin['module'].get_tray_action(break_obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/safeeyes/plugins/mediacontrol/plugin.py", line 89, in get_tray_action
    players = __active_players()
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/safeeyes/plugins/mediacontrol/plugin.py", line 62, in __active_players
    status = player.get_cached_property('PlaybackStatus').unpack().lower()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'unpack'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants