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

Don't send an update for unparsed files.

parent d7d9a59a
......@@ -13,18 +13,13 @@ class IMediaLibraryCb
public:
virtual ~IMediaLibraryCb() = default;
/**
* @brief onMetadataUpdated Will be called when a file gets some updated metadata
* @brief onMetadataUpdated Will be called when a file gets added, or if its metadata
* got updated.
* @param file The updated file.
*/
virtual void onMetadataUpdated( FilePtr file ) = 0;
virtual void onFileUpdated( FilePtr file ) = 0;
virtual void onDiscoveryStarted( const std::string& entryPoint ) = 0;
/**
* @brief onFileAdded This will be called for each new file discovered
* or restored when reloading the media library.
* @param file
*/
virtual void onFileAdded( FilePtr file ) = 0;
virtual void onDiscoveryCompleted( const std::string& entryPoint ) = 0;
};
......
......@@ -394,10 +394,6 @@ FilePtr MediaLibrary::addFile( const fs::IFile* file, unsigned int folderId )
return nullptr;
}
LOG_INFO( "Adding ", file->name() );
// Keep in mind that this is queued by the parser thread, there is no waranty about
// when the metadata will be available
if ( m_callback != nullptr )
m_callback->onFileAdded( fptr );
m_parser->parse( fptr, m_callback );
return fptr;
}
......
......@@ -90,7 +90,7 @@ void Parser::done( FilePtr file, ServiceStatus status, void* data )
if (t->it == t->end)
{
file->setReady();
t->cb->onMetadataUpdated( file );
t->cb->onFileUpdated( file );
delete t;
return;
}
......
......@@ -16,14 +16,13 @@ class ServiceCb : public IMediaLibraryCb
std::condition_variable waitCond;
std::mutex mutex;
virtual void onMetadataUpdated( FilePtr )
virtual void onFileUpdated( FilePtr ) override
{
waitCond.notify_all();
}
// IMediaLibraryCb interface
virtual void onDiscoveryStarted( const std::string& ) override {}
virtual void onFileAdded( FilePtr ) override {}
virtual void onDiscoveryCompleted( const std::string& ) 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