mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 10:23:33 +00:00
Implemented Top Songs view per artist
This commit is contained in:
parent
7ad2e1da1d
commit
f321a5520f
6 changed files with 37 additions and 26 deletions
|
|
@ -284,6 +284,27 @@ public class ArtistRepository {
|
|||
return randomSongs;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Song>> getTopSongs(String artistName, int count) {
|
||||
MutableLiveData<List<Song>> topSongs = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(application, false)
|
||||
.getBrowsingClient()
|
||||
.getTopSongs(artistName, count)
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, Response<SubsonicResponse> response) {
|
||||
topSongs.setValue(MappingUtil.mapSong(response.body().getTopSongs().getSongs()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return topSongs;
|
||||
}
|
||||
|
||||
private void addToMutableLiveData(MutableLiveData<List<Artist>> liveData, Artist artist) {
|
||||
List<Artist> liveArtists = liveData.getValue();
|
||||
liveArtists.add(artist);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue