1 # -*- coding: utf-8 -*-
5 # standard library import
6 #from select import select
8 # third parties components
11 from ...lib.plugin import Plugin
15 Crop playlist on next track
18 def __init__(self, daemon):
19 super().__init__(daemon)
21 if not self.plugin_conf:
23 target = self.plugin_conf.get('consume', None)
26 if not target.isdigit():
27 self.log.warning('Bad value for consume, '
28 'expecting an integer, not "{}"'.format(target))
30 self.target = int(target)
32 def callback_next_song(self):
35 player = self._Plugin__daemon.player
36 if player.currentsong().pos > self.target:
37 self.log.debug('cropping playlist')
38 while player.currentsong().pos > self.target:
43 # vim: ai ts=4 sw=4 sts=4 expandtab