mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Preparation for requesting album information
This commit is contained in:
parent
199482f83d
commit
ca37adc33a
5 changed files with 69 additions and 89 deletions
|
|
@ -6,6 +6,7 @@ import android.os.Parcelable;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumInfo;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumWithSongsID3;
|
||||
import com.cappielloantonio.play.util.MappingUtil;
|
||||
|
||||
|
|
@ -28,6 +29,7 @@ public class Album implements Parcelable {
|
|||
public String blurHash;
|
||||
public boolean favorite;
|
||||
public List<Song> songs;
|
||||
public String notes;
|
||||
|
||||
public Album(AlbumID3 albumID3) {
|
||||
this.id = albumID3.getId();
|
||||
|
|
@ -50,6 +52,10 @@ public class Album implements Parcelable {
|
|||
this.songs = MappingUtil.mapSong(albumWithSongsID3.getSongs());
|
||||
}
|
||||
|
||||
public Album(AlbumInfo info) {
|
||||
this.notes = info.getNotes();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -122,6 +128,14 @@ public class Album implements Parcelable {
|
|||
this.songs = songs;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
|||
|
|
@ -223,6 +223,29 @@ public class AlbumRepository {
|
|||
return album;
|
||||
}
|
||||
|
||||
public MutableLiveData<Album> getAlbumInfo(String id) {
|
||||
MutableLiveData<Album> album = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(application, false)
|
||||
.getBrowsingClient()
|
||||
.getAlbumInfo2(id)
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
album.setValue(MappingUtil.mapAlbum(response.body().getAlbumInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return album;
|
||||
}
|
||||
|
||||
public void getInstantMix(Album album, int count, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(application, false)
|
||||
.getBrowsingClient()
|
||||
|
|
|
|||
|
|
@ -1,131 +1,68 @@
|
|||
package com.cappielloantonio.play.subsonic.models;
|
||||
|
||||
import com.tickaroo.tikxml.annotation.Attribute;
|
||||
import com.tickaroo.tikxml.annotation.Xml;
|
||||
|
||||
@Xml
|
||||
public class AlbumInfo {
|
||||
@Attribute
|
||||
protected String notes;
|
||||
@Attribute
|
||||
protected String musicBrainzId;
|
||||
@Attribute
|
||||
protected String lastFmUrl;
|
||||
@Attribute
|
||||
protected String smallImageUrl;
|
||||
@Attribute
|
||||
protected String mediumImageUrl;
|
||||
@Attribute
|
||||
protected String largeImageUrl;
|
||||
|
||||
/**
|
||||
* Gets the value of the notes property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the notes property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setNotes(String value) {
|
||||
this.notes = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the musicBrainzId property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getMusicBrainzId() {
|
||||
return musicBrainzId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the musicBrainzId property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setMusicBrainzId(String value) {
|
||||
this.musicBrainzId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the lastFmUrl property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getLastFmUrl() {
|
||||
return lastFmUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the lastFmUrl property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setLastFmUrl(String value) {
|
||||
this.lastFmUrl = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the smallImageUrl property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getSmallImageUrl() {
|
||||
return smallImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the smallImageUrl property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setSmallImageUrl(String value) {
|
||||
this.smallImageUrl = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the mediumImageUrl property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getMediumImageUrl() {
|
||||
return mediumImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the mediumImageUrl property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setMediumImageUrl(String value) {
|
||||
this.mediumImageUrl = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the largeImageUrl property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getLargeImageUrl() {
|
||||
return largeImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the largeImageUrl property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setLargeImageUrl(String value) {
|
||||
this.largeImageUrl = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public class SubsonicResponse {
|
|||
@Element(name = "artistInfo2")
|
||||
private ArtistInfo2 artistInfo2;
|
||||
private ArtistInfo artistInfo;
|
||||
@Element(name = "albumInfo")
|
||||
private AlbumInfo albumInfo;
|
||||
@Element(name = "starred2")
|
||||
private Starred2 starred2;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.cappielloantonio.play.model.Playlist;
|
|||
import com.cappielloantonio.play.model.Queue;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumInfo;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumWithSongsID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistInfo2;
|
||||
|
|
@ -43,6 +44,10 @@ public class MappingUtil {
|
|||
return new Album(albumWithSongsID3);
|
||||
}
|
||||
|
||||
public static Album mapAlbum(AlbumInfo albumInfo) {
|
||||
return new Album(albumInfo);
|
||||
}
|
||||
|
||||
public static ArrayList<Artist> mapArtist(List<ArtistID3> artistID3List) {
|
||||
ArrayList<Artist> artists = new ArrayList();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue