]> git.sesse.net Git - vlc/commitdiff
deprecate art-album variable
authorFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 13 May 2014 15:10:21 +0000 (17:10 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 19 May 2014 10:02:41 +0000 (12:02 +0200)
include/vlc_meta.h
modules/access/cdda.c
modules/gui/qt4/components/playlist/vlc_model.cpp
modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/dialogs/firstrun.cpp
modules/gui/qt4/ui/sprefs_interface.ui
src/libvlc-module.c
src/playlist/engine.c
src/playlist/fetcher.c
src/playlist/preparser.c
src/playlist/thread.c

index bd7b3190915604b25a4ab554880806538b52ea68..c3bf801e11201513ab8133c76f134db7baffcbf6 100644 (file)
@@ -94,6 +94,7 @@ VLC_API void vlc_meta_SetStatus( vlc_meta_t *m, int status );
  */
 VLC_API const char * vlc_meta_TypeToLocalizedString( vlc_meta_type_t meta_type );
 
+/* deprecated (album-art variable) */
 enum {
     ALBUM_ART_WHEN_ASKED,
     ALBUM_ART_WHEN_PLAYED,
index e5e7d2a5b6c9b73091b51afbb4c5829eac24245d..a7bd7015632793686a49cf221aa68a65a92f1754 100644 (file)
@@ -587,7 +587,8 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
 #ifdef HAVE_LIBCDDB
 static cddb_disc_t *GetCDDBInfo( access_t *p_access, int i_titles, int *p_sectors )
 {
-    if( var_InheritInteger( p_access, "album-art" ) == ALBUM_ART_WHEN_ASKED )
+    if( var_InheritInteger( p_access, "album-art" ) != ALBUM_ART_ALL &&
+        !  var_InheritBool( p_access, "metadata-network-access" ) )
     {
         msg_Dbg( p_access, "Album art policy set to manual; no automatic fetching" );
         return NULL;
index 43f4fcc95907af7b2dbf814d85d2f6ba631229d3..354b828331ec213ba0dc35a689f341719f9320ae 100644 (file)
@@ -198,7 +198,8 @@ void VLCModel::ensureArtRequested( const QModelIndex &index )
     if ( index.isValid() && hasChildren( index ) )
     {
         int i_art_policy = var_GetInteger( THEPL, "album-art" );
-        if ( i_art_policy != ALBUM_ART_ALL ) return;
+        bool b_access = var_InheritBool( THEPL, "metadata-network-access" );
+        if ( i_art_policy != ALBUM_ART_ALL && ! b_access ) return;
         int nbnodes = rowCount( index );
         QModelIndex child;
         for( int row = 0 ; row < nbnodes ; row++ )
index 2ae81a03b061c84e67e6aa898caa7906f58dd524..321812959edd863bea7136920cfbf869ba3e12ea 100644 (file)
@@ -810,8 +810,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel,
                                  ui.fileSkin, ui.skinBrowse );
 
-            CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
-                                                      artFetcher );
+            CONFIG_BOOL( "metadata-network-access", MetadataNetworkAccessMode );
 
             /* UPDATE options */
 #ifdef UPDATE_CHECK
index d440710cd8cc76d68cb4f68aa94f2b00c240b9bc..8c733e7500ed7839470402758e902697c5ac25eb 100644 (file)
@@ -42,7 +42,7 @@ FirstRun::FirstRun( QWidget *_p, intf_thread_t *_p_intf  )
 
 void FirstRun::save()
 {
-    config_PutInt( p_intf,  "album-art", checkbox->isChecked() ? ALBUM_ART_ALL: ALBUM_ART_WHEN_ASKED );
+    config_PutInt( p_intf,  "metadata-network-access", checkbox->isChecked() );
 #ifdef UPDATE_CHECK
     config_PutInt( p_intf,  "qt-updates-notif", checkbox2->isChecked() );
 #endif
@@ -95,7 +95,7 @@ void FirstRun::buildPrivDialog()
     gLayout->addWidget( options, 1, 0, 1, 3 );
     int line = 0;
 
-    checkbox = new QCheckBox( qtr( "Automatically retrieve media info" ) );
+    checkbox = new QCheckBox( qtr( "Allow metadata network access" ) );
     checkbox->setChecked( true );
     optionsLayout->addWidget( checkbox, line++, 0 );
 
index b15136e7afda5cb288c5e67061ff517c0767b61e..7703bdccb652912bb56716db5df641ceb9fd7e0f 100644 (file)
@@ -8,7 +8,7 @@
     <x>0</x>
     <y>0</y>
     <width>686</width>
-    <height>667</height>
+    <height>663</height>
    </rect>
   </property>
   <property name="sizePolicy">
       <string>Playlist and Instances</string>
      </property>
      <layout class="QGridLayout" name="gridLayout_2">
-      <item row="4" column="0">
-       <widget class="QLabel" name="artFetchLabel">
-        <property name="minimumSize">
-         <size>
-          <width>220</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="text">
-         <string>Album art download policy:</string>
-        </property>
-        <property name="buddy">
-         <cstring>artFetcher</cstring>
-        </property>
-       </widget>
-      </item>
       <item row="0" column="0">
        <widget class="QCheckBox" name="OneInterfaceMode">
         <property name="text">
         </property>
        </widget>
       </item>
-      <item row="4" column="1">
-       <widget class="QComboBox" name="artFetcher"/>
-      </item>
       <item row="0" column="1">
        <widget class="QCheckBox" name="EnqueueOneInterfaceMode">
         <property name="text">
         </property>
        </widget>
       </item>
+      <item row="4" column="0">
+       <widget class="QCheckBox" name="MetadataNetworkAccessMode">
+        <property name="text">
+         <string>Allow metadata network access</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
   </customwidget>
  </customwidgets>
  <tabstops>
+  <tabstop>langCombo</tabstop>
   <tabstop>qt</tabstop>
   <tabstop>skins</tabstop>
   <tabstop>fsController</tabstop>
   <tabstop>embedVideo</tabstop>
-  <tabstop>resizingBox</tabstop>
   <tabstop>minimalviewBox</tabstop>
-  <tabstop>pauseMinimizedBox</tabstop>
   <tabstop>systrayBox</tabstop>
+  <tabstop>resizingBox</tabstop>
+  <tabstop>pauseMinimizedBox</tabstop>
   <tabstop>notificationCombo</tabstop>
   <tabstop>stylesCombo</tabstop>
   <tabstop>OneInterfaceMode</tabstop>
-  <tabstop>EnqueueOneInterfaceMode</tabstop>
   <tabstop>oneInstanceFromFile</tabstop>
   <tabstop>treePlaylist</tabstop>
+  <tabstop>MetadataNetworkAccessMode</tabstop>
+  <tabstop>EnqueueOneInterfaceMode</tabstop>
   <tabstop>playPauseBox</tabstop>
-  <tabstop>artFetcher</tabstop>
   <tabstop>updatesBox</tabstop>
-  <tabstop>updatesDays</tabstop>
   <tabstop>saveRecentlyPlayed</tabstop>
+  <tabstop>updatesDays</tabstop>
   <tabstop>recentlyPlayedFilters</tabstop>
   <tabstop>assoButton</tabstop>
   <tabstop>skinBrowse</tabstop>
index 0156bec31efef2f33a9e7b07b1d5623faf562925..07bd6c2e9b7d7fbd0d519eb39f48d5e54dbb29ce 100644 (file)
@@ -1113,17 +1113,7 @@ static const char *const ppsz_prefres[] = {
     "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 how album art will be downloaded." )
-
-static const int pi_albumart_values[] = { ALBUM_ART_WHEN_ASKED,
-                                          ALBUM_ART_WHEN_PLAYED,
-                                          ALBUM_ART_ALL };
-static const char *const ppsz_albumart_descriptions[] =
-    { N_("Manual download only"),
-      N_("When track starts playing"),
-      N_("As soon as track is added") };
+#define METADATA_NETWORK_TEXT N_( "Allow metadata network access" )
 
 #define SD_TEXT N_( "Services discovery modules")
 #define SD_LONGTEXT N_( \
@@ -2037,10 +2027,9 @@ vlc_module_begin ()
     add_bool( "auto-preparse", true, PREPARSE_TEXT,
               PREPARSE_LONGTEXT, false )
 
-    add_integer( "album-art", ALBUM_ART_WHEN_ASKED, ALBUM_ART_TEXT,
-                 ALBUM_ART_LONGTEXT, false )
-        change_integer_list( pi_albumart_values,
-                             ppsz_albumart_descriptions )
+    add_obsolete_integer( "album-art" )
+    add_bool( "metadata-network-access", false, METADATA_NETWORK_TEXT,
+                 METADATA_NETWORK_TEXT, false )
 
     set_subcategory( SUBCAT_PLAYLIST_SD )
     add_string( "services-discovery", "", SD_TEXT, SD_LONGTEXT, true )
index 4890d0a5f5c22f733f1943f4ee85297b037cb54f..ebb46dc2323d69c445eac67160d285ab68bbe3e3 100644 (file)
@@ -470,6 +470,7 @@ static void VariablesInit( playlist_t *p_playlist )
 
     /* */
     var_Create( p_playlist, "album-art", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Create( p_playlist, "metadata-network-access", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
 
     /* Variables to preserve video output parameters */
     var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
index 41b6cf2892862e8326c9f1f660d12cb53cdb7c2e..97c5a0f19096b5a818666f60da75684bba8fb846 100644 (file)
@@ -75,11 +75,11 @@ playlist_fetcher_t *playlist_fetcher_New( vlc_object_t *parent )
     p_fetcher->i_waiting = 0;
     p_fetcher->pp_waiting = NULL;
 
-    int i_policy = var_InheritInteger( parent, "album-art" );
-    if ( i_policy == ALBUM_ART_ALL )
-        p_fetcher->e_scope = FETCHER_SCOPE_ANY;
-    else
-        p_fetcher->e_scope = FETCHER_SCOPE_LOCAL;
+    bool b_access = var_InheritBool( parent, "metadata-network-access" );
+    if ( !b_access )
+        b_access = ( var_InheritInteger( parent, "album-art" ) == ALBUM_ART_ALL );
+
+    p_fetcher->e_scope = ( b_access ) ? FETCHER_SCOPE_ANY : FETCHER_SCOPE_LOCAL;
 
     ARRAY_INIT( p_fetcher->albums );
 
index c1b63203d5413cf3c84de481418b084db344b195..df6b64f5159343586ffd5a552376b222c772c7a2 100644 (file)
@@ -44,8 +44,6 @@ struct playlist_preparser_t
     bool            b_live;
     input_item_t  **pp_waiting;
     int             i_waiting;
-
-    int             i_art_policy;
 };
 
 static void *Thread( void * );
@@ -67,7 +65,6 @@ playlist_preparser_t *playlist_preparser_New( vlc_object_t *parent )
     vlc_mutex_init( &p_preparser->lock );
     vlc_cond_init( &p_preparser->wait );
     p_preparser->b_live = false;
-    p_preparser->i_art_policy = var_InheritInteger( parent, "album-art" );
     p_preparser->i_waiting = 0;
     p_preparser->pp_waiting = NULL;
 
index 81629d6f2414d0210e6a2f09188837e8197db0a6..b32ea28ac7b4176371a80233f38ab051db72d1c1 100644 (file)
@@ -224,33 +224,20 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
         }
     }
 
-    bool b_find_art = var_GetInteger( p_playlist, "album-art" )
-                                                      == ALBUM_ART_WHEN_PLAYED;
-    if( b_find_art )
-    {
-        char *psz_uri = input_item_GetURI( p_item->p_input );
-        if( psz_uri != NULL && (!strncmp( psz_uri, "directory:", 10 ) ||
-                                !strncmp( psz_uri, "vlc:", 4 )) )
-            b_find_art = false;
-        free( psz_uri );
-    }
-
     /* TODO store art policy in playlist private data */
-    if( b_find_art )
-    {
-        char *psz_arturl = input_item_GetArtURL( p_input );
-        char *psz_name = input_item_GetName( p_input );
-        /* p_input->p_meta should not be null after a successful CreateThread */
-        bool b_has_art = !EMPTY_STR( psz_arturl );
+    char *psz_arturl = input_item_GetArtURL( p_input );
+    char *psz_name = input_item_GetName( p_input );
+    /* p_input->p_meta should not be null after a successful CreateThread */
+    bool b_has_art = !EMPTY_STR( psz_arturl );
 
-        if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) )
-        {
-            PL_DEBUG( "requesting art for %s", psz_name );
-            libvlc_ArtRequest( p_playlist->p_libvlc, p_input );
-        }
-        free( psz_arturl );
-        free( psz_name );
+    if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) )
+    {
+        PL_DEBUG( "requesting art for %s", psz_name );
+        libvlc_ArtRequest( p_playlist->p_libvlc, p_input );
     }
+    free( psz_arturl );
+    free( psz_name );
+
     PL_UNLOCK;
     var_TriggerCallback( p_playlist, "activity" );
     PL_LOCK;