Update of /cvsroot/freevo/freevo/Docs/plugin_writing
In directory sc8-pr-cvs1:/tmp/cvs-serv8096/plugin_writing
Added Files:
howto.sgml
Log Message:
first (very early) version
--- NEW FILE: howto.sgml ---
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
<!ENTITY daemon SYSTEM "code/daemon.py" CDATA linespecific>
<!ENTITY daemonpoll SYSTEM "code/daemon_poll.py" CDATA linespecific>
<!ENTITY daemonaction SYSTEM "code/daemon_action.py" CDATA linespecific>
]>
<book>
<bookinfo>
<title>Freevo Plugin Writing HOWTO</title>
<subtitle>Writing your own plugins for Freevo</subtitle>
<copyright>
<year>2003</year>
<holder>Dirk Meyer</holder>
</copyright>
<legalnotice>
<para>
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be obtained at
http://www.gnu.org/licenses/fdl.html and is included as an appendix in
this document.
</para>
</legalnotice>
<author>
<firstname>Dirk</firstname>
<surname>Meyer</surname>
<authorblurb>
<para>
<email>[EMAIL PROTECTED]</email>
</para>
</authorblurb>
</author>
<abstract>
<para>
This document contains some usefull information on how to write a
plugin for Freevo. This includes some documentation about the interbal
structure of Freevo. This howto is not complete (and maybe never will
be). If you have additional questions, please contact the developer
list (<email>[EMAIL PROTECTED]</email>).
</para>
</abstract>
</bookinfo>
<toc>
</toc>
<chapter>
<title>Introduction</title>
<sect1>
<title>Introduction</title>
<para>
To make it easier to add or remove functions for Freevo, we integrated
a plugin system into Freevo. By adding a file into the Freevo system,
you can add new functions without changing anything else in the core of
Freevo. It's also possible to distribute a plugin with your application
and not within the Freevo distribution.
</para>
<para>
If you wrote a plugin, please send it to the Freevo developer
list. Maybe other people also find it usefull.
</para>
</sect1>
<sect1>
<title>Disclaimer</title>
<para>
This document is available for free, and, while I have done the best I
can to make it accurate and up to date, I take no responsibility for
any problems you may encounter resulting from the use of this
document.
</para>
</sect1>
<sect1>
<title>Contact / Feedback</title>
<para>
If you have found this HOWTO to be helpful or you have found errors in
this HOWTO please feel free to contact me at
<email>[EMAIL PROTECTED]</email> or contact the Freevo developer list at
<email>[EMAIL PROTECTED]</email>.
</para>
</sect1>
<sect1>
<title>Revision History</title>
<para>
<revhistory>
<revision>
<revnumber>v0.1</revnumber>
<date>2003-10-31</date>
<authorinitials>DM</authorinitials>
<revremark>Initial Release</revremark>
</revision>
</revhistory>
</para>
</sect1>
</chapter>
<chapter>
<title>Internal Structure</title>
<sect1>
<title>Plugin Location</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>Events</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>The Menu System</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>GUI Objects</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>i18n support</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
</chapter>
<chapter>
<title>The Different Types of Plugins</title>
<sect1>
<title>General</title>
<para>
It's possible to add or remove a plugin in the
<filename>local_conf.py</filename>. Freevo will search the plugins the
main plugin directory, the source directory and (based on the plugin
name) in the media subdirectories like video or audio.
</para>
<para>
You should place your plugin into the main plugin directory if it
doesn't depend on the media type. If it only works for e.g. video, you
should place it in the video plugin directory. By doing that, the
string <emphasis>video</emphasis> fill be part of the plugin name.
</para>
<para>
Everything inside Freevo is some sort of plugin. Without plugin, the
main menu will be empty and Freevo couldn't play a file at all. So it's
possible to change (mostly) everything in Freevo by writing a plugin.
</para>
<sect2>
<title>Documenting the Plugin</title>
<para><emphasis>not written yet</emphasis></para>
</sect2>
<sect2>
<title>Which files to Import</title>
<para><emphasis>not written yet</emphasis></para>
</sect2>
</sect1>
<sect1>
<title>Basic Plugin</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>DaemonPlugin</title>
<para>
A DaemonPlugin is somthing that works in the background of
Freevo. Examples for this kind of plugin are the idlebar, the usb
plugin, the thread watching your rom drives and the LCD plugin. A
DaemonPlugin can react on events, can be called in a specific time
intervall and can draw something to the skin.
</para>
<programlisting><inlinegraphic entityref="daemon"></inlinegraphic>
</programlisting>
<para>
The <function>shutdown</function> function will be called when Freevo
shuts down to do some cleanup. Most plugins won't need that function.
</para>
<sect2>
<title>Polling</title>
<para>
A plugin can be called in a specific time intervall. To do this, it
has to set the variable <varname>poll_intervall</varname> and define
a function <function>poll</function>. After that, the
<function>poll</function> will be called every <varname>0.01 *
poll_intervall</varname> seconds. When the menu is not active
(e.g. watching a movie or listening to music), the function won't be
called. If you want the plugin to be called even than, you can set
the variable <varname>poll_menu_only</varname> to True.
</para>
<para>
Example: a plugin that sends the Event <varname>foo</varname>
every second:
<programlisting><inlinegraphic entityref="daemonpoll"></inlinegraphic>
</programlisting>
</para>
</sect2>
<sect2>
<title>Action on events</title>
<para>
To act on specific events, the class must define the function
<function>eventhandler</function>. This function will be called
with the event if nothing before consumed this event. If you create
your own kind of event, you can be sure you get it. If the function
handles this event, it should return True, if not False.
</para>
<para>
If the plugin should see all events, the plugin should set the
variable <varname>event_listener</varname> to True. After that, the
plugin will see all events and it doesn't matter, if the function
return True or not.
</para>
<para>
Example: a plugin that reacts on the Event <varname>foo</varname>
and counts the number of the events:
<programlisting><inlinegraphic entityref="daemonaction"></inlinegraphic>
</programlisting>
</para>
</sect2>
<sect2>
<title>Drawing on the Screen</title>
<para><emphasis>not written yet</emphasis></para>
</sect2>
</sect1>
<sect1>
<title>MainMenuPlugin</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>ItemPlugin</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
<sect1>
<title>IdlebarPlugin</title>
<para><emphasis>not written yet</emphasis></para>
</sect1>
</chapter>
<chapter>
<title>Plugin Distribution</title>
<para><emphasis>not written yet</emphasis></para>
</chapter>
</book>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog