Use new subsonic api search3 call in RESTMusicService.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
0f7a3cdf30
commit
a65fbef3be
|
@ -64,6 +64,7 @@ import org.moire.ultrasonic.api.subsonic.response.GetMusicDirectoryResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.LicenseResponse;
|
import org.moire.ultrasonic.api.subsonic.response.LicenseResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.MusicFoldersResponse;
|
import org.moire.ultrasonic.api.subsonic.response.MusicFoldersResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.SearchResponse;
|
import org.moire.ultrasonic.api.subsonic.response.SearchResponse;
|
||||||
|
import org.moire.ultrasonic.api.subsonic.response.SearchThreeResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.SearchTwoResponse;
|
import org.moire.ultrasonic.api.subsonic.response.SearchTwoResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse;
|
import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse;
|
||||||
import org.moire.ultrasonic.data.APIConverter;
|
import org.moire.ultrasonic.data.APIConverter;
|
||||||
|
@ -456,21 +457,20 @@ public class RESTMusicService implements MusicService
|
||||||
return APIConverter.toDomainEntity(response.body().getSearchResult());
|
return APIConverter.toDomainEntity(response.body().getSearchResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchResult search3(SearchCriteria criteria, Context context, ProgressListener progressListener) throws Exception
|
private SearchResult search3(SearchCriteria criteria,
|
||||||
{
|
Context context,
|
||||||
checkServerVersion(context, "1.8", "Searching by ID3 tag not supported.");
|
ProgressListener progressListener) throws Exception {
|
||||||
|
if (criteria.getQuery() == null) {
|
||||||
|
throw new IllegalArgumentException("Query param is null");
|
||||||
|
}
|
||||||
|
|
||||||
List<String> parameterNames = asList("query", "artistCount", "albumCount", "songCount");
|
updateProgressListener(progressListener, R.string.parser_reading);
|
||||||
List<Object> parameterValues = Arrays.<Object>asList(criteria.getQuery(), criteria.getArtistCount(), criteria.getAlbumCount(), criteria.getSongCount());
|
Response<SearchThreeResponse> response = subsonicAPIClient.getApi().search3(criteria.getQuery(),
|
||||||
Reader reader = getReader(context, progressListener, "search3", null, parameterNames, parameterValues);
|
criteria.getArtistCount(), null, criteria.getAlbumCount(), null,
|
||||||
try
|
criteria.getSongCount(), null).execute();
|
||||||
{
|
checkResponseSuccessful(response);
|
||||||
return new SearchResult2Parser(context).parse(reader, progressListener, true);
|
|
||||||
}
|
return APIConverter.toDomainEntity(response.body().getSearchResult());
|
||||||
finally
|
|
||||||
{
|
|
||||||
Util.close(reader);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue