diff --git a/src/core/library/LocalSimpleDataProvider.cpp b/src/core/library/LocalSimpleDataProvider.cpp index 764bb02cb..9af811917 100644 --- a/src/core/library/LocalSimpleDataProvider.cpp +++ b/src/core/library/LocalSimpleDataProvider.cpp @@ -41,12 +41,15 @@ #include #include #include +#include +#include #define TAG "LocalSimpleDataProvider" using namespace musik::core; using namespace musik::core::db; using namespace musik::core::db::local; +using namespace musik::core::library; using namespace musik::core::sdk; LocalSimpleDataProvider::LocalSimpleDataProvider(musik::core::ILibraryPtr library) @@ -88,8 +91,15 @@ ITrackList* LocalSimpleDataProvider::QueryTracksByCategory( int offset) { try { - std::shared_ptr search( - new CategoryTrackListQuery(this->library, categoryType, selectedId, filter)); + std::shared_ptr search; + + if (std::string(categoryType) == constants::Playlists::TABLE_NAME) { + search.reset(new GetPlaylistQuery(this->library, selectedId)); + } + else { + search.reset(new CategoryTrackListQuery( + this->library, categoryType, selectedId, filter)); + } if (limit >= 0) { search->SetLimitAndOffset(limit, offset); diff --git a/src/core/library/query/local/GetPlaylistQuery.cpp b/src/core/library/query/local/GetPlaylistQuery.cpp index 03af3a075..5028bcc1d 100644 --- a/src/core/library/query/local/GetPlaylistQuery.cpp +++ b/src/core/library/query/local/GetPlaylistQuery.cpp @@ -80,10 +80,11 @@ bool GetPlaylistQuery::OnRun(Connection& db) { } std::string query = - "SELECT DISTINCT track_id " \ - "FROM playlist_tracks " \ + "SELECT DISTINCT track_id " + "FROM playlist_tracks " "WHERE playlist_id=? " - "ORDER BY sort_order;"; + "ORDER BY sort_order " + + this->GetLimitAndOffset(); Statement trackQuery(query.c_str(), db); trackQuery.BindInt(0, this->playlistId);