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

VLCMetadataService: Discriminate albums using their release dates when available

parent a2f2461b
......@@ -203,6 +203,9 @@ std::shared_ptr<Album> VLCMetadataService::findAlbum( const std::string& title,
auto artistName = vlcMedia.meta( libvlc_meta_AlbumArtist );
if ( artistName.empty() == true )
artistName = vlcMedia.meta( libvlc_meta_Artist );
auto date = vlcMedia.meta( libvlc_meta_Date );
auto i_date = (time_t)atoi( date.c_str() );
for ( auto it = begin( albums ); it != end( albums ); )
{
auto a = static_cast<Album*>( (*it).get() );
......@@ -217,6 +220,14 @@ std::shared_ptr<Album> VLCMetadataService::findAlbum( const std::string& title,
continue;
}
}
if ( date.empty() == false )
{
if ( i_date != a->releaseYear() )
{
it = albums.erase( it );
continue;
}
}
++it;
}
if ( albums.size() == 0 )
......
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