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

MetadataParser: Handle media refresh in a transaction

(cherry picked from commit e69c88ef)
Signed-off-by: default avatarHugo Beauzée-Luyssen <hugo@beauzee.fr>
parent c5edc174
......@@ -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 )
{
......@@ -647,6 +648,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