Read MPD config from standard envvars

This commit is contained in:
Midgard 2021-08-08 16:44:12 +02:00
parent e2ace274b0
commit f99830847d
Signed by: midgard
GPG key ID: 511C112F1331BBB4

11
mmmpd
View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import sys import sys
import subprocess import subprocess
import datetime import datetime
@ -11,18 +12,12 @@ NAME = "Mattermost MPD now playing status"
VERSION = "1.0.0" VERSION = "1.0.0"
### Config ######## ### Config ########
MPD_HOST = "/var/lib/mpd/socket"
MPD_PORT = None
# or to connect with TCP
#MPD_HOST = "localhost"
#MPD_PORT = "6600"
EMOJI_PAUSED = "pause_button" EMOJI_PAUSED = "pause_button"
EMOJI_PLAYING = "musical_note" EMOJI_PLAYING = "musical_note"
################### ###################
MPD_HOST = os.getenv("MPD_HOST", "localhost") # Host (for TCP) or socket path
MPD_PORT = os.getenv("MPD_PORT", "6600") # Ignored when not using TCP
LOGGER = logging.getLogger("mmmpd") LOGGER = logging.getLogger("mmmpd")