]> git.sesse.net Git - vlc/commitdiff
utf8_stat doesn't work if 2nd arg is NULL ... too bad :(
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 23 Sep 2006 20:52:40 +0000 (20:52 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 23 Sep 2006 20:52:40 +0000 (20:52 +0000)
modules/meta_engine/dummy.c
src/input/input.c

index c31ffba1632dbfdec35854836117fec3bd693e3e..6cd97b057d5b3b00328e31acf9b9f6007d6abb77 100644 (file)
 #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;
             }
index b56c40c7145ea5565737f0f937ebb1fa26e44ec1..85d6d600bf053d669b5af338576c8c585106c312 100644 (file)
 
 #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 );