Lazy log string instead of f-strings
This commit is contained in:
parent
bc49857220
commit
9827cdfd90
1 changed files with 4 additions and 2 deletions
6
mmmpd
6
mmmpd
|
@ -9,6 +9,8 @@ import time
|
||||||
import logging
|
import logging
|
||||||
import mpd
|
import mpd
|
||||||
|
|
||||||
|
# pylint: disable=no-member
|
||||||
|
|
||||||
NAME = "Mattermost MPD now playing status"
|
NAME = "Mattermost MPD now playing status"
|
||||||
VERSION = "1.0.1"
|
VERSION = "1.0.1"
|
||||||
|
|
||||||
|
@ -30,7 +32,7 @@ MPD_STATE_PAUSE = "pause"
|
||||||
# ----------------
|
# ----------------
|
||||||
|
|
||||||
def set_status(emoji, text, expires_datetime):
|
def set_status(emoji, text, expires_datetime):
|
||||||
LOGGER.info(f"Custom status expiring {expires_datetime or 'never'}: :{emoji}: {text}")
|
LOGGER.info("Custom status expiring %s: :%s: %s", expires_datetime or "never", emoji, text)
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"mmcli", "customstatus",
|
"mmcli", "customstatus",
|
||||||
"--until", expires_datetime.isoformat() if expires_datetime else "",
|
"--until", expires_datetime.isoformat() if expires_datetime else "",
|
||||||
|
@ -56,7 +58,7 @@ def song_string(song_info):
|
||||||
def formatted_status(mpd_client):
|
def formatted_status(mpd_client):
|
||||||
status = mpd_client.status()
|
status = mpd_client.status()
|
||||||
state = status.get("state")
|
state = status.get("state")
|
||||||
LOGGER.debug(f"Player state: {state!r}")
|
LOGGER.debug("Player state: %r", state)
|
||||||
if state not in (MPD_STATE_PLAY, MPD_STATE_PAUSE):
|
if state not in (MPD_STATE_PLAY, MPD_STATE_PAUSE):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue