Show cover and shownotes for previewed episodes

This commit is contained in:
ByteHamster 2021-03-26 18:32:04 +01:00
parent 4941818b6f
commit 68e70d1b6b
2 changed files with 25 additions and 25 deletions

View File

@ -27,18 +27,18 @@ public class RemoteMedia implements Playable {
public static final int PLAYABLE_TYPE_REMOTE_MEDIA = 3; public static final int PLAYABLE_TYPE_REMOTE_MEDIA = 3;
private String downloadUrl; private final String downloadUrl;
private String itemIdentifier; private final String itemIdentifier;
private String feedUrl; private final String feedUrl;
private String feedTitle; private final String feedTitle;
private String episodeTitle; private final String episodeTitle;
private String episodeLink; private final String episodeLink;
private String feedAuthor; private final String feedAuthor;
private String imageUrl; private final String imageUrl;
private String feedLink; private final String feedLink;
private String mimeType; private final String mimeType;
private Date pubDate; private final Date pubDate;
private String notes; private final String notes;
private List<Chapter> chapters; private List<Chapter> chapters;
private int duration; private int duration;
private int position; private int position;
@ -46,7 +46,8 @@ public class RemoteMedia implements Playable {
public RemoteMedia(String downloadUrl, String itemId, String feedUrl, String feedTitle, public RemoteMedia(String downloadUrl, String itemId, String feedUrl, String feedTitle,
String episodeTitle, String episodeLink, String feedAuthor, String episodeTitle, String episodeLink, String feedAuthor,
String imageUrl, String feedLink, String mimeType, Date pubDate) { String imageUrl, String feedLink, String mimeType, Date pubDate,
String notes) {
this.downloadUrl = downloadUrl; this.downloadUrl = downloadUrl;
this.itemIdentifier = itemId; this.itemIdentifier = itemId;
this.feedUrl = feedUrl; this.feedUrl = feedUrl;
@ -58,6 +59,7 @@ public class RemoteMedia implements Playable {
this.feedLink = feedLink; this.feedLink = feedLink;
this.mimeType = mimeType; this.mimeType = mimeType;
this.pubDate = pubDate; this.pubDate = pubDate;
this.notes = notes;
} }
public RemoteMedia(FeedItem item) { public RemoteMedia(FeedItem item) {
@ -68,14 +70,15 @@ public class RemoteMedia implements Playable {
this.episodeTitle = item.getTitle(); this.episodeTitle = item.getTitle();
this.episodeLink = item.getLink(); this.episodeLink = item.getLink();
this.feedAuthor = item.getFeed().getAuthor(); this.feedAuthor = item.getFeed().getAuthor();
this.imageUrl = item.getImageUrl(); if (!TextUtils.isEmpty(item.getImageUrl())) {
this.imageUrl = item.getImageUrl();
} else {
this.imageUrl = item.getFeed().getImageUrl();
}
this.feedLink = item.getFeed().getLink(); this.feedLink = item.getFeed().getLink();
this.mimeType = item.getMedia().getMime_type(); this.mimeType = item.getMedia().getMime_type();
this.pubDate = item.getPubDate(); this.pubDate = item.getPubDate();
} this.notes = item.getDescription();
public void setNotes(String notes) {
this.notes = notes;
} }
public String getEpisodeIdentifier() { public String getEpisodeIdentifier() {
@ -294,8 +297,7 @@ public class RemoteMedia implements Playable {
public RemoteMedia createFromParcel(Parcel in) { public RemoteMedia createFromParcel(Parcel in) {
RemoteMedia result = new RemoteMedia(in.readString(), in.readString(), in.readString(), RemoteMedia result = new RemoteMedia(in.readString(), in.readString(), in.readString(),
in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(),
in.readString(), in.readString(), new Date(in.readLong())); in.readString(), in.readString(), new Date(in.readLong()), in.readString());
result.setNotes(in.readString());
result.setDuration(in.readInt()); result.setDuration(in.readInt());
result.setPosition(in.readInt()); result.setPosition(in.readInt());
result.setLastPlayedTime(in.readLong()); result.setLastPlayedTime(in.readLong());

View File

@ -225,6 +225,7 @@ public class CastUtils {
if (!imageList.isEmpty()) { if (!imageList.isEmpty()) {
imageUrl = imageList.get(0).getUrl().toString(); imageUrl = imageList.get(0).getUrl().toString();
} }
String notes = metadata.getString(KEY_EPISODE_NOTES);
result = new RemoteMedia(media.getContentId(), result = new RemoteMedia(media.getContentId(),
metadata.getString(KEY_EPISODE_IDENTIFIER), metadata.getString(KEY_EPISODE_IDENTIFIER),
metadata.getString(KEY_FEED_URL), metadata.getString(KEY_FEED_URL),
@ -235,11 +236,8 @@ public class CastUtils {
imageUrl, imageUrl,
metadata.getString(KEY_FEED_WEBSITE), metadata.getString(KEY_FEED_WEBSITE),
media.getContentType(), media.getContentType(),
metadata.getDate(MediaMetadata.KEY_RELEASE_DATE).getTime()); metadata.getDate(MediaMetadata.KEY_RELEASE_DATE).getTime(),
String notes = metadata.getString(KEY_EPISODE_NOTES); notes);
if (!TextUtils.isEmpty(notes)) {
((RemoteMedia) result).setNotes(notes);
}
Log.d(TAG, "Converted MediaInfo into RemoteMedia"); Log.d(TAG, "Converted MediaInfo into RemoteMedia");
} }
if (result.getDuration() == 0 && media.getStreamDuration() > 0) { if (result.getDuration() == 0 && media.getStreamDuration() > 0) {