#include <vlc_meta_engine.h>
#include <charset.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+
/*****************************************************************************
* Local prototypes
*****************************************************************************/
CHECK( language, LANGUAGE )
CHECK( arturl, ART_URL )
- if( !(i_meta & VLC_META_ENGINE_ART_URL) )
+ if( !( i_meta & VLC_META_ENGINE_ART_URL )
+ && ( p_me->i_mandatory & VLC_META_ENGINE_ART_URL ) )
{
if( i_meta & VLC_META_ENGINE_COLLECTION
&& i_meta & VLC_META_ENGINE_ARTIST )
{
- FILE *p_file;
char *psz_filename;
+ struct stat a;
asprintf( &psz_filename,
"file://%s/" CONFIG_DIR "/art/%s/%s/art.jpg", /* ahem ... we can have other filetype too... */
p_me->p_libvlc->psz_homedir,
p_item->p_meta->psz_artist,
p_item->p_meta->psz_album );
- p_file = utf8_fopen( psz_filename+7, "r" );
- if( p_file )
+ if( utf8_stat( psz_filename+7, &a ) != -1 )
{
- fclose( p_file );
vlc_meta_SetArtURL( p_item->p_meta, psz_filename );
i_meta |= VLC_META_ENGINE_ART_URL;
}
#include "charset.h"
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
/*****************************************************************************
* Local prototypes
*****************************************************************************/
return VLC_TRUE;
}
-#define MAX_PATH 260
+#ifndef MAX_PATH
+# define MAX_PATH 250
+#endif
int input_DownloadAndCacheArt( vlc_object_t *p_parent, input_item_t *p_item )
{
char *psz_artist;
char *psz_filename;
int i_status = VLC_EGENERIC;
int i_ret;
+ struct stat a;
if( !p_item->p_meta
|| !p_item->p_meta->psz_arturl
msg_Dbg( p_parent, "Saving album art to %s", psz_filename );
/* Check if file exists */
- i_ret = utf8_stat( psz_filename+7, NULL );
+ i_ret = utf8_stat( psz_filename+7, &a );
if( i_ret == 0 )
{
msg_Dbg( p_parent, "Album art %s already exists", psz_filename );