Commit e952972d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

MetadataParser: Don't use dates to discriminate compilation albums

parent cb430c29
......@@ -472,11 +472,11 @@ std::shared_ptr<Album> MetadataParser::findAlbum( parser::Task& task, std::share
for ( auto it = begin( albums ); it != end( albums ); )
{
auto a = (*it).get();
auto candidateAlbumArtist = a->albumArtist();
if ( albumArtist != nullptr )
{
// We assume that an album without album artist is a positive match.
// At the end of the day, without proper tags, there's only so much we can do.
auto candidateAlbumArtist = a->albumArtist();
if ( candidateAlbumArtist != nullptr && candidateAlbumArtist->id() != albumArtist->id() )
{
it = albums.erase( it );
......@@ -520,7 +520,15 @@ std::shared_ptr<Album> MetadataParser::findAlbum( parser::Task& task, std::share
continue;
}
// Attempt to discriminate by date
// Attempt to discriminate by date, but only for the same artists.
// Not taking the artist in consideration would cause compilation to
// create multiple albums, especially when track are only partially
// tagged with a year.
if ( ( albumArtist != nullptr && candidateAlbumArtist != nullptr &&
albumArtist->id() == candidateAlbumArtist->id() ) ||
( trackArtist != nullptr && candidateAlbumArtist != nullptr &&
trackArtist->id() == candidateAlbumArtist->id() ) )
{
auto candidateDate = task.vlcMedia.meta( libvlc_meta_Date );
if ( candidateDate.empty() == false )
{
......@@ -538,6 +546,7 @@ std::shared_ptr<Album> MetadataParser::findAlbum( parser::Task& task, std::share
// Date wasn't helpful, simply ignore the error and continue
}
}
}
// Assume album files will be in the same folder.
auto newFileFolder = utils::file::directory( task.file->mrl() );
......
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