char *psz_ext = filename_sanitize( psz_type ? psz_type : "" );
char *psz_filename;
- if( asprintf( &psz_filename, "file://%s" DIR_SEP "art%s", psz_path, psz_ext ) < 0 )
+ if( asprintf( &psz_filename, "%s" DIR_SEP "art%s", psz_path, psz_ext ) < 0 )
psz_filename = NULL;
free( psz_ext );
if( !strncmp( psz_filename, "art", 3 ) )
{
char *psz_file;
- if( asprintf( &psz_file, "file://%s" DIR_SEP "%s",
+ if( asprintf( &psz_file, "%s" DIR_SEP "%s",
psz_path, psz_filename ) < 0 )
psz_file = NULL;
if( psz_file )
- input_item_SetArtURL( p_item, psz_file );
- free( psz_file );
+ {
+ char *psz_uri = make_URI( psz_file );
+ if( psz_uri )
+ {
+ input_item_SetArtURL( p_item, psz_uri );
+ free( psz_uri );
+ }
+ free( psz_file );
+ }
b_found = true;
}
if( !psz_filename )
return VLC_EGENERIC;
+ char *psz_uri = make_URI( psz_filename );
+ if( !psz_uri )
+ {
+ free( psz_filename );
+ return VLC_EGENERIC;
+ }
+
/* Check if we already dumped it */
struct stat s;
- if( !utf8_stat( psz_filename+7, &s ) )
+ if( !utf8_stat( psz_filename, &s ) )
{
- input_item_SetArtURL( p_item, psz_filename );
+ input_item_SetArtURL( p_item, psz_uri );
free( psz_filename );
+ free( psz_uri );
return VLC_SUCCESS;
}
/* Dump it otherwise */
- FILE *f = utf8_fopen( psz_filename+7, "wb" );
+ FILE *f = utf8_fopen( psz_filename, "wb" );
if( f )
{
if( fwrite( p_buffer, i_buffer, 1, f ) != 1 )
else
{
msg_Dbg( p_playlist, "album art saved to %s", psz_filename );
- input_item_SetArtURL( p_item, psz_filename );
+ input_item_SetArtURL( p_item, psz_uri );
}
fclose( f );
}
free( psz_filename );
+ free( psz_uri );
return VLC_SUCCESS;
}