On Wed, 2010-08-11 at 20:28 +0100, John Molohan wrote:
> With the patch it seems to work perfectly for me.
Only because with your patch, two wrongs make a right. :)
Namely:
> file = video.add_child('url mplayer-options="%s"' %mplayeropts,
> trailer.preview.large)
> # video.add_child('mplayer_options', mplayeropts)
The commented out line seems to suggest you realized that
'mplayer-options' was something different than 'url' (and indeed it is).
What you actually ended up doing was creating a child node with the node
name 'url mplayer-options="..."'. kaa.xmlutils behaved correctly by
including the mplayer-options stuff in the closing tag.
The problem is generally that kaa.xmlutils doesn't provide a way to add
attributes to an existing node. It's why I said in my earlier email:
On Wed, 2010-08-11 at 14:12 -0400, Jason Tackaberry wrote:
> (I've not actually looked this xmlutils API before. I'm tempted to
> deprecate __getattr__ in favor of __getitem__ and implement
> __setitem__.)
I'll implement this tonight.
Meanwhile, you can initialize nodes with new attributes by passing
keyword arguments to add_child. However, keyword arguments can't
contain dashes, and add_child() does no translation.
So try this kludge:
video.add_child('url', trailer.preview.large, **{'mplayer-options':
mplayeropts})
Once I make the changes, it will be a bit more sane:
url = video.add_child('url', trailer.preview.large)
url['mplayer-options'] = mplayeropts
Or possibly I could keep __getattr__ and implement __setattr__,
converting '_' to '-' so that there's symmetry with __getattr__, which
would keep the same API as now but prevents ever being able to handle
attributes that actually, truly use underscores (e.g. mplayer_options
instead of mplayer-options).
What do you think dischi?
Cheers,
Jason.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel