]> kaliko git repositories - mpd-sima.git/blob - sima/plugins/core/mpdoptions.py
be47a40f94914aff65d81814042b4f005e6c75dc
[mpd-sima.git] / sima / plugins / core / mpdoptions.py
1 # -*- coding: utf-8 -*-
2 """
3     Deal with MPD options ‑ idle and repeat mode
4 """
5
6 # standard library import
7
8 # third parties components
9
10 # local import
11 from ...lib.plugin import Plugin
12
13
14 class MpdOptions(Plugin):
15     """
16     Deal with MPD options ‑ idle and repeat mode
17     """
18
19     def __init__(self, daemon):
20         Plugin.__init__(self, daemon)
21         self.daemon = daemon
22
23     def callback_player(self):
24         """
25         Called on player changes
26         """
27         player = self.daemon.player
28         if player.status().get('single') == str(1):
29             self.log.info('MPD "single" mode activated.')
30             self.daemon.enabled = False
31         elif player.status().get('repeat') == str(1):
32             self.log.info('MPD "repeat" mode activated.')
33             self.daemon.enabled = False
34         else:
35             if self.daemon.enabled is False:
36                 self.log.debug('enabling queuing (leaving single|repeat mode)')
37                 self.daemon.enabled = True
38
39     def shutdown(self):
40         pass
41
42
43 # VIM MODLINE
44 # vim: ai ts=4 sw=4 sts=4 expandtab