#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_playlist.h>
-#include <vlc_charset.h>
+#include <vlc_art_finder.h>
+#include <vlc_fs.h>
#include <vlc_url.h>
+#include <vlc_input_item.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
*****************************************************************************/
static int FindMeta( vlc_object_t *p_this )
{
- input_item_t *p_item = (input_item_t *)p_this->p_private;
+ art_finder_t *p_finder = (art_finder_t *)p_this;
+ input_item_t *p_item = p_finder->p_item;
bool b_have_art = false;
int i;
if( !psz_dir )
return VLC_EGENERIC;
- char *psz_path = psz_dir;
- if( strncmp( psz_path, "file://", 7 ) || !decode_URI( psz_path + 7 ) )
- {
- free( psz_dir );
+ char *psz_path = make_path( psz_dir );
+ free( psz_dir );
+ if( psz_path == NULL )
return VLC_EGENERIC;
- }
-#if defined(WIN32) && !defined(UNDER_CE)
- psz_path += 8;
-#else
- psz_path += 7;
-#endif
-
- char *psz_buf = strrchr( psz_path, '/' );
+ char *psz_buf = strrchr( psz_path, DIR_SEP_CHAR );
if( psz_buf )
*++psz_buf = '\0';
else
{
if( i == -1 ) /* higher priority : configured filename */
{
- char *psz_userfile = config_GetPsz( p_this, "filename" );
+ char *psz_userfile = var_InheritString( p_this, "album-art-filename" );
if( !psz_userfile )
continue;
snprintf( psz_filename, MAX_PATH, "%s%s", psz_path, psz_userfile );
else
snprintf( psz_filename, MAX_PATH, "%s%s", psz_path, cover_files[i] );
- if( utf8_stat( psz_filename, &a ) != -1 )
+ if( vlc_stat( psz_filename, &a ) != -1 )
{
- char *psz_uri = make_URI( psz_filename );
+ char *psz_uri = make_URI( psz_filename, "file" );
if( psz_uri )
{
input_item_SetArtURL( p_item, psz_uri );
}
}
}
-
- free( psz_dir );
+ free( psz_path );
return b_have_art ? VLC_SUCCESS : VLC_EGENERIC;
}