X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Fcore%2Funiq.py;h=a46d7fc7e736f79b3fb5888d8bb2e8eb890c9c4b;hb=HEAD;hp=5a74170fbda2454228490a4001f5d3b41c2242ca;hpb=751e07b3e43a4812c29f1c89f03e58023278b634;p=mpd-sima.git diff --git a/sima/plugins/core/uniq.py b/sima/plugins/core/uniq.py index 5a74170..a46d7fc 100644 --- a/sima/plugins/core/uniq.py +++ b/sima/plugins/core/uniq.py @@ -24,7 +24,7 @@ """ # standard library import -from os import getpid +from os import getpid from socket import getfqdn # third parties components @@ -41,7 +41,7 @@ class Uniq(Plugin): def __init__(self, daemon): Plugin.__init__(self, daemon) - self.chan = 'mpd_sima:{0}.{1}'.format(getfqdn(), getpid()) + self.chan = None self.channels = [] self._registred = False @@ -54,11 +54,10 @@ class Uniq(Plugin): self.sub_chan() def is_capable(self): - 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 + # Groove Basin compatibility + # For some reason Groove Basin have channels command but no + # subscribe command‽ + return {'channels', 'subscribe'}.issubset(set(self.player.commands())) def get_channels(self): return [chan for chan in self.player.channels() if @@ -71,7 +70,8 @@ class Uniq(Plugin): self.log.warning(' '.join(channels)) def sub_chan(self): - self.log.debug('Registering as {}'.format(self.chan)) + self.chan = f'mpd_sima:{getfqdn()}.{getpid()}' + self.log.debug('Registering as %s', self.chan) try: self.player.subscribe(self.chan) self._registred = True