Dear Wiki user, You have subscribed to a wiki page or wiki category on "Freevo Wiki" for change notification.
The following page has been changed by 203.14.13.6: http://freevo.sourceforge.net/cgi-bin/moin.cgi/DevelopersPage ------------------------------------------------------------------------------ @@ -39,6 +39,86 @@ 1. [http://pintje.servebeer.com/fxdimdb.html Fxdimdb module Documentation] - Read this if you need to create/modify FXD files. += Freevo plugin documentation = + +== Where to start == + +Examples are good. + +{{{ +import os +import sys +import copy + +import config +import plugin + +from event import * + + +class PluginInterface(plugin.DaemonPlugin): + """ + autocolor plugin. + + This plugin allows you to run an arbitrary command before playing + a video file. I use this because I prefer to adjust brightness/contrast + in hardware before playing a video file. + + activate with plugin.activate('plugin.autocolor') + + Yes, I spelled it the American way. No, I'm not American. + + """ + def __init__(self,before='/bin/true', after='/bin/true'): + """ + init the autocolor plugin + """ + plugin.DaemonPlugin.__init__(self) + self.poll_interval = 200 + self.plugins = None + plugin.register(self, 'autocolor') + self.before = before + self.after = after + + def eventhandler(self, event, menuw=None): + """ + catch VIDEO_START/VIDEOEND and run a command, return False, maybe someone + else is watching for the event. + """ + + + if event == VIDEO_START: + _debug_('Recieved VIDEO_START event',2) + os.system(self.before) + + if event == VIDEO_END: + _debug_('Recieved VIDEO_STOP event',2) + os.system(self.after) + + return False +}}} + +Hmm, what does the above mean? Well.. + +When freevo loads, it looks for plugins in all the plugin dirs. [Not sure why different dirs exist yet.. But If you know add this in.] To interact with freevo you need to have a +{{{class PluginInterface(plugin.DaemonPlugin):}}} +The first thing freevo does is run __init__(). You will use this to set options which are needed in all your code (like all your self.variables) + +Not sure what the rest is all about. What else can I share with you? My favourite is config(). If you have a config() funtion freevo will run this next before anythign else. This is where you can a) tell your users what options they need to set and b) grab the options from local_conf.py. And example from me: +{{{def config(self): + return [( 'TV_RECORD_DIR', [], 'TV Record dir' ), + ( 'TV_REC_DEL_THRESHOLD', [], 'Threshold (in percent) to keep free at poll interval' ) ] +}}} + +In the above example, TV_RECORD_DIR is the var (returned as config.TV_RECORD_DIR) it has no default value ([]), and its description is 'TV Record dir'. + +And lastly, shutdown.. It is also called by freevo whenever you go to shut down your system normally (line ctl-c, or from within the menu): +{{{def shutdown(self):}}} + +=== Some tips to begin === + +Maybe read the above ;-) + = Contributing to Freevo = == Patches == ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ Freevo-wikilog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-wikilog
