]> kaliko git repositories - mpd-sima.git/blobdiff - sima/core.py
Get through main loop in case of player reconnection
[mpd-sima.git] / sima / core.py
index 87501e83b7d8bc60a616c252229f401d3bfc571e..694928fa77815ddd017aab71c4b2c9aadd2a4b78 100644 (file)
@@ -2,11 +2,10 @@
 """Core Object dealing with plugins and player client
 """
 
-__version__ = '0.12.0.b'
+__version__ = '0.12.0pr1'
 __author__ = 'kaliko jack'
 __url__ = 'git://git.kaliko.me/sima.git'
 
-import random
 import sys
 import time
 
@@ -28,6 +27,7 @@ class Sima(Daemon):
         self.enabled = True
         self.config = conf
         self.sdb = SimaDB(db_path=conf.get('sima', 'db_file'))
+        PlayerClient.database = self.sdb
         self.log = getLogger('sima')
         self.plugins = list()
         self.player = self.__get_player()  # Player client
@@ -82,7 +82,6 @@ class Sima(Daemon):
                 pl_callback =  getattr(plugin, 'callback_need_track_fb')()
                 if pl_callback:
                     to_add.extend(pl_callback)
-        random.shuffle(to_add)
         for track in to_add:
             self.player.add(track)
 
@@ -116,7 +115,6 @@ class Sima(Daemon):
         self.log.info('The way is shut, it was made by those who are dead. '
                       'And the dead keep it…')
         self.log.info('bye...')
-        sys.exit(0)
 
     def run(self):
         """
@@ -133,6 +131,7 @@ class Sima(Daemon):
             except PlayerError as err:
                 self.log.warning('Player error: %s' % err)
                 self.reconnect_player()
+                del(self.changed)
 
     def loop(self):
         """Dispatching callbacks to plugins