Use new subsonic api scrobble call.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-09-04 21:25:56 +02:00
parent 9892805517
commit 71b7948908
1 changed files with 13 additions and 14 deletions

View File

@ -638,21 +638,20 @@ public class RESTMusicService implements MusicService
return APILyricsConverter.toDomainEntity(response.body().getLyrics());
}
@Override
public void scrobble(String id, boolean submission, Context context, ProgressListener progressListener) throws Exception
{
checkServerVersion(context, "1.5", "Scrobbling not supported.");
@Override
public void scrobble(String id,
boolean submission,
Context context,
ProgressListener progressListener) throws Exception {
if (id == null) {
throw new IllegalArgumentException("Scrobble id is null");
}
Reader reader = getReader(context, progressListener, "scrobble", null, asList("id", "submission"), Arrays.<Object>asList(id, submission));
try
{
new ErrorParser(context).parse(reader);
}
finally
{
Util.close(reader);
}
}
updateProgressListener(progressListener, R.string.parser_reading);
Response<SubsonicResponse> response = subsonicAPIClient.getApi()
.scrobble(id, null, submission).execute();
checkResponseSuccessful(response);
}
@Override
public MusicDirectory getAlbumList(String type, int size, int offset, Context context, ProgressListener progressListener) throws Exception