From 3c0d53831bec497e9fed9ea1e2acfc149d1d3ca6 Mon Sep 17 00:00:00 2001 From: max-kov Date: Fri, 20 Oct 2017 12:22:42 +0100 Subject: [PATCH 1/2] [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] From 36e7cc8dbbffec961bfcc194b7deaf262577e524 Mon Sep 17 00:00:00 2001 From: max-kov Date: Fri, 20 Oct 2017 16:39:48 +0100 Subject: [PATCH 2/2] [modules/mpd] Removed unneeded if statement --- bumblebee/modules/mpd.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bumblebee/modules/mpd.py b/bumblebee/modules/mpd.py index 8a94296..f1c4d8e 100644 --- a/bumblebee/modules/mpd.py +++ b/bumblebee/modules/mpd.py @@ -86,10 +86,7 @@ class Module(bumblebee.engine.Module): self._status = "paused" if line.startswith("["): - if len(line.split(" ")) > 1: - timer = line.split(" ")[1] - else: - timer = line.split(" ")[1] + timer = line.split()[2] position = timer.split("/")[0] dur = timer.split("/")[1] duration = dur.split(" ")[0]