summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mpdrast/client.py5
-rw-r--r--mpdrast/process.py3
2 files changed, 8 insertions, 0 deletions
diff --git a/mpdrast/client.py b/mpdrast/client.py
index 974350c..a0f2fd2 100644
--- a/mpdrast/client.py
+++ b/mpdrast/client.py
@@ -88,6 +88,11 @@ class MPDrastClient(mpd.MPDClient):
return int(self.status()["playlistlength"]) == 0
+ def get_playlist_time(self):
+ pl = (process.process_song(item) for item in self.playlistinfo())
+ return sum([song["time"] for song in pl])
+
+
def _find_changing_pos(self, number, type):
pl = (process.process_song(item) for item in self.playlistinfo())
value = None
diff --git a/mpdrast/process.py b/mpdrast/process.py
index efe240d..da5d13b 100644
--- a/mpdrast/process.py
+++ b/mpdrast/process.py
@@ -29,4 +29,7 @@ def process_song(item):
if item.has_key("pos"):
item["pos"] = int(item["pos"])
+ if item.has_key("time"):
+ item["time"] = int(item["time"])
+
return item