From d9a84215d72cb1a4d7cbfc96cd320fa81b7a91f6 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:26:33 +0530 Subject: [PATCH] Implement uploaded date in search. --- src/main/java/me/kavin/piped/utils/ResponseHelper.java | 6 ++++-- .../me/kavin/piped/utils/obj/search/SearchStream.java | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/ResponseHelper.java b/src/main/java/me/kavin/piped/utils/ResponseHelper.java index 6bb8dba..7e25b0d 100644 --- a/src/main/java/me/kavin/piped/utils/ResponseHelper.java +++ b/src/main/java/me/kavin/piped/utils/ResponseHelper.java @@ -309,7 +309,8 @@ public class ResponseHelper { case STREAM: StreamInfoItem stream = (StreamInfoItem) item; items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()), - item.getUrl().substring(23), stream.getViewCount(), stream.getDuration())); + item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getViewCount(), + stream.getDuration())); break; case CHANNEL: items.add(new SearchItem(item.getName(), rewriteURL(item.getThumbnailUrl()), @@ -341,7 +342,8 @@ public class ResponseHelper { case STREAM: StreamInfoItem stream = (StreamInfoItem) item; items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()), - item.getUrl().substring(23), stream.getViewCount(), stream.getDuration())); + item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getViewCount(), + stream.getDuration())); break; case CHANNEL: items.add(new SearchItem(item.getName(), rewriteURL(item.getThumbnailUrl()), diff --git a/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java b/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java index 839d56f..e1cb4ff 100644 --- a/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java +++ b/src/main/java/me/kavin/piped/utils/obj/search/SearchStream.java @@ -2,14 +2,20 @@ package me.kavin.piped.utils.obj.search; public class SearchStream extends SearchItem { + private String uploadDate; private long views, duration; - public SearchStream(String name, String thumbnail, String url, long views, long duration) { + public SearchStream(String name, String thumbnail, String url, String uploadDate, long views, long duration) { super(name, thumbnail, url); + this.uploadDate = uploadDate; this.views = views; this.duration = duration; } + public String getUploadDate() { + return uploadDate; + } + public long getViews() { return views; }