From 6830d8e6060715c85d090a5cfdad2822e28b2ce4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman@videolan.org>
Date: Thu, 30 Aug 2007 00:15:43 +0000
Subject: [PATCH] Remembers art url when an input with same artist & album
 needs art, so if it's a local file, it doesn't need to be copied in the
 cache.

---
 src/input/input_internal.h | 1 +
 src/input/meta.c           | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index ad8259cfb1c5..6cf6fd568f05 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -215,6 +215,7 @@ typedef struct playlist_album_t
 {
     char *psz_artist;
     char *psz_album;
+    char *psz_arturl;
     vlc_bool_t b_found;
 } playlist_album_t;
 
diff --git a/src/input/meta.c b/src/input/meta.c
index 988406d4f2a6..410cf4ecff75 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -110,7 +110,7 @@ int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
 }
 
 /* Return codes:
- *   0 : Art is in cache
+ *   0 : Art is in cache or is a local file
  *   1 : Art found, need to download
  *  -X : Error/not found
  */
@@ -145,8 +145,10 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
                 free( psz_album );
                 if( album.b_found )
                 {
-                    /* Actually get URL from cache */
-                    input_FindArtInCache( p_playlist, p_item );
+                    if( !strncmp( album.psz_arturl, "file://", 7 ) )
+                        input_item_SetArtURL( p_item, album.psz_arturl );
+                    else /* Actually get URL from cache */
+                        input_FindArtInCache( p_playlist, p_item );
                     return 0;
                 }
                 else
@@ -202,6 +204,7 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
         playlist_album_t a;
         a.psz_artist = psz_artist;
         a.psz_album = psz_album;
+        a.psz_arturl = input_item_GetArtURL( p_item );
         a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE );
         ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
     }
-- 
GitLab