Commit ea9654b7 authored by Antoine Cellerier's avatar Antoine Cellerier

utf8_stat doesn't work if 2nd arg is NULL ... too bad :(

parent 7810e789
......@@ -33,6 +33,11 @@
#include <vlc_meta_engine.h>
#include <charset.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -80,22 +85,21 @@ static int FindMeta( vlc_object_t *p_this )
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;
}
......
......@@ -43,6 +43,10 @@
#include "charset.h"
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
......@@ -2526,7 +2530,9 @@ vlc_bool_t input_AddSubtitles( input_thread_t *p_input, char *psz_subtitle,
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;
......@@ -2535,6 +2541,7 @@ int input_DownloadAndCacheArt( vlc_object_t *p_parent, input_item_t *p_item )
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
......@@ -2560,7 +2567,7 @@ int input_DownloadAndCacheArt( vlc_object_t *p_parent, input_item_t *p_item )
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 );
......
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