Commit 35209934 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

IMediaLibraryCb: Clarify discovery callbacks & add onDiscoveryProgress

parent 2e28e6d3
......@@ -103,14 +103,23 @@ public:
virtual void onTracksDeleted( std::vector<int64_t> trackIds ) = 0;
/**
* @brief onDiscoveryStarted This callback will be invoked each time the discoverer enters a new
* entrypoint. Typically, everytime it enters a new folder
* @brief onDiscoveryStarted This callback will be invoked when a folder queued for discovery
* (by calling IMediaLibrary::discover()) gets processed.
* @param entryPoint The entrypoint being discovered
* This callback will be invoked once per endpoint.
* It will also be invoked when the initial medialibrary reload starts, in which case, the
* entryPoint will be an empty string.
*/
virtual void onDiscoveryStarted( const std::string& entryPoint ) = 0;
/**
* @brief onDiscoveryProgress This callback will be invoked each time the discoverer enters a new
* entrypoint. Typically, everytime it enters a new folder.
* @param entryPoint The entrypoint being discovered
* This callback can be invoked multiple times even though a single entry point was asked to be
* discovered. ie. In the case of a file system discovery, discovering a folder would make this
* callback being invoked for all subfolders
*/
virtual void onDiscoveryStarted( const std::string& entryPoint ) = 0;
virtual void onDiscoveryProgress( const std::string& entryPoint ) = 0;
/**
* @brief onDiscoveryCompleted Will be invoked when the discovery of a specified entrypoint has
* completed.
......
......@@ -143,7 +143,7 @@ void FsDiscoverer::checkFolder( fs::IDirectory& currentFolderFs, Folder& current
m_ml->deleteFolder( currentFolder );
return;
}
m_cb->onDiscoveryStarted( currentFolderFs.path() );
m_cb->onDiscoveryProgress( currentFolderFs.path() );
// Load the folders we already know of:
LOG_INFO( "Checking for modifications in ", currentFolderFs.path() );
auto subFoldersInDB = Folder::fetchAll( m_ml, currentFolder.id() );
......
......@@ -35,6 +35,7 @@ class NoopCallback : public IMediaLibraryCb
virtual void onMediaUpdated( std::vector<MediaPtr> ) override {}
virtual void onMediaDeleted( std::vector<int64_t> ) override {}
virtual void onDiscoveryStarted(const std::string&) override {}
virtual void onDiscoveryProgress(const std::string&) override {}
virtual void onDiscoveryCompleted( const std::string& ) override {}
virtual void onArtistsAdded( std::vector<ArtistPtr> ) override {}
virtual void onArtistsModified( std::vector<ArtistPtr> ) override {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment