X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fcore.py;h=c751e5ba2b63a6bd0cafb2f7c79dd62770bc118a;hb=204fdd2bea753b024c7253a5830325b81aebbd61;hp=9c96cb521ae0ab82b0535ab8d1ea0be91cf2b759;hpb=1cc879f39941fc302f9a841a532c9f749797cca4;p=mpd-sima.git diff --git a/sima/core.py b/sima/core.py index 9c96cb5..c751e5b 100644 --- a/sima/core.py +++ b/sima/core.py @@ -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