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

MediaLibrary: Allow aggregate searches to be sorted

parent 5bdf7d1c
......@@ -318,7 +318,8 @@ class IMediaLibrary
virtual std::vector<ArtistPtr> searchArtists( const std::string& name,
SortingCriteria sort = SortingCriteria::Default,
bool desc = false ) const = 0;
virtual SearchAggregate search( const std::string& pattern ) const = 0;
virtual SearchAggregate search( const std::string& pattern,
SortingCriteria sort, bool desc ) const = 0;
/**
* @brief discover Launch a discovery on the provided entry point.
......
......@@ -710,14 +710,15 @@ std::vector<ArtistPtr> MediaLibrary::searchArtists( const std::string& name,
return Artist::search( this, name, sort, desc );
}
SearchAggregate MediaLibrary::search( const std::string& pattern ) const
SearchAggregate MediaLibrary::search( const std::string& pattern,
SortingCriteria sort, bool desc ) const
{
SearchAggregate res;
res.albums = searchAlbums( pattern, SortingCriteria::Default, false );
res.artists = searchArtists( pattern, SortingCriteria::Default, false );
res.albums = searchAlbums( pattern, sort, desc );
res.artists = searchArtists( pattern, sort, desc );
res.genres = searchGenre( pattern );
res.media = searchMedia( pattern, SortingCriteria::Default, false );
res.playlists = searchPlaylists( pattern, SortingCriteria::Default, false );
res.media = searchMedia( pattern, sort, desc );
res.playlists = searchPlaylists( pattern, sort, desc );
return res;
}
......
......@@ -127,7 +127,8 @@ class MediaLibrary : public IMediaLibrary, public IDeviceListerCb
virtual std::vector<ArtistPtr> searchArtists( const std::string& name,
SortingCriteria sort,
bool desc ) const override;
virtual SearchAggregate search( const std::string& pattern ) const override;
virtual SearchAggregate search( const std::string& pattern,
SortingCriteria sort, bool desc ) const override;
virtual void discover( const std::string& entryPoint ) override;
virtual void setDiscoverNetworkEnabled( bool enabled ) override;
......
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