#include <assert.h>
-static void xspf_export_item( playlist_item_t *, FILE *, int * );
-static void xspf_extension_item( playlist_item_t *, FILE *, int * );
int xspf_export_playlist( vlc_object_t *p_this );
-/**
- * \brief Prints the XSPF header to file, writes each item by xspf_export_item()
- * and closes the open xml elements
- * \param p_this the VLC playlist object
- * \return VLC_SUCCESS if some memory is available, otherwise VLC_ENONMEM
- */
-int xspf_export_playlist( vlc_object_t *p_this )
-{
- const playlist_export_t *p_export = (playlist_export_t *)p_this;
- int i, i_count;
- char *psz_temp;
- playlist_item_t *p_node = p_export->p_root;
-
- /* write XSPF XML header */
- fprintf( p_export->p_file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
- fprintf( p_export->p_file,
- "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" " \
- "xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">\n" );
-
- if( !p_node ) return VLC_SUCCESS;
-
- /* save name of the playlist node */
- psz_temp = convert_xml_special_chars( p_node->p_input->psz_name );
- if( *psz_temp )
- {
- fprintf( p_export->p_file, "\t<title>%s</title>\n", psz_temp );
- }
- free( psz_temp );
-
- /* export all items in a flat format */
- fprintf( p_export->p_file, "\t<trackList>\n" );
- i_count = 0;
- for( i = 0; i < p_node->i_children; i++ )
- {
- xspf_export_item( p_node->pp_children[i], p_export->p_file,
- &i_count );
- }
- fprintf( p_export->p_file, "\t</trackList>\n" );
-
- /* export the tree structure in <extension> */
- fprintf( p_export->p_file, "\t<extension application=\"" \
- "http://www.videolan.org/vlc/playlist/0\">\n" );
- i_count = 0;
- for( i = 0; i < p_node->i_children; i++ )
- {
- xspf_extension_item( p_node->pp_children[i], p_export->p_file,
- &i_count );
- }
- fprintf( p_export->p_file, "\t</extension>\n" );
-
- /* close the header elements */
- fprintf( p_export->p_file, "</playlist>\n" );
-
- return VLC_SUCCESS;
-}
-
static char *input_xml( input_item_t *p_item, char *(*func)(input_item_t *) )
{
char *tmp = func( p_item );
fprintf( p_file, "\t\t\t<annotation>%s</annotation>\n", psz );
free( psz );
+ psz = input_xml( p_input, input_item_GetURL );
+ if( psz && *psz )
+ fprintf( p_file, "\t\t\t<info>%s</info>\n", psz );
+ free( psz );
+
psz = input_xml( p_input, input_item_GetArtURL );
if( psz && *psz )
fprintf( p_file, "\t\t\t<image>%s</image>\n", psz );
/* print leaf and increase the counter */
- fprintf( p_file, "\t\t\t<vlc:item tid=\"%i\" />\n", *p_i_count );
+ fprintf( p_file, "\t\t\t<vlc:item tid=\"%i\"/>\n", *p_i_count );
( *p_i_count )++;
return;
}
+
+/**
+ * \brief Prints the XSPF header to file, writes each item by xspf_export_item()
+ * and closes the open xml elements
+ * \param p_this the VLC playlist object
+ * \return VLC_SUCCESS if some memory is available, otherwise VLC_ENONMEM
+ */
+int xspf_export_playlist( vlc_object_t *p_this )
+{
+ const playlist_export_t *p_export = (playlist_export_t *)p_this;
+ int i, i_count;
+ char *psz_temp;
+ playlist_item_t *p_node = p_export->p_root;
+
+ /* write XSPF XML header */
+ fprintf( p_export->p_file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
+ fprintf( p_export->p_file,
+ "<playlist xmlns=\"http://xspf.org/ns/0/\" " \
+ "xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\" " \
+ "version=\"1\">\n" );
+
+ if( !p_node ) return VLC_SUCCESS;
+
+ /* save name of the playlist node */
+ psz_temp = convert_xml_special_chars( p_node->p_input->psz_name );
+ if( *psz_temp )
+ {
+ fprintf( p_export->p_file, "\t<title>%s</title>\n", psz_temp );
+ }
+ free( psz_temp );
+
+ /* export all items in a flat format */
+ fprintf( p_export->p_file, "\t<trackList>\n" );
+ i_count = 0;
+ for( i = 0; i < p_node->i_children; i++ )
+ {
+ xspf_export_item( p_node->pp_children[i], p_export->p_file,
+ &i_count );
+ }
+ fprintf( p_export->p_file, "\t</trackList>\n" );
+
+ /* export the tree structure in <extension> */
+ fprintf( p_export->p_file, "\t<extension application=\"" \
+ "http://www.videolan.org/vlc/playlist/0\">\n" );
+ i_count = 0;
+ for( i = 0; i < p_node->i_children; i++ )
+ {
+ xspf_extension_item( p_node->pp_children[i], p_export->p_file,
+ &i_count );
+ }
+ fprintf( p_export->p_file, "\t</extension>\n" );
+
+ /* close the header elements */
+ fprintf( p_export->p_file, "</playlist>\n" );
+
+ return VLC_SUCCESS;
+}