]> kaliko git repositories - mpd-sima.git/blobdiff - sima/plugins/core/uniq.py
Get rid of inefficient log string formatting
[mpd-sima.git] / sima / plugins / core / uniq.py
index 0f42718ed992b89f8516788ea525e275269d773c..292de6f6f38e09ac8e76c319959fb38e863ab724 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2014 Jack Kaliko <kaliko@azylum.org>
+# Copyright (c) 2014, 2020 kaliko <kaliko@azylum.org>
 #
 #  This file is part of sima
 #
@@ -30,6 +30,7 @@ from socket import getfqdn
 # third parties components
 
 # local import
+from ...mpdclient import PlayerError
 from ...lib.plugin import Plugin
 
 
@@ -70,9 +71,12 @@ class Uniq(Plugin):
             self.log.warning(' '.join(channels))
 
     def sub_chan(self):
-        self.log.debug('Registering as {}'.format(self.chan))
-        self.player.subscribe(self.chan)
-        self._registred = True
+        self.log.debug('Registering as %s', self.chan)
+        try:
+            self.player.subscribe(self.chan)
+            self._registred = True
+        except PlayerError as err:
+            self.log.error('Failed to register: %s', err)
 
     def callback_need_track(self):
         if self.is_capable():