X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Finternal%2Fcrop.py;h=8f70acd7caf42d703bf75b6feeb339404dd37757;hb=ee218f16c2a449c6d72d550807114676e1e96d94;hp=af6b3175d5203829568e44d27bf309a87a7938fc;hpb=75611a590e62f82a6f2651ac176ff619052eaa89;p=mpd-sima.git diff --git a/sima/plugins/internal/crop.py b/sima/plugins/internal/crop.py index af6b317..8f70acd 100644 --- a/sima/plugins/internal/crop.py +++ b/sima/plugins/internal/crop.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2013, 2014, 2015 Jack Kaliko +# Copyright (c) 2013-2015, 2020 kaliko # # This file is part of sima # @@ -21,17 +21,16 @@ """ # standard library import -#from select import select # third parties components # local import from ...lib.plugin import Plugin + class Crop(Plugin): """ Crop playlist on next track - kinda MPD's consume """ def __init__(self, daemon): super().__init__(daemon) @@ -51,19 +50,19 @@ class Crop(Plugin): 'expecting an integer, not "%s"', target) else: self.target = int(target) - self.log.debug('Cropping at 15') + self.log.debug('Cropping at %s', self.target) def callback_next_song(self): if not self.target: return if not self.daemon.enabled: self.log.debug('Queueing disabled, not cropping') - return False + return player = self.daemon.player if player.currentsong().pos > self.target: self.log.debug('cropping playlist') while player.currentsong().pos > self.target: - player.remove() + player.delete(0) # VIM MODLINE