1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2025-02-02 10:16:50 +01:00

Use new subsonic api call to create playlist.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-09-02 20:51:10 +02:00
parent bb64b9e3ca
commit fcb5210a3b

View File

@ -574,36 +574,23 @@ public class RESTMusicService implements MusicService
} }
@Override @Override
public void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries, Context context, ProgressListener progressListener) throws Exception public void createPlaylist(String id,
{ String name,
List<String> parameterNames = new LinkedList<String>(); List<MusicDirectory.Entry> entries,
List<Object> parameterValues = new LinkedList<Object>(); Context context,
ProgressListener progressListener) throws Exception {
if (id != null) Long pId = id == null ? null : Long.valueOf(id);
{ List<Long> pSongIds = new ArrayList<>(entries.size());
parameterNames.add("playlistId"); for (MusicDirectory.Entry entry : entries) {
parameterValues.add(id); if (entry.getId() != null) {
pSongIds.add(Long.valueOf(entry.getId()));
} }
if (name != null)
{
parameterNames.add("name");
parameterValues.add(name);
}
for (MusicDirectory.Entry entry : entries)
{
parameterNames.add("songId");
parameterValues.add(entry.getId());
} }
Reader reader = getReader(context, progressListener, "createPlaylist", null, parameterNames, parameterValues); updateProgressListener(progressListener, R.string.parser_reading);
try Response<SubsonicResponse> response = subsonicAPIClient.getApi()
{ .createPlaylist(pId, name, pSongIds).execute();
new ErrorParser(context).parse(reader); checkResponseSuccessful(response);
}
finally
{
Util.close(reader);
}
} }
@Override @Override