From 712985ced11da560bb1fed80bf401be070f0c8f4 Mon Sep 17 00:00:00 2001 From: ktprograms Date: Mon, 16 Aug 2021 08:08:50 +0800 Subject: [PATCH] Save uploader url when adding from PlayQueueItem --- .../newpipe/database/stream/model/StreamEntity.kt | 3 +-- .../newpipe/player/playqueue/PlayQueueItem.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt b/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt index 5bf1ec7db..c56f91949 100644 --- a/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt +++ b/app/src/main/java/org/schabi/newpipe/database/stream/model/StreamEntity.kt @@ -12,7 +12,6 @@ import org.schabi.newpipe.extractor.localization.DateWrapper import org.schabi.newpipe.extractor.stream.StreamInfo import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.extractor.stream.StreamType -import org.schabi.newpipe.extractor.utils.Utils.EMPTY_STRING import org.schabi.newpipe.player.playqueue.PlayQueueItem import java.io.Serializable import java.time.OffsetDateTime @@ -86,7 +85,7 @@ data class StreamEntity( constructor(item: PlayQueueItem) : this( serviceId = item.serviceId, url = item.url, title = item.title, streamType = item.streamType, duration = item.duration, uploader = item.uploader, - uploaderUrl = EMPTY_STRING, thumbnailUrl = item.thumbnailUrl + uploaderUrl = item.uploaderUrl, thumbnailUrl = item.thumbnailUrl ) fun toStreamInfoItem(): StreamInfoItem { diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java index 182a91e59..f7dfc562e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java @@ -27,6 +27,7 @@ public class PlayQueueItem implements Serializable { private final String thumbnailUrl; @NonNull private final String uploader; + private final String uploaderUrl; @NonNull private final StreamType streamType; @@ -37,7 +38,8 @@ public class PlayQueueItem implements Serializable { PlayQueueItem(@NonNull final StreamInfo info) { this(info.getName(), info.getUrl(), info.getServiceId(), info.getDuration(), - info.getThumbnailUrl(), info.getUploaderName(), info.getStreamType()); + info.getThumbnailUrl(), info.getUploaderName(), + info.getUploaderUrl(), info.getStreamType()); if (info.getStartPosition() > 0) { setRecoveryPosition(info.getStartPosition() * 1000); @@ -46,19 +48,21 @@ public class PlayQueueItem implements Serializable { PlayQueueItem(@NonNull final StreamInfoItem item) { this(item.getName(), item.getUrl(), item.getServiceId(), item.getDuration(), - item.getThumbnailUrl(), item.getUploaderName(), item.getStreamType()); + item.getThumbnailUrl(), item.getUploaderName(), + item.getUploaderUrl(), item.getStreamType()); } private PlayQueueItem(@Nullable final String name, @Nullable final String url, final int serviceId, final long duration, @Nullable final String thumbnailUrl, @Nullable final String uploader, - @NonNull final StreamType streamType) { + final String uploaderUrl, @NonNull final StreamType streamType) { this.title = name != null ? name : EMPTY_STRING; this.url = url != null ? url : EMPTY_STRING; this.serviceId = serviceId; this.duration = duration; this.thumbnailUrl = thumbnailUrl != null ? thumbnailUrl : EMPTY_STRING; this.uploader = uploader != null ? uploader : EMPTY_STRING; + this.uploaderUrl = uploaderUrl; this.streamType = streamType; this.recoveryPosition = RECOVERY_UNSET; @@ -92,6 +96,10 @@ public class PlayQueueItem implements Serializable { return uploader; } + public String getUploaderUrl() { + return uploaderUrl; + } + @NonNull public StreamType getStreamType() { return streamType;