|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--org.esau.ptarmigan.impl.filter.BaseFilter | +--org.esau.ptarmigan.impl.filter.PlaylistFilter | +--org.esau.ptarmigan.impl.filter.XMLPlaylistFilter | +--org.esau.ptarmigan.impl.filter.B4SFilter
B4SFilter -- transforms B4S playlist to ptarmigan playlist
Example source: <?xml version="1.0" encoding='UTF-8' standalone="yes"?> <WinampXML> <!- Generated by: Nullsoft Winamp3 version 3.0 -> <playlist num_entries="4" label="Playlist 001"> <entry Playstring="file:C:\work\java\ptarmigan\ptarmigan\test\none.mp3"> <Name>none</Name> <Length>2247</Length> </entry> <entry Playstring="file:C:\music\Jazz\Vocals\Billie Holiday\Body and Soul\01 - Body And Soul.mp3"> <Name>Billie Holiday - Body And Soul</Name> <Length>383530</Length> </entry> <entry Playstring="file:C:\music\Jazz\Vocals\Billie Holiday\Body and Soul\02 - They Can't Take That Away From Me.mp3"> <Name>Billie Holiday - They Can't Take That Away From Me</Name> <Length>252500</Length> </entry> <entry Playstring="file:C:\music\Jazz\Vocals\Billie Holiday\Body and Soul\03 - Darn That Dream.mp3"> <Name>Billie Holiday - Darn That Dream</Name> <Length>379481</Length> </entry> </playlist> </WinampXML>TODO: recursively scan all playlists found.The equivalent XSLT would appear thus:<xsl:stylesheet version="1.0" xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:pl='http://esau.org/ns/ptarmigan/playlist'> <xsl:param name='include_entries'/> <xsl:param name='file_separator'/> <xsl:template match="/WinampXML/playlist"> <pl:playlist> <pl:properties> <pl:title><xsl:value-of select='@label'/></pl:title> <pl:entry-count><xsl:value-of select='count(./entry)'/></pl:entry-count> <pl:duration-total><xsl:value-of select='sum(./entry/Length)'/></pl:duration-total> </pl:properties> <xsl:if test="$include_entries = 'true'"> <xsl:apply-templates select="entry"/> </xsl:if> </pl:playlist> </xsl:template> <xsl:template match="entry"> <pl:entry> <pl:path><xsl:value-of select='@Playstring'/></pl:path> <pl:title><xsl:value-of select='Name'/></pl:title> <pl:duration><xsl:value-of select='Length'/></pl:duration> </pl:entry> </xsl:template> </xsl:stylesheet>
Constructor Summary | |
B4SFilter()
|
Method Summary | |
void |
endElement(java.lang.String uri,
java.lang.String local_name,
java.lang.String qName)
Filter an end element event. |
boolean |
isMatch(java.lang.String sniff_chars)
is the root element of the xml file indicate it's WinampXML? Note: do B4S files have namespaces? |
void |
startElement(java.lang.String uri,
java.lang.String local_name,
java.lang.String qName,
org.xml.sax.Attributes atts)
Filter a start element event. |
Methods inherited from class org.esau.ptarmigan.impl.filter.XMLPlaylistFilter |
endDocument, startDocument |
Methods inherited from class org.esau.ptarmigan.impl.filter.PlaylistFilter |
getIncludeEntries, resetData, setBaseDir, setIncludeEntries |
Methods inherited from class org.esau.ptarmigan.impl.filter.BaseFilter |
characters, getMediaProperties, parse, setMediaProperties |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public B4SFilter() throws org.xml.sax.SAXException
Method Detail |
public boolean isMatch(java.lang.String sniff_chars)
isMatch
in class PlaylistFilter
public void startElement(java.lang.String uri, java.lang.String local_name, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in class org.xml.sax.helpers.XMLFilterImpl
public void endElement(java.lang.String uri, java.lang.String local_name, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.helpers.XMLFilterImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |