X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Fplugin.py;h=0d6583e921176c0a42a0956cb111a69d222c5387;hb=1c01e4a7aa37eeef825c6918fc90b154a7f4ccc7;hp=0523a75f2513e723b692dc77829d651336d77220;hpb=e0c9aed7aff3a338a023eb4dd9d2732546387ba0;p=mpd-sima.git diff --git a/sima/lib/plugin.py b/sima/lib/plugin.py index 0523a75..0d6583e 100644 --- a/sima/lib/plugin.py +++ b/sima/lib/plugin.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2013, 2014 Jack Kaliko +# Copyright (c) 2013-2015 Jack Kaliko # # This file is part of sima # @@ -21,6 +21,7 @@ Plugin object to derive from """ + class Plugin: """ First non-empty line of the docstring is used as description @@ -40,8 +41,7 @@ class Plugin: if cls.__doc__: doc = cls.__doc__.strip(' \n').splitlines()[0] return {'name': cls.__name__, - 'doc': doc, - } + 'doc': doc,} def __init__(self, daemon): self.log = daemon.log @@ -57,13 +57,21 @@ class Plugin: """Get plugin's specific configuration from global applications's config """ conf = self.__daemon.config - for sec in conf.sections(): + for sec in conf.sections(): # Discovering plugin conf if sec == self.__class__.__name__.lower(): self.plugin_conf = conf[sec] + if 'priority' not in self.plugin_conf: + self.plugin_conf['priority'] = '80' + if not self.plugin_conf: + self.plugin_conf = {'priority': '80'} #if self.plugin_conf: # self.log.debug('Got config for {0}: {1}'.format(self, # self.plugin_conf)) + @property + def priority(self): + return self.plugin_conf.get('priority') + def start(self): """ Called when the daemon().run() is called and @@ -86,24 +94,26 @@ class Plugin: def callback_playlist(self): """ Called on playlist changes - Not returning data """ pass def callback_next_song(self): - """Not returning data, + """ Could be use to scrobble, maintain an history… + Not returning data, """ pass def callback_need_track(self): - """Returns a list of Track objects to add + """ + Returns a list of Track objects to add """ pass def callback_need_track_fb(self): - """Called when callback_next_song failled to find tracks to queue + """ + Called when callback_need_track failled to find tracks to queue Returns a list of Track objects to add """ pass