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