]> kaliko git repositories - mpd-sima.git/blobdiff - sima/core.py
Fixed blacklisting in track mode
[mpd-sima.git] / sima / core.py
index 0aaebec498ff14cc8f9615f1844f363ff283e1f4..634db4b1cc06c83e651e99f88a9c0c23fd949afa 100644 (file)
@@ -20,7 +20,6 @@
 """Core Object dealing with plugins and player client
 """
 
-import sys
 import time
 
 from collections import deque
@@ -60,6 +59,7 @@ class Sima(Daemon):
         return PlayerClient(host, port, pswd)
 
     def add_history(self):
+        """Handle local short history"""
         self.short_history.appendleft(self.player.current)
 
     def register_plugin(self, plugin_class):
@@ -73,6 +73,7 @@ class Sima(Daemon):
             getattr(plugin, method)(*args, **kwds)
 
     def need_tracks(self):
+        """Is the player in need for tracks"""
         if not self.enabled:
             self.log.debug('Queueing disabled!')
             return False
@@ -87,13 +88,13 @@ class Sima(Daemon):
     def queue(self):
         to_add = list()
         for plugin in self.plugins:
-            pl_callback =  getattr(plugin, 'callback_need_track')()
+            pl_callback = getattr(plugin, 'callback_need_track')()
             if pl_callback:
                 to_add.extend(pl_callback)
         if not to_add:
             self.log.warning('Queue plugins returned nothing!')
             for plugin in self.plugins:
-                pl_callback =  getattr(plugin, 'callback_need_track_fb')()
+                pl_callback = getattr(plugin, 'callback_need_track_fb')()
                 if pl_callback:
                     to_add.extend(pl_callback)
         for track in to_add:
@@ -145,13 +146,13 @@ class Sima(Daemon):
             except PlayerUnHandledError as err:
                 #TODO: unhandled Player exceptions
                 self.log.warning('Unhandled player exception: {}'.format(err))
-                del(self.player)
+                del self.player
                 self.player = PlayerClient()
                 time.sleep(10)
             except PlayerError as err:
                 self.log.warning('Player error: %s' % err)
                 self.reconnect_player()
-                del(self.changed)
+                del self.changed
 
     def loop(self):
         """Dispatching callbacks to plugins