From 3c0d53831bec497e9fed9ea1e2acfc149d1d3ca6 Mon Sep 17 00:00:00 2001 From: max-kov Date: Fri, 20 Oct 2017 12:22:42 +0100 Subject: [PATCH] [modules/mpd] Fixed song duration parse bug After listening to an audio stream for longer than 10 minutes "mpc -f "tag artist %artist%\ntag title %title%"" will start producing lines with slightly different separation, which caused the bar to fail. --- bumblebee/modules/mpd.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/mpd.py b/bumblebee/modules/mpd.py index 9a9f253..8a94296 100644 --- a/bumblebee/modules/mpd.py +++ b/bumblebee/modules/mpd.py @@ -86,7 +86,10 @@ class Module(bumblebee.engine.Module): self._status = "paused" if line.startswith("["): - timer = line.split(" ")[1] + if len(line.split(" ")) > 1: + timer = line.split(" ")[1] + else: + timer = line.split(" ")[1] position = timer.split("/")[0] dur = timer.split("/")[1] duration = dur.split(" ")[0]