Support MPD_NOW_PLAYABLE_CACHE setting (Redis or Memcached)

This commit is contained in:
Danielle McLean 2024-05-14 13:25:13 +10:00
parent c7773bf324
commit 55d82c72c3
Signed by: 00dani
GPG key ID: 6854781A0488421C
7 changed files with 118 additions and 36 deletions

View file

@ -11,10 +11,11 @@ async def listen() -> None:
port = int(environ.get("MPD_PORT", "6600"))
host = environ.get("MPD_HOST", "localhost")
password = environ.get("MPD_PASSWORD")
cache = environ.get("MPD_NOW_PLAYABLE_CACHE")
if password is None and "@" in host:
password, host = host.split("@", maxsplit=1)
listener = MpdStateListener()
listener = MpdStateListener(cache)
now_playing = CocoaNowPlaying(listener)
await listener.start(host=host, port=port, password=password)
await listener.loop(now_playing)