X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Fcore%2Funiq.py;h=0f42718ed992b89f8516788ea525e275269d773c;hb=ac0d934fc127484a0ed14386e4c4ecd4f915b6ca;hp=b61afa616278d2aec52ebac5d348a3b80e4666e8;hpb=5adf0b495521a6f15f208474a026c088476e5018;p=mpd-sima.git diff --git a/sima/plugins/core/uniq.py b/sima/plugins/core/uniq.py index b61afa6..0f42718 100644 --- a/sima/plugins/core/uniq.py +++ b/sima/plugins/core/uniq.py @@ -42,17 +42,21 @@ class Uniq(Plugin): Plugin.__init__(self, daemon) self.chan = 'mpd_sima:{0}.{1}'.format(getfqdn(), getpid()) self.channels = [] - self.uniq = True + self._registred = False def start(self): if not self.is_capable(): self.log.warning('MPD does not provide client to client') return self.is_uniq() - self.sub_chan() + if not self._registred: + self.sub_chan() def is_capable(self): - if 'channels' in self.player.commands(): + if {'channels', 'subscribe'}.issubset(set(self.player.commands())): + # Groove Basin compatibility + # For some reason Groove Basin have channels command but no + # subscribe command‽ return True def get_channels(self): @@ -64,11 +68,11 @@ class Uniq(Plugin): if channels: self.log.warning('Another instance is queueing on this MPD host') self.log.warning(' '.join(channels)) - self.uniq = False def sub_chan(self): self.log.debug('Registering as {}'.format(self.chan)) self.player.subscribe(self.chan) + self._registred = True def callback_need_track(self): if self.is_capable():