diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2021-03-27 12:19:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 12:19:48 +0100 |
commit | b16868521a112330c3dd3f4d61007a0563a6ea90 (patch) | |
tree | 677ead2a03e5e4537d9b21216606e6827c471b6f | |
parent | 3452bc50d40e183bac1c0e700a7fb2b8e03b61b0 (diff) | |
parent | 68e70d1b6bf824bd8803c66f7c5a9aee3a9edfe3 (diff) | |
download | AntennaPod-b16868521a112330c3dd3f4d61007a0563a6ea90.zip |
Merge pull request #5054 from ByteHamster/always-update-cover
Better metadata for previewed episodes
3 files changed, 26 insertions, 27 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index d8c382cb2..5cb44655e 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -23,7 +23,6 @@ import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.request.RequestOptions; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.event.PlaybackPositionEvent; -import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.util.ChapterUtils; @@ -94,7 +93,7 @@ public class CoverFragment extends Fragment { } private void displayMediaInfo(@NonNull Playable media) { - String pubDateStr = DateUtils.formatAbbrev(getActivity(), ((FeedMedia) media).getPubDate()); + String pubDateStr = DateUtils.formatAbbrev(getActivity(), media.getPubDate()); txtvPodcastTitle.setText(StringUtils.stripToEmpty(media.getFeedTitle()) + "\u00A0" + "・" diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java index 7de1a7812..5a9afaeaf 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java @@ -27,18 +27,18 @@ public class RemoteMedia implements Playable { public static final int PLAYABLE_TYPE_REMOTE_MEDIA = 3; - private String downloadUrl; - private String itemIdentifier; - private String feedUrl; - private String feedTitle; - private String episodeTitle; - private String episodeLink; - private String feedAuthor; - private String imageUrl; - private String feedLink; - private String mimeType; - private Date pubDate; - private String notes; + private final String downloadUrl; + private final String itemIdentifier; + private final String feedUrl; + private final String feedTitle; + private final String episodeTitle; + private final String episodeLink; + private final String feedAuthor; + private final String imageUrl; + private final String feedLink; + private final String mimeType; + private final Date pubDate; + private final String notes; private List<Chapter> chapters; private int duration; private int position; @@ -46,7 +46,8 @@ public class RemoteMedia implements Playable { public RemoteMedia(String downloadUrl, String itemId, String feedUrl, String feedTitle, 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.itemIdentifier = itemId; this.feedUrl = feedUrl; @@ -58,6 +59,7 @@ public class RemoteMedia implements Playable { this.feedLink = feedLink; this.mimeType = mimeType; this.pubDate = pubDate; + this.notes = notes; } public RemoteMedia(FeedItem item) { @@ -68,14 +70,15 @@ public class RemoteMedia implements Playable { this.episodeTitle = item.getTitle(); this.episodeLink = item.getLink(); 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.mimeType = item.getMedia().getMime_type(); this.pubDate = item.getPubDate(); - } - - public void setNotes(String notes) { - this.notes = notes; + this.notes = item.getDescription(); } public String getEpisodeIdentifier() { @@ -294,8 +297,7 @@ public class RemoteMedia implements Playable { public RemoteMedia createFromParcel(Parcel in) { RemoteMedia result = new RemoteMedia(in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), - in.readString(), in.readString(), new Date(in.readLong())); - result.setNotes(in.readString()); + in.readString(), in.readString(), new Date(in.readLong()), in.readString()); result.setDuration(in.readInt()); result.setPosition(in.readInt()); result.setLastPlayedTime(in.readLong()); diff --git a/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java b/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java index ab638b568..2c9772298 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java +++ b/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java @@ -225,6 +225,7 @@ public class CastUtils { if (!imageList.isEmpty()) { imageUrl = imageList.get(0).getUrl().toString(); } + String notes = metadata.getString(KEY_EPISODE_NOTES); result = new RemoteMedia(media.getContentId(), metadata.getString(KEY_EPISODE_IDENTIFIER), metadata.getString(KEY_FEED_URL), @@ -235,11 +236,8 @@ public class CastUtils { imageUrl, metadata.getString(KEY_FEED_WEBSITE), media.getContentType(), - metadata.getDate(MediaMetadata.KEY_RELEASE_DATE).getTime()); - String notes = metadata.getString(KEY_EPISODE_NOTES); - if (!TextUtils.isEmpty(notes)) { - ((RemoteMedia) result).setNotes(notes); - } + metadata.getDate(MediaMetadata.KEY_RELEASE_DATE).getTime(), + notes); Log.d(TAG, "Converted MediaInfo into RemoteMedia"); } if (result.getDuration() == 0 && media.getStreamDuration() > 0) { |