From 973dd6117e273828c963697a9a56c95b132cb64f Mon Sep 17 00:00:00 2001 From: Yufan You Date: Fri, 17 Dec 2021 18:07:45 +0800 Subject: [PATCH] [contrib/playerctl]: don't log when no player is found `playerctl status` returns 1 when no player is found, which caused contrib/playerctl to log many times when there's no player. --- bumblebee_status/modules/contrib/playerctl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bumblebee_status/modules/contrib/playerctl.py b/bumblebee_status/modules/contrib/playerctl.py index e02fa84..56af426 100755 --- a/bumblebee_status/modules/contrib/playerctl.py +++ b/bumblebee_status/modules/contrib/playerctl.py @@ -85,7 +85,9 @@ class Module(core.module.Module): def update(self): try: - playback_status = str(util.cli.execute(self.__cmd + "status")).strip() + playback_status = str(util.cli.execute(self.__cmd + "status 2>&1 || true", shell = True)).strip() + if playback_status == "No players found": + playback_status = None except Exception as e: logging.exception(e) playback_status = None