Prepared subsonic model to accept podcast channels and episodes

This commit is contained in:
CappielloAntonio 2022-02-05 18:34:21 +01:00
parent 1605bcd8e1
commit 93e08ef514
6 changed files with 385 additions and 245 deletions

View file

@ -1,35 +1,24 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Xml
public class NewestPodcasts { public class NewestPodcasts {
@Element(name = "episode")
protected List<PodcastEpisode> episodes; protected List<PodcastEpisode> episodes;
/**
* Gets the value of the episodes property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the episodes property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEpisodes().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PodcastEpisode }
*/
public List<PodcastEpisode> getEpisodes() { public List<PodcastEpisode> getEpisodes() {
if (episodes == null) { if (episodes == null) {
episodes = new ArrayList<>(); episodes = new ArrayList<>();
} }
return this.episodes; return this.episodes;
} }
public void setEpisodes(List<PodcastEpisode> episodes) {
this.episodes = episodes;
}
} }

View file

@ -1,39 +1,33 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Attribute;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Xml
public class PodcastChannel { public class PodcastChannel {
@Element(name = "episode")
protected List<PodcastEpisode> episodes; protected List<PodcastEpisode> episodes;
@Attribute
protected String id; protected String id;
@Attribute
protected String url; protected String url;
@Attribute
protected String title; protected String title;
@Attribute
protected String description; protected String description;
@Attribute
protected String coverArtId; protected String coverArtId;
@Attribute
protected String originalImageUrl; protected String originalImageUrl;
protected PodcastStatus status; @Attribute
protected String status;
@Attribute
protected String errorMessage; protected String errorMessage;
/**
* Gets the value of the episodes property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the episodes property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getEpisodes().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PodcastEpisode }
*/
public List<PodcastEpisode> getEpisodes() { public List<PodcastEpisode> getEpisodes() {
if (episodes == null) { if (episodes == null) {
episodes = new ArrayList<>(); episodes = new ArrayList<>();
@ -41,162 +35,70 @@ public class PodcastChannel {
return this.episodes; return this.episodes;
} }
/** public void setEpisodes(List<PodcastEpisode> episodes) {
* Gets the value of the id property. this.episodes = episodes;
* }
* @return possible object is
* {@link String }
*/
public String getId() { public String getId() {
return id; return id;
} }
/**
* Sets the value of the id property.
*
* @param value allowed object is
* {@link String }
*/
public void setId(String value) { public void setId(String value) {
this.id = value; this.id = value;
} }
/**
* Gets the value of the url property.
*
* @return possible object is
* {@link String }
*/
public String getUrl() { public String getUrl() {
return url; return url;
} }
/**
* Sets the value of the url property.
*
* @param value allowed object is
* {@link String }
*/
public void setUrl(String value) { public void setUrl(String value) {
this.url = value; this.url = value;
} }
/**
* Gets the value of the title property.
*
* @return possible object is
* {@link String }
*/
public String getTitle() { public String getTitle() {
return title; return title;
} }
/**
* Sets the value of the title property.
*
* @param value allowed object is
* {@link String }
*/
public void setTitle(String value) { public void setTitle(String value) {
this.title = value; this.title = value;
} }
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Sets the value of the description property.
*
* @param value allowed object is
* {@link String }
*/
public void setDescription(String value) { public void setDescription(String value) {
this.description = value; this.description = value;
} }
/**
* Gets the value of the coverArtId property.
*
* @return possible object is
* {@link String }
*/
public String getCoverArtId() { public String getCoverArtId() {
return coverArtId; return coverArtId;
} }
/**
* Sets the value of the coverArtId property.
*
* @param value allowed object is
* {@link String }
*/
public void setCoverArtId(String value) { public void setCoverArtId(String value) {
this.coverArtId = value; this.coverArtId = value;
} }
/**
* Gets the value of the originalImageUrl property.
*
* @return possible object is
* {@link String }
*/
public String getOriginalImageUrl() { public String getOriginalImageUrl() {
return originalImageUrl; return originalImageUrl;
} }
/**
* Sets the value of the originalImageUrl property.
*
* @param value allowed object is
* {@link String }
*/
public void setOriginalImageUrl(String value) { public void setOriginalImageUrl(String value) {
this.originalImageUrl = value; this.originalImageUrl = value;
} }
/** public String getStatus() {
* Gets the value of the status property.
*
* @return possible object is
* {@link PodcastStatus }
*/
public PodcastStatus getStatus() {
return status; return status;
} }
/** public void setStatus(String value) {
* Sets the value of the status property.
*
* @param value allowed object is
* {@link PodcastStatus }
*/
public void setStatus(PodcastStatus value) {
this.status = value; this.status = value;
} }
/**
* Gets the value of the errorMessage property.
*
* @return possible object is
* {@link String }
*/
public String getErrorMessage() { public String getErrorMessage() {
return errorMessage; return errorMessage;
} }
/**
* Sets the value of the errorMessage property.
*
* @param value allowed object is
* {@link String }
*/
public void setErrorMessage(String value) { public void setErrorMessage(String value) {
this.errorMessage = value; this.errorMessage = value;
} }

View file

@ -1,111 +1,374 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Attribute;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import com.tickaroo.tikxml.converters.date.rfc3339.DateRfc3339TypeConverter;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
public class PodcastEpisode extends Child { @Xml
public class PodcastEpisode {
@Attribute
protected String id;
@Attribute(name = "parent")
protected String parentId;
@Attribute(name = "isDir")
protected boolean dir;
@Attribute
protected String title;
@Attribute
protected String album;
@Attribute
protected String artist;
@Attribute
protected Integer track;
@Attribute
protected Integer year;
@Attribute(name = "genre")
protected String genre;
@Attribute(name = "coverArt")
protected String coverArtId;
@Attribute
protected Long size;
@Attribute
protected String contentType;
@Attribute
protected String suffix;
@Attribute
protected String transcodedContentType;
@Attribute
protected String transcodedSuffix;
@Attribute
protected Integer duration;
@Attribute
protected Integer bitRate;
@Attribute
protected String path;
@Attribute(name = "isVideo")
protected Boolean video;
@Attribute
protected Integer userRating;
@Attribute
protected Double averageRating;
@Attribute
protected Long playCount;
@Attribute
protected Integer discNumber;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date created;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date starred;
@Attribute
protected String albumId;
@Attribute
protected String artistId;
@Attribute
protected String type;
@Attribute
protected Long bookmarkPosition;
@Attribute
protected Integer originalWidth;
@Attribute
protected Integer originalHeight;
@Attribute
protected String streamId; protected String streamId;
@Attribute
protected String channelId; protected String channelId;
@Attribute
protected String description; protected String description;
protected PodcastStatus status; @Attribute
protected LocalDateTime publishDate; protected String status;
@Attribute(converter = DateRfc3339TypeConverter.class)
protected Date publishDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public boolean isDir() {
return dir;
}
public void setDir(boolean dir) {
this.dir = dir;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAlbum() {
return album;
}
public void setAlbum(String album) {
this.album = album;
}
public String getArtist() {
return artist;
}
public void setArtist(String artist) {
this.artist = artist;
}
public Integer getTrack() {
return track;
}
public void setTrack(Integer track) {
this.track = track;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}
public String getCoverArtId() {
return coverArtId;
}
public void setCoverArtId(String coverArtId) {
this.coverArtId = coverArtId;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public String getTranscodedContentType() {
return transcodedContentType;
}
public void setTranscodedContentType(String transcodedContentType) {
this.transcodedContentType = transcodedContentType;
}
public String getTranscodedSuffix() {
return transcodedSuffix;
}
public void setTranscodedSuffix(String transcodedSuffix) {
this.transcodedSuffix = transcodedSuffix;
}
public Integer getDuration() {
return duration;
}
public void setDuration(Integer duration) {
this.duration = duration;
}
public Integer getBitRate() {
return bitRate;
}
public void setBitRate(Integer bitRate) {
this.bitRate = bitRate;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Boolean getVideo() {
return video;
}
public void setVideo(Boolean video) {
this.video = video;
}
public Integer getUserRating() {
return userRating;
}
public void setUserRating(Integer userRating) {
this.userRating = userRating;
}
public Double getAverageRating() {
return averageRating;
}
public void setAverageRating(Double averageRating) {
this.averageRating = averageRating;
}
public Long getPlayCount() {
return playCount;
}
public void setPlayCount(Long playCount) {
this.playCount = playCount;
}
public Integer getDiscNumber() {
return discNumber;
}
public void setDiscNumber(Integer discNumber) {
this.discNumber = discNumber;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getStarred() {
return starred;
}
public void setStarred(Date starred) {
this.starred = starred;
}
public String getAlbumId() {
return albumId;
}
public void setAlbumId(String albumId) {
this.albumId = albumId;
}
public String getArtistId() {
return artistId;
}
public void setArtistId(String artistId) {
this.artistId = artistId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getBookmarkPosition() {
return bookmarkPosition;
}
public void setBookmarkPosition(Long bookmarkPosition) {
this.bookmarkPosition = bookmarkPosition;
}
public Integer getOriginalWidth() {
return originalWidth;
}
public void setOriginalWidth(Integer originalWidth) {
this.originalWidth = originalWidth;
}
public Integer getOriginalHeight() {
return originalHeight;
}
public void setOriginalHeight(Integer originalHeight) {
this.originalHeight = originalHeight;
}
/**
* Gets the value of the streamId property.
*
* @return possible object is
* {@link String }
*/
public String getStreamId() { public String getStreamId() {
return streamId; return streamId;
} }
/**
* Sets the value of the streamId property.
*
* @param value allowed object is
* {@link String }
*/
public void setStreamId(String value) { public void setStreamId(String value) {
this.streamId = value; this.streamId = value;
} }
/**
* Gets the value of the channelId property.
*
* @return possible object is
* {@link String }
*/
public String getChannelId() { public String getChannelId() {
return channelId; return channelId;
} }
/**
* Sets the value of the channelId property.
*
* @param value allowed object is
* {@link String }
*/
public void setChannelId(String value) { public void setChannelId(String value) {
this.channelId = value; this.channelId = value;
} }
/**
* Gets the value of the description property.
*
* @return possible object is
* {@link String }
*/
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Sets the value of the description property.
*
* @param value allowed object is
* {@link String }
*/
public void setDescription(String value) { public void setDescription(String value) {
this.description = value; this.description = value;
} }
/** public String getStatus() {
* Gets the value of the status property.
*
* @return possible object is
* {@link PodcastStatus }
*/
public PodcastStatus getStatus() {
return status; return status;
} }
/** public void setStatus(String value) {
* Sets the value of the status property.
*
* @param value allowed object is
* {@link PodcastStatus }
*/
public void setStatus(PodcastStatus value) {
this.status = value; this.status = value;
} }
/** public Date getPublishDate() {
* Gets the value of the publishDate property.
*
* @return possible object is
* {@link String }
*/
public LocalDateTime getPublishDate() {
return publishDate; return publishDate;
} }
/** public void setPublishDate(Date value) {
* Sets the value of the publishDate property.
*
* @param value allowed object is
* {@link String }
*/
public void setPublishDate(LocalDateTime value) {
this.publishDate = value; this.publishDate = value;
} }
} }

View file

@ -1,29 +1,25 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models;
public enum PodcastStatus { import com.tickaroo.tikxml.annotation.Attribute;
NEW("new"), import com.tickaroo.tikxml.annotation.Xml;
DOWNLOADING("downloading"),
COMPLETED("completed"),
ERROR("error"),
DELETED("deleted"),
SKIPPED("skipped");
private final String value; @Xml
public class PodcastStatus {
public static String NEW = "new";
public static String DOWNLOADING = "downloading";
public static String COMPLETED = "completed";
public static String ERROR = "error";
public static String DELETED = "deleted";
public static String SKIPPED = "skipped";
PodcastStatus(String v) { @Attribute
value = v; private String value;
}
public String value() { public String getValue() {
return value; return value;
} }
public static PodcastStatus fromValue(String v) { public void setValue(String value) {
for (PodcastStatus c : PodcastStatus.values()) { this.value = value;
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} }
} }

View file

@ -1,35 +1,24 @@
package com.cappielloantonio.play.subsonic.models; package com.cappielloantonio.play.subsonic.models;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Xml
public class Podcasts { public class Podcasts {
@Element(name = "channel")
protected List<PodcastChannel> channels; protected List<PodcastChannel> channels;
/**
* Gets the value of the channels property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the channels property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getChannels().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link PodcastChannel }
*/
public List<PodcastChannel> getChannels() { public List<PodcastChannel> getChannels() {
if (channels == null) { if (channels == null) {
channels = new ArrayList<>(); channels = new ArrayList<>();
} }
return this.channels; return this.channels;
} }
public void setChannels(List<PodcastChannel> channels) {
this.channels = channels;
}
} }

View file

@ -28,6 +28,7 @@ public class SubsonicResponse {
private PlayQueue playQueue; private PlayQueue playQueue;
private Bookmarks bookmarks; private Bookmarks bookmarks;
private InternetRadioStations internetRadioStations; private InternetRadioStations internetRadioStations;
@Element(name = "newestPodcasts")
private NewestPodcasts newestPodcasts; private NewestPodcasts newestPodcasts;
private Podcasts podcasts; private Podcasts podcasts;
@Element(name = "lyrics") @Element(name = "lyrics")