mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add support to extract preview frames.
This commit is contained in:
parent
262b5e07f2
commit
c7533ecc91
3 changed files with 31 additions and 5 deletions
|
@ -22,6 +22,11 @@ public class CollectionUtils {
|
|||
info.getStreamSegments().forEach(segment -> chapters.add(new ChapterSegment(segment.getTitle(), rewriteURL(segment.getPreviewUrl()),
|
||||
segment.getStartTimeSeconds())));
|
||||
|
||||
final List<PreviewFrames> previewFrames = new ObjectArrayList<>();
|
||||
|
||||
info.getPreviewFrames().forEach(frame -> new PreviewFrames(frame.getUrls(), frame.getFrameWidth(), frame.getFrameHeight(),
|
||||
frame.getTotalCount(), frame.getDurationPerFrame(), frame.getFramesPerPageX(), frame.getFramesPerPageY()));
|
||||
|
||||
info.getSubtitles()
|
||||
.forEach(subtitle -> subtitles.add(new Subtitle(rewriteURL(subtitle.getContent()),
|
||||
subtitle.getFormat().getMimeType(), subtitle.getDisplayLanguageName(),
|
||||
|
@ -51,14 +56,12 @@ public class CollectionUtils {
|
|||
|
||||
final List<ContentItem> relatedStreams = collectRelatedItems(info.getRelatedItems());
|
||||
|
||||
final Streams streams = new Streams(info.getName(), info.getDescription().getContent(),
|
||||
return new Streams(info.getName(), info.getDescription().getContent(),
|
||||
info.getTextualUploadDate(), info.getUploaderName(), substringYouTube(info.getUploaderUrl()),
|
||||
rewriteURL(info.getUploaderAvatarUrl()), rewriteURL(info.getThumbnailUrl()), info.getDuration(),
|
||||
info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), info.getUploaderSubscriberCount(), info.isUploaderVerified(),
|
||||
audioStreams, videoStreams, relatedStreams, subtitles, livestream, rewriteVideoURL(info.getHlsUrl()),
|
||||
rewriteVideoURL(info.getDashMpdUrl()), null, chapters);
|
||||
|
||||
return streams;
|
||||
rewriteVideoURL(info.getDashMpdUrl()), null, chapters, previewFrames);
|
||||
}
|
||||
|
||||
public static List<ContentItem> collectRelatedItems(List<? extends InfoItem> items) {
|
||||
|
|
20
src/main/java/me/kavin/piped/utils/obj/PreviewFrames.java
Normal file
20
src/main/java/me/kavin/piped/utils/obj/PreviewFrames.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package me.kavin.piped.utils.obj;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PreviewFrames {
|
||||
|
||||
public List<String> urls;
|
||||
public int frameWidth;
|
||||
public int frameHeight;
|
||||
public int totalCount;
|
||||
public int durationPerFrame;
|
||||
public int framesPerPageX;
|
||||
public int framesPerPageY;
|
||||
|
||||
}
|
|
@ -27,11 +27,13 @@ public class Streams {
|
|||
|
||||
public List<ChapterSegment> chapters;
|
||||
|
||||
public List<PreviewFrames> previewFrames;
|
||||
|
||||
public Streams(String title, String description, String uploadDate, String uploader, String uploaderUrl,
|
||||
String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes, long uploaderSubscriberCount,
|
||||
boolean uploaderVerified, List<PipedStream> audioStreams, List<PipedStream> videoStreams,
|
||||
List<ContentItem> relatedStreams, List<Subtitle> subtitles, boolean livestream, String hls, String dash,
|
||||
String lbryId, List<ChapterSegment> chapters) {
|
||||
String lbryId, List<ChapterSegment> chapters, List<PreviewFrames> previewFrames) {
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
this.uploadDate = uploadDate;
|
||||
|
@ -54,5 +56,6 @@ public class Streams {
|
|||
this.dash = dash;
|
||||
this.lbryId = lbryId;
|
||||
this.chapters = chapters;
|
||||
this.previewFrames = previewFrames;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue