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

MetadataParser: Simplify duplicate tasks handling

parent 7496ff0b
......@@ -93,7 +93,6 @@ int MetadataAnalyzer::toInt( IItem& item, IItem::Metadata meta )
Status MetadataAnalyzer::run( IItem& item )
{
bool alreadyInParser = false;
int nbSubitem = item.nbSubItems();
// Assume that file containing subitem(s) is a Playlist
if ( nbSubitem > 0 )
......@@ -163,13 +162,7 @@ Status MetadataAnalyzer::run( IItem& item )
LOG_ERROR( "File ", mrl, " no longer present in DB, aborting");
return Status::Fatal;
}
auto media = fileInDB->media();
if ( media == nullptr ) // Without a media, we cannot go further
return Status::Fatal;
item.setFile( std::move( fileInDB ) );
item.setMedia( std::move( media ) );
alreadyInParser = true;
return Status::Discarded;
}
}
else if ( item.media() == nullptr )
......@@ -188,9 +181,6 @@ Status MetadataAnalyzer::run( IItem& item )
if ( item.parentPlaylist() != nullptr )
item.parentPlaylist()->add( *media, item.parentPlaylistIndex() );
if ( alreadyInParser == true )
return Status::Discarded;
{
using TracksT = decltype( tracks );
sqlite::Tools::withRetries( 3, [this, &isAudio, &item, &media]( TracksT tracks ) {
......
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