]> kaliko git repositories - mpd-sima.git/blobdiff - sima/core.py
Add conf management and cli parsing
[mpd-sima.git] / sima / core.py
index 9c96cb521ae0ab82b0535ab8d1ea0be91cf2b759..c751e5ba2b63a6bd0cafb2f7c79dd62770bc118a 100644 (file)
@@ -1,5 +1,13 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
+"""Core Object dealing with plugins and player client
+"""
+
+__version__ = '0.12.0.b'
+__author__ = 'kaliko jack'
+__url__ = 'git://git.kaliko.me/sima.git'
+
+from logging import getLogger
 
 from .client import PlayerClient
 
@@ -8,9 +16,11 @@ class Sima(object):
     """
 
     def __init__(self):
+        self.log = getLogger('sima')
         self.plugins = list()
         self.player = None
         self.connect_player()
+        self.current_track = None
 
     def register_plugin(self, plugin_class):
         self.plugins.append(plugin_class(self))
@@ -20,7 +30,7 @@ class Sima(object):
             getattr(plugin, method)(*args, **kwds)
 
     def connect_player(self):
-        """Instanciate player client and connect it
+        """Instanciate player client and connect
         """
         self.player = PlayerClient()  # Player client
         self.player.connect()
@@ -34,17 +44,15 @@ class Sima(object):
     def run(self):
         """Dispatching callbacks to plugins
         """
-        print(self.player.status())
+        self.log.debug(self.player.status())
+        self.log.info(self.player.current)
         while 42:
             # hanging here untill a monitored event is raised in the player
             changed = self.player.monitor()
-            print(changed)
-            print(self.player.current)
             if 'playlist' in changed:
                 self.foreach_plugin('callback_playlist')
             if 'player' in changed:
-                pass
-
+                self.log.info(self.player.current)
 
 
 # VIM MODLINE