[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.
This commit is contained in:
Yufan You 2021-12-17 18:07:45 +08:00
parent 6ce761695a
commit 973dd6117e
No known key found for this signature in database
GPG key ID: 863A0F9FA8127FA4

View file

@ -85,7 +85,9 @@ class Module(core.module.Module):
def update(self): def update(self):
try: 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: except Exception as e:
logging.exception(e) logging.exception(e)
playback_status = None playback_status = None