[vlmc-devel] Library: Fix not adding unchanged files to the model

Yikai Lu git at videolan.org
Mon Mar 6 21:58:38 CET 2017


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Mon Mar  6 14:55:01 2017 -0600| [9cc58c41ed3d35179bf7ecec596c55caf94fc3c1] | committer: Yikai Lu

Library: Fix not adding unchanged files to the model

> https://code.videolan.org/videolan/vlmc/commit/9cc58c41ed3d35179bf7ecec596c55caf94fc3c1
---

 src/Library/Library.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index f27e56b..756f940 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -320,6 +320,16 @@ Library::onDiscoveryCompleted( const std::string& entryPoint )
         m_videoModel->refresh();
         m_audioModel->refresh();
     }
+
+    // FIXME: Optimization Needed
+    for ( auto media : m_ml->videoFiles() )
+        if ( m_videoModel->findMedia( media->id() ) == nullptr )
+            m_videoModel->addMedia( media );
+
+    for ( auto media : m_ml->audioFiles() )
+        if ( m_audioModel->findMedia( media->id() ) == nullptr )
+            m_audioModel->addMedia( media );
+
     emit discoveryCompleted( QString::fromStdString( entryPoint ) );
 }
 



More information about the Vlmc-devel mailing list