[vlc-devel] [PATCH 7/7] Qt: update art requests to use updated API

Francois Cartegnie fcvlcdev at free.fr
Wed May 14 10:01:25 CEST 2014


---
 modules/gui/qt4/components/interface_widgets.cpp  |  2 +-
 modules/gui/qt4/components/playlist/vlc_model.cpp |  2 +-
 modules/gui/qt4/input_manager.cpp                 |  8 +++++---
 modules/gui/qt4/input_manager.hpp                 |  2 +-
 src/playlist/fetcher.c                            | 18 ++++++++++++++++++
 5 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index af27f44..84babdb 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -705,7 +705,7 @@ void CoverArtLabel::showArtUpdate( input_item_t *_p_item )
 
 void CoverArtLabel::askForUpdate()
 {
-    THEMIM->getIM()->requestArtUpdate( p_item );
+    THEMIM->getIM()->requestArtUpdate( p_item, true );
 }
 
 void CoverArtLabel::setArtFromFile()
diff --git a/modules/gui/qt4/components/playlist/vlc_model.cpp b/modules/gui/qt4/components/playlist/vlc_model.cpp
index 354b828..9df4bfb 100644
--- a/modules/gui/qt4/components/playlist/vlc_model.cpp
+++ b/modules/gui/qt4/components/playlist/vlc_model.cpp
@@ -206,7 +206,7 @@ void VLCModel::ensureArtRequested( const QModelIndex &index )
         {
             child = index.child( row, COLUMN_COVER );
             if ( child.isValid() && child.data().toString().isEmpty() )
-                THEMIM->getIM()->requestArtUpdate( getInputItem( child ) );
+                THEMIM->getIM()->requestArtUpdate( getInputItem( child ), false );
         }
     }
 }
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 11fde76..0126687 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -636,7 +636,7 @@ void InputManager::UpdateCaching()
     }
 }
 
-void InputManager::requestArtUpdate( input_item_t *p_item )
+void InputManager::requestArtUpdate( input_item_t *p_item, bool b_forced )
 {
     bool b_current_item = false;
     if ( !p_item && hasInput() )
@@ -648,13 +648,15 @@ void InputManager::requestArtUpdate( input_item_t *p_item )
     if ( p_item )
     {
         /* check if it has already been enqueued */
-        if ( p_item->p_meta )
+        if ( p_item->p_meta && !b_forced )
         {
             int status = vlc_meta_GetStatus( p_item->p_meta );
             if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED ) )
                 return;
         }
-        libvlc_ArtRequest( p_intf->p_libvlc, p_item, META_REQUEST_OPTION_NONE );
+        libvlc_ArtRequest( p_intf->p_libvlc, p_item,
+                           (b_forced) ? META_REQUEST_OPTION_ANY
+                                      : META_REQUEST_OPTION_NONE );
         /* No input will signal the cover art to update,
              * let's do it ourself */
         if ( b_current_item )
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index ff1a83d..dac3bc3 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -141,7 +141,7 @@ public:
     bool hasAudio();
     bool hasVideo() { return hasInput() && b_video; }
     bool hasVisualisation();
-    void requestArtUpdate( input_item_t *p_item );
+    void requestArtUpdate( input_item_t *p_item, bool b_forced );
     void setArt( input_item_t *p_item, QString fileUrl );
 
     QString getName() { return oldName; }
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index 079ac9c..f801f06 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -385,6 +385,23 @@ static void *Thread( void *p_data )
         if( !p_item )
             break;
 
+        meta_fetcher_scope_t e_prev_scope = p_fetcher->e_scope;
+
+        /* scope override */
+        switch ( i_options ) {
+        case META_REQUEST_OPTION_ANY:
+            p_fetcher->e_scope = FETCHER_SCOPE_ANY;
+            break;
+        case META_REQUEST_OPTION_LOCAL:
+            p_fetcher->e_scope = FETCHER_SCOPE_LOCAL;
+            break;
+        case META_REQUEST_OPTION_NETWORK:
+            p_fetcher->e_scope = FETCHER_SCOPE_NETWORK;
+            break;
+        case META_REQUEST_OPTION_NONE:
+        default:
+            break;
+        }
         /* Triggers "meta fetcher", eventually fetch meta on the network.
          * They are identical to "meta reader" expect that may actually
          * takes time. That's why they are running here.
@@ -396,6 +413,7 @@ static void *Thread( void *p_data )
         if( i_ret == 1 )
             i_ret = DownloadArt( p_fetcher, p_item );
 
+        p_fetcher->e_scope = e_prev_scope;
         /* */
         char *psz_name = input_item_GetName( p_item );
         if( !i_ret ) /* Art is now in cache */
-- 
1.9.0




More information about the vlc-devel mailing list