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

MetadataParser: Fetch the various artists representation only once

parent 7aac3823
......@@ -174,7 +174,7 @@ bool MetadataParser::parseVideoFile( parser::Task& task ) const
/* Audio files */
bool MetadataParser::parseAudioFile( parser::Task& task ) const
bool MetadataParser::parseAudioFile( parser::Task& task )
{
task.media->setType( IMedia::Type::Audio );
......@@ -430,7 +430,7 @@ std::shared_ptr<AlbumTrack> MetadataParser::handleTrack( std::shared_ptr<Album>
/* Misc */
bool MetadataParser::link( Media& media, std::shared_ptr<Album> album,
std::shared_ptr<Artist> albumArtist, std::shared_ptr<Artist> artist ) const
std::shared_ptr<Artist> albumArtist, std::shared_ptr<Artist> artist )
{
if ( albumArtist == nullptr )
albumArtist = artist;
......@@ -467,8 +467,9 @@ bool MetadataParser::link( Media& media, std::shared_ptr<Album> album,
if ( albumArtist->id() != currentAlbumArtist->id() )
{
// We have more than a single artist on this album, fallback to various artists
auto variousArtists = Artist::fetch( m_ml, VariousArtistID );
album->setAlbumArtist( variousArtists );
if ( m_variousArtists == nullptr )
m_variousArtists = Artist::fetch( m_ml, VariousArtistID );
album->setAlbumArtist( m_variousArtists );
// Add those two artists as "featuring".
album->addArtist( albumArtist );
}
......
......@@ -39,12 +39,12 @@ protected:
virtual uint8_t nbThreads() const override;
bool isCompleted( const parser::Task& task ) const override;
bool parseAudioFile(parser::Task& task) const;
bool parseAudioFile(parser::Task& task);
bool parseVideoFile(parser::Task& task) const;
std::pair<std::shared_ptr<Artist>, std::shared_ptr<Artist>> findOrCreateArtist( parser::Task& vlcMedia ) const;
std::shared_ptr<AlbumTrack> handleTrack( std::shared_ptr<Album> album, parser::Task& task,
std::shared_ptr<Artist> artist, Genre* genre ) const;
bool link(Media& media, std::shared_ptr<Album> album, std::shared_ptr<Artist> albumArtist, std::shared_ptr<Artist> artist ) const;
bool link(Media& media, std::shared_ptr<Album> album, std::shared_ptr<Artist> albumArtist, std::shared_ptr<Artist> artist );
std::shared_ptr<Album> findAlbum( parser::Task& task, std::shared_ptr<Artist> albumArtist,
std::shared_ptr<Artist> artist ) const;
std::shared_ptr<Genre> handleGenre( parser::Task& task ) const;
......@@ -54,6 +54,7 @@ private:
private:
std::shared_ptr<Artist> m_unknownArtist;
std::shared_ptr<Artist> m_variousArtists;
};
}
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