]> git.sesse.net Git - vlc/commitdiff
xspf.c: add album-art as <image> and use Title in title (if available),
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 26 Aug 2007 19:59:02 +0000 (19:59 +0000)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 26 Aug 2007 19:59:02 +0000 (19:59 +0000)
xspf-specs seems to agree that it's valid this way. (title tag MAY
appear once in item)

modules/demux/playlist/xspf.c
modules/misc/playlist/xspf.c

index c33a4197ae40a613b36131d69f45aa8a01b29113..599c7671eae658b376df804a16c6c0dd934cb038 100644 (file)
@@ -155,7 +155,7 @@ static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE
           {"info",         SIMPLE_CONTENT,  {NULL} },
           {"location",     SIMPLE_CONTENT,  {NULL} },
           {"identifier",   SIMPLE_CONTENT,  {NULL} },
-          {"image",        SIMPLE_CONTENT,  {NULL} },
+          {"image",        SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"date",         SIMPLE_CONTENT,  {NULL} },
           {"license",      SIMPLE_CONTENT,  {NULL} },
           {"attribution",  COMPLEX_CONTENT, {.cmplx = skip_element} },
@@ -386,7 +386,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
           {"creator",      SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"annotation",   SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"info",         SIMPLE_CONTENT,  {NULL} },
-          {"image",        SIMPLE_CONTENT,  {NULL} },
+          {"image",        SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"album",        SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"trackNum",     SIMPLE_CONTENT,  {.smpl = set_item_info} },
           {"duration",     SIMPLE_CONTENT,  {.smpl = set_item_info} },
@@ -610,7 +610,7 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
     /* handle each info element in a separate "if" clause */
     if( !strcmp( psz_name, "title" ) )
     {
-        p_input->psz_name = strdup( (char*)psz_value );
+        input_item_SetTitle( p_input, psz_value );
     }
     else if( !strcmp( psz_name, "creator" ) )
     {
@@ -634,6 +634,10 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
     {
         input_item_SetDescription( p_input, psz_value );
     }
+    else if( !strcmp( psz_name, "image" ) )
+    {
+        input_item_SetArtURL( p_input, psz_value );
+    }
     return VLC_TRUE;
 }
 
index 8f732e4fc29a90a89d0b7ba6db75a61f6e0a6ce3..c55ace4880fa76f11d4c40a1d2126a16433c84ca 100644 (file)
@@ -150,7 +150,7 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     }
 
     /* -> the name/title (only if different from uri)*/
-    char *psz_name = input_item_GetName( p_item->p_input );
+    char *psz_name = input_item_GetTitle( p_item->p_input );
     if( psz_name && psz_uri && strcmp( psz_uri, psz_name ) )
     {
         psz_temp = convert_xml_special_chars( psz_name );
@@ -211,6 +211,13 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     }
     free( psz_temp );
 
+    psz = input_item_GetArtURL( p_item->p_input );
+    if( !EMPTY_STR( psz ) )
+    {
+        fprintf( p_file, "\t\t\t<image>%s</image>\n", psz );
+    }
+    free( psz );
+
 xspfexportitem_end:
     /* -> the duration */
     i_duration = input_item_GetDuration( p_item->p_input );