Skip to content

Commit

Permalink
Provide fallbacks for config file entries
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiber committed Feb 21, 2022
1 parent 0af1c4e commit 3692754
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions musnify-mpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
config = ConfigParser()
config.read(configFile)

host = config.get("mpd","host")
port = config.get("mpd","port")
host = config.get("mpd","host", fallback=os.environ.get("MPD_HOST", "localhost"))
port = config.get("mpd","port", fallback=os.environ.get("MPD_PORT", 6600))
if config.has_option("apiKey", "lastfm"):
apiKey = config.get("apiKey", "lastfm")
musicLibrary = os.path.expanduser(config.get("mpd","musiclibrary")) + "/"
musicLibrary = os.path.expanduser(config.get("mpd","musiclibrary", fallback='~/Music')) + "/"

debug = False

Expand Down

0 comments on commit 3692754

Please sign in to comment.