]> kaliko git repositories - mpd-sima.git/blobdiff - sima/plugins/internal/crop.py
Allow choosing internal plugins from config file
[mpd-sima.git] / sima / plugins / internal / crop.py
diff --git a/sima/plugins/internal/crop.py b/sima/plugins/internal/crop.py
new file mode 100644 (file)
index 0000000..8ea889e
--- /dev/null
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+"""Crops playlist
+"""
+
+# standart library import
+#from select import select
+
+# third parties componants
+
+# local import
+from ...lib.plugin import Plugin
+
+class Crop(Plugin):
+    """
+    Crop playlist on next track
+    kinda MPD's consume
+    """
+
+    def callback_playlist(self):
+        player = self._Plugin__daemon.player
+        target_lengh = 10
+        while player.currentsong().pos > target_lengh:
+            self.log.debug('cropping playlist')
+            player.remove()
+
+
+# VIM MODLINE
+# vim: ai ts=4 sw=4 sts=4 expandtab