X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Fcore%2Fmpdoptions.py;fp=sima%2Fplugins%2Fcore%2Fmpdoptions.py;h=be47a40f94914aff65d81814042b4f005e6c75dc;hb=39becab4a5cf591b1833e875c06793d97ac78659;hp=0000000000000000000000000000000000000000;hpb=8ea8cbdbdbdbc578267ba80778c9a5673cd07675;p=mpd-sima.git diff --git a/sima/plugins/core/mpdoptions.py b/sima/plugins/core/mpdoptions.py new file mode 100644 index 0000000..be47a40 --- /dev/null +++ b/sima/plugins/core/mpdoptions.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +""" + Deal with MPD options ‑ idle and repeat mode +""" + +# standard library import + +# third parties components + +# local import +from ...lib.plugin import Plugin + + +class MpdOptions(Plugin): + """ + Deal with MPD options ‑ idle and repeat mode + """ + + def __init__(self, daemon): + Plugin.__init__(self, daemon) + self.daemon = daemon + + def callback_player(self): + """ + Called on player changes + """ + player = self.daemon.player + if player.status().get('single') == str(1): + self.log.info('MPD "single" mode activated.') + self.daemon.enabled = False + elif player.status().get('repeat') == str(1): + self.log.info('MPD "repeat" mode activated.') + self.daemon.enabled = False + else: + if self.daemon.enabled is False: + self.log.debug('enabling queuing (leaving single|repeat mode)') + self.daemon.enabled = True + + def shutdown(self): + pass + + +# VIM MODLINE +# vim: ai ts=4 sw=4 sts=4 expandtab