mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Unify video/StreamInfoItem in Search Results.
This commit is contained in:
parent
1524085577
commit
0fe215ea67
2 changed files with 12 additions and 13 deletions
|
@ -83,9 +83,7 @@ import me.kavin.piped.utils.obj.db.PubSub;
|
||||||
import me.kavin.piped.utils.obj.db.User;
|
import me.kavin.piped.utils.obj.db.User;
|
||||||
import me.kavin.piped.utils.obj.db.Video;
|
import me.kavin.piped.utils.obj.db.Video;
|
||||||
import me.kavin.piped.utils.obj.search.SearchChannel;
|
import me.kavin.piped.utils.obj.search.SearchChannel;
|
||||||
import me.kavin.piped.utils.obj.search.SearchItem;
|
|
||||||
import me.kavin.piped.utils.obj.search.SearchPlaylist;
|
import me.kavin.piped.utils.obj.search.SearchPlaylist;
|
||||||
import me.kavin.piped.utils.obj.search.SearchStream;
|
|
||||||
import me.kavin.piped.utils.resp.AcceptedResponse;
|
import me.kavin.piped.utils.resp.AcceptedResponse;
|
||||||
import me.kavin.piped.utils.resp.AlreadyRegisteredResponse;
|
import me.kavin.piped.utils.resp.AlreadyRegisteredResponse;
|
||||||
import me.kavin.piped.utils.resp.AuthenticationFailureResponse;
|
import me.kavin.piped.utils.resp.AuthenticationFailureResponse;
|
||||||
|
@ -417,15 +415,16 @@ public class ResponseHelper {
|
||||||
final SearchInfo info = SearchInfo.getInfo(Constants.YOUTUBE_SERVICE,
|
final SearchInfo info = SearchInfo.getInfo(Constants.YOUTUBE_SERVICE,
|
||||||
Constants.YOUTUBE_SERVICE.getSearchQHFactory().fromQuery(q, Collections.singletonList(filter), null));
|
Constants.YOUTUBE_SERVICE.getSearchQHFactory().fromQuery(q, Collections.singletonList(filter), null));
|
||||||
|
|
||||||
ObjectArrayList<SearchItem> items = new ObjectArrayList<>();
|
ObjectArrayList<Object> items = new ObjectArrayList<>();
|
||||||
|
|
||||||
info.getRelatedItems().forEach(item -> {
|
info.getRelatedItems().forEach(item -> {
|
||||||
switch (item.getInfoType()) {
|
switch (item.getInfoType()) {
|
||||||
case STREAM:
|
case STREAM:
|
||||||
StreamInfoItem stream = (StreamInfoItem) item;
|
StreamInfoItem stream = (StreamInfoItem) item;
|
||||||
items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()),
|
items.add(new StreamItem(stream.getUrl().substring(23), stream.getName(),
|
||||||
item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getUploaderName(),
|
rewriteURL(stream.getThumbnailUrl()), stream.getUploaderName(),
|
||||||
optionalSubstring(stream.getUploaderUrl(), 23), stream.getViewCount(), stream.getDuration(),
|
stream.getUploaderUrl().substring(23), rewriteURL(stream.getUploaderAvatarUrl()),
|
||||||
|
stream.getTextualUploadDate(), stream.getDuration(), stream.getViewCount(),
|
||||||
stream.isUploaderVerified()));
|
stream.isUploaderVerified()));
|
||||||
break;
|
break;
|
||||||
case CHANNEL:
|
case CHANNEL:
|
||||||
|
@ -460,15 +459,16 @@ public class ResponseHelper {
|
||||||
Constants.YOUTUBE_SERVICE.getSearchQHFactory().fromQuery(q, Collections.singletonList(filter), null),
|
Constants.YOUTUBE_SERVICE.getSearchQHFactory().fromQuery(q, Collections.singletonList(filter), null),
|
||||||
prevpage);
|
prevpage);
|
||||||
|
|
||||||
ObjectArrayList<SearchItem> items = new ObjectArrayList<>();
|
ObjectArrayList<Object> items = new ObjectArrayList<>();
|
||||||
|
|
||||||
pages.getItems().forEach(item -> {
|
pages.getItems().forEach(item -> {
|
||||||
switch (item.getInfoType()) {
|
switch (item.getInfoType()) {
|
||||||
case STREAM:
|
case STREAM:
|
||||||
StreamInfoItem stream = (StreamInfoItem) item;
|
StreamInfoItem stream = (StreamInfoItem) item;
|
||||||
items.add(new SearchStream(item.getName(), rewriteURL(item.getThumbnailUrl()),
|
items.add(new StreamItem(stream.getUrl().substring(23), stream.getName(),
|
||||||
item.getUrl().substring(23), stream.getTextualUploadDate(), stream.getUploaderName(),
|
rewriteURL(stream.getThumbnailUrl()), stream.getUploaderName(),
|
||||||
optionalSubstring(stream.getUploaderUrl(), 23), stream.getViewCount(), stream.getDuration(),
|
stream.getUploaderUrl().substring(23), rewriteURL(stream.getUploaderAvatarUrl()),
|
||||||
|
stream.getTextualUploadDate(), stream.getDuration(), stream.getViewCount(),
|
||||||
stream.isUploaderVerified()));
|
stream.isUploaderVerified()));
|
||||||
break;
|
break;
|
||||||
case CHANNEL:
|
case CHANNEL:
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package me.kavin.piped.utils.obj;
|
package me.kavin.piped.utils.obj;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import me.kavin.piped.utils.obj.search.SearchItem;
|
|
||||||
|
|
||||||
public class SearchResults {
|
public class SearchResults {
|
||||||
|
|
||||||
public ObjectArrayList<SearchItem> items;
|
public ObjectArrayList<Object> items;
|
||||||
public String nextpage;
|
public String nextpage;
|
||||||
|
|
||||||
public SearchResults(ObjectArrayList<SearchItem> items, String nextpage) {
|
public SearchResults(ObjectArrayList<Object> items, String nextpage) {
|
||||||
this.nextpage = nextpage;
|
this.nextpage = nextpage;
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue