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

MetadataParser: Handle media refresh in a transaction

parent f379a95a
......@@ -562,6 +562,7 @@ std::tuple<bool, bool> MetadataAnalyzer::refreshMedia( IItem& item ) const
else if ( isAudio == false && media->type() == IMedia::Type::Audio )
media->setType( IMedia::Type::Video );
auto t = m_ml->getConn()->newTransaction();
bool needRescan = false;
if ( media->subType() != IMedia::SubType::Unknown )
{
......@@ -663,6 +664,7 @@ std::tuple<bool, bool> MetadataAnalyzer::refreshMedia( IItem& item ) const
if ( media->save() == false )
return std::make_tuple( false, false );
t->commit();
item.setMedia( std::move( media ) );
return std::make_tuple( true, needRescan );
}
......
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