Commit 222b887f authored by Ilkka Ollakka's avatar Ilkka Ollakka

xspf.c: add album-art as <image> and use Title in title (if available),

xspf-specs seems to agree that it's valid this way. (title tag MAY
appear once in item)
parent 1f7cabaf
...@@ -155,7 +155,7 @@ static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE ...@@ -155,7 +155,7 @@ static vlc_bool_t parse_playlist_node COMPLEX_INTERFACE
{"info", SIMPLE_CONTENT, {NULL} }, {"info", SIMPLE_CONTENT, {NULL} },
{"location", SIMPLE_CONTENT, {NULL} }, {"location", SIMPLE_CONTENT, {NULL} },
{"identifier", SIMPLE_CONTENT, {NULL} }, {"identifier", SIMPLE_CONTENT, {NULL} },
{"image", SIMPLE_CONTENT, {NULL} }, {"image", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"date", SIMPLE_CONTENT, {NULL} }, {"date", SIMPLE_CONTENT, {NULL} },
{"license", SIMPLE_CONTENT, {NULL} }, {"license", SIMPLE_CONTENT, {NULL} },
{"attribution", COMPLEX_CONTENT, {.cmplx = skip_element} }, {"attribution", COMPLEX_CONTENT, {.cmplx = skip_element} },
...@@ -386,7 +386,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE ...@@ -386,7 +386,7 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
{"creator", SIMPLE_CONTENT, {.smpl = set_item_info} }, {"creator", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"annotation", SIMPLE_CONTENT, {.smpl = set_item_info} }, {"annotation", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"info", SIMPLE_CONTENT, {NULL} }, {"info", SIMPLE_CONTENT, {NULL} },
{"image", SIMPLE_CONTENT, {NULL} }, {"image", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"album", SIMPLE_CONTENT, {.smpl = set_item_info} }, {"album", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"trackNum", SIMPLE_CONTENT, {.smpl = set_item_info} }, {"trackNum", SIMPLE_CONTENT, {.smpl = set_item_info} },
{"duration", 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 ...@@ -610,7 +610,7 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
/* handle each info element in a separate "if" clause */ /* handle each info element in a separate "if" clause */
if( !strcmp( psz_name, "title" ) ) 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" ) ) else if( !strcmp( psz_name, "creator" ) )
{ {
...@@ -634,6 +634,10 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE ...@@ -634,6 +634,10 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
{ {
input_item_SetDescription( p_input, psz_value ); input_item_SetDescription( p_input, psz_value );
} }
else if( !strcmp( psz_name, "image" ) )
{
input_item_SetArtURL( p_input, psz_value );
}
return VLC_TRUE; return VLC_TRUE;
} }
......
...@@ -150,7 +150,7 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_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)*/ /* -> 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 ) ) if( psz_name && psz_uri && strcmp( psz_uri, psz_name ) )
{ {
psz_temp = convert_xml_special_chars( 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, ...@@ -211,6 +211,13 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
} }
free( psz_temp ); 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: xspfexportitem_end:
/* -> the duration */ /* -> the duration */
i_duration = input_item_GetDuration( p_item->p_input ); i_duration = input_item_GetDuration( p_item->p_input );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment