]> git.sesse.net Git - vlc/commitdiff
Add an "album art download policy" (--album-art) option. I now have to do another...
authorAntoine Cellerier <dionoea@videolan.org>
Sat, 23 Sep 2006 21:25:20 +0000 (21:25 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sat, 23 Sep 2006 21:25:20 +0000 (21:25 +0000)
include/vlc_meta.h
src/input/input.c
src/libvlc.h
src/playlist/engine.c

index b3df73485dde8744fa5bea684ad1ee675cae1a30..b42ea26902eacae43720a59df4f4b2f55051ddff 100644 (file)
@@ -171,4 +171,10 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, vlc_meta_t *src )
 }
     /** \todo Track meta */
 
+enum {
+    ALBUM_ART_NEVER,
+    ALBUM_ART_WHEN_ASKED,
+    ALBUM_ART_WHEN_PLAYED,
+    ALBUM_ART_ALL };
+
 #endif
index 85d6d600bf053d669b5af338576c8c585106c312..1d9896a9b16fd3acbf455fc93dab67a003d99a30 100644 (file)
@@ -362,9 +362,16 @@ int __input_SecondaryPreparse( vlc_object_t *p_parent, input_item_t *p_item )
     p_me = vlc_object_create( p_parent, VLC_OBJECT_META_ENGINE );
     p_me->i_flags |= OBJECT_FLAGS_NOINTERACT;
     p_me->i_mandatory =   VLC_META_ENGINE_TITLE
-                        | VLC_META_ENGINE_ARTIST
-                        | VLC_META_ENGINE_ART_URL;
+                        | VLC_META_ENGINE_ARTIST;
     p_me->i_optional = 0;
+    if( var_CreateGetInteger( p_parent, "album-art" ) != ALBUM_ART_NEVER )
+    {
+        p_me->i_mandatory |= VLC_META_ENGINE_ART_URL;
+    }
+    else
+    {
+        p_me->i_optional |= VLC_META_ENGINE_ART_URL;
+    }
     p_me->p_item = p_item;
     p_me->p_module = module_Need( p_me, "meta engine", 0, VLC_FALSE );
 
@@ -381,8 +388,6 @@ int __input_SecondaryPreparse( vlc_object_t *p_parent, input_item_t *p_item )
 
     vlc_object_destroy( p_me );
 
-    input_DownloadAndCacheArt( p_parent, p_item );
-
     return VLC_SUCCESS;
 }
 
index 1db518b4cdde5975e4d8332661c2c584ac7c7d5f..56f22dbc12fa680396890c3503619c223fd8354f 100644 (file)
@@ -26,6 +26,7 @@
 
 #define Nothing here, this is just to prevent update-po from being stupid
 #include "vlc_keys.h"
+#include "vlc_meta.h"
 
 #if defined (WIN32) || defined (__APPLE__)
 static char *ppsz_language[] =
@@ -933,6 +934,19 @@ static char *ppsz_clock_descriptions[] =
     "Automatically preparse files added to the playlist " \
     "(to retrieve some metadata)." )
 
+#define ALBUM_ART_TEXT N_( "Album art policy" )
+#define ALBUM_ART_LONGTEXT N_( \
+    "Choose when to download and cache album art." )
+
+static int pi_albumart_values[] = { ALBUM_ART_NEVER,
+                                    ALBUM_ART_WHEN_ASKED,
+                                    ALBUM_ART_WHEN_PLAYED,
+                                    ALBUM_ART_ALL };
+static char *ppsz_albumart_descriptions[] =
+    { N_("Never download"), N_("Download when asked"),
+      N_("Download when track starts playing"),
+      N_("Download everything ASAP") };
+
 #define SD_TEXT N_( "Services discovery modules")
 #define SD_LONGTEXT N_( \
      "Specifies the services discovery modules to load, separated by " \
@@ -1634,6 +1648,11 @@ vlc_module_begin();
     add_bool( "auto-preparse", VLC_TRUE, NULL, PREPARSE_TEXT,
               PREPARSE_LONGTEXT, VLC_FALSE );
 
+    add_integer( "album-art", ALBUM_ART_WHEN_PLAYED, NULL, ALBUM_ART_TEXT,
+                 ALBUM_ART_LONGTEXT, VLC_FALSE );
+        change_integer_list( pi_albumart_values,
+                             ppsz_albumart_descriptions, 0 );
+
     set_subcategory( SUBCAT_PLAYLIST_SD );
     add_module_list_cat( "services-discovery", SUBCAT_PLAYLIST_SD, NULL,
                           NULL, SD_TEXT, SD_LONGTEXT, VLC_FALSE );
index d710b207ad45da0b230fea3ab5e060c20830bfc1..45297b966d33ee2b64704807ad46bdc56db61b4e 100644 (file)
@@ -500,7 +500,7 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
             vlc_mutex_unlock( &p_playlist->object_lock );
         }
         vlc_mutex_lock( &p_obj->object_lock );
-        i_activity var_GetInteger( p_playlist, "activity" );
+        i_activity = var_GetInteger( p_playlist, "activity" );
         if( i_activity < 0 ) i_activity = 0;
         vlc_mutex_unlock( &p_obj->object_lock );
         msleep( (i_activity+1) * 1000 );