Hi,

I made some changes in the fxd stuff the last days and now I guess
it's finished and I should explain the api:

First of all there is a file util/fxdparser.py. It is a reader and
writer for fxd files. You create the object with a file and add
callbacks for reading and writing a node based on the name. You can
alos open a file that doesn't exist, you will get an empty structure
than (usefull for writing). The class also contains some helper
functions to help parsing a xml file.

This class is used inside directory.py to read and write the
folder.fxd files and inside the skin to read the skin fxd stuff. Since
you have to set the handler for each object, the code in directory.py
will only parse <folder>, the code in skin only <skin>. 

Besides the <folder> and the <skin> stuff, we have tags that create
items, like <movie> creates a list of VideoItems out of a fxd
file. To support that, there is now a file called fxditem.py. It has
the same interface as [video|audio|image|games]/__init__.py
(cwd,update) and has it's own register function: you can register a
handler for parsing items out of an fxd to this module. Everytime a
fxd is parsed in a directory, the handlers will be called. Two
handlers are right now in Freevo: video/fxdhandler.py for the <movie>
and <disc-set> tags and a small handler for <audio> in
audio/__init__.py. Advantage: everyone can register handlers for tags
to the fxditem. E.g a plugin could create it's own tag to create it's
own items from it. The plugin only registers a handler and that's it. 

Future plans:

To test how easy the interface is, I want to add the following three
handlers (reading and creating fxd items only): 

playlist.py:
<playlist title="foo" random="0">
   <cover-img>image.jpg</cover-img>
   <file>foo.mpg</file>
   <directory recursive=1>bar</directory>
</playlist>

image/__init__.py:
<slideshow title="foo">
   <cover-img>image.jpg</cover-img>
   <background-music>
     <file|directory>use the playlist.py parser here</>
   </background-music>
   <images>
      <file duration="20">file.jpg</file>
      <more or less also a playlist.py parser>
   </images>
</slideshow>

fxditem.py
<container>
  <all registered tags>
</container>

What's the container? Only an extra item for the items in it. If you
put a some containers into a container and in this a list of audio
tags, you get the same structure web radio has (without a plugin, you
get it for free based on the new system).



Dischi

-- 
Some mistakes are too much fun to only make once.


-------------------------------------------------------
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-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to