[vlc-devel] [PATCH 4/4] deprecate art-album variable
Francois Cartegnie
fcvlcdev at free.fr
Tue May 13 17:12:38 CEST 2014
---
include/vlc_meta.h | 1 +
modules/access/cdda.c | 3 +-
modules/gui/qt4/components/playlist/vlc_model.cpp | 3 +-
modules/gui/qt4/components/simple_preferences.cpp | 3 +-
modules/gui/qt4/dialogs/firstrun.cpp | 4 +--
modules/gui/qt4/ui/sprefs_interface.ui | 39 ++++++++---------------
src/libvlc-module.c | 19 +++--------
src/playlist/engine.c | 1 +
src/playlist/fetcher.c | 10 +++---
src/playlist/preparser.c | 3 --
src/playlist/thread.c | 35 +++++++-------------
11 files changed, 43 insertions(+), 78 deletions(-)
diff --git a/include/vlc_meta.h b/include/vlc_meta.h
index bd7b319..c3bf801 100644
--- a/include/vlc_meta.h
+++ b/include/vlc_meta.h
@@ -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,
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index e5e7d2a..a7bd701 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -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;
diff --git a/modules/gui/qt4/components/playlist/vlc_model.cpp b/modules/gui/qt4/components/playlist/vlc_model.cpp
index 43f4fcc..354b828 100644
--- a/modules/gui/qt4/components/playlist/vlc_model.cpp
+++ b/modules/gui/qt4/components/playlist/vlc_model.cpp
@@ -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++ )
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index 2ae81a0..3218129 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -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
diff --git a/modules/gui/qt4/dialogs/firstrun.cpp b/modules/gui/qt4/dialogs/firstrun.cpp
index d440710..8c733e7 100644
--- a/modules/gui/qt4/dialogs/firstrun.cpp
+++ b/modules/gui/qt4/dialogs/firstrun.cpp
@@ -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 );
diff --git a/modules/gui/qt4/ui/sprefs_interface.ui b/modules/gui/qt4/ui/sprefs_interface.ui
index b15136e..7703bdc 100644
--- a/modules/gui/qt4/ui/sprefs_interface.ui
+++ b/modules/gui/qt4/ui/sprefs_interface.ui
@@ -8,7 +8,7 @@
<x>0</x>
<y>0</y>
<width>686</width>
- <height>667</height>
+ <height>663</height>
</rect>
</property>
<property name="sizePolicy">
@@ -407,22 +407,6 @@
<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">
@@ -451,9 +435,6 @@
</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">
@@ -461,6 +442,13 @@
</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>
@@ -646,25 +634,26 @@
</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>
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 0156bec..07bd6c2 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -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 )
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 4890d0a..ebb46dc 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -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 );
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index 41b6cf2..97c5a0f 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -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 );
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index c1b6320..df6b64f 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -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;
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index ed1b808..0320cf4 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -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;
--
1.9.0
More information about the vlc-devel
mailing list