Add itags to the streams api.

This commit is contained in:
Kavin 2023-06-10 22:31:57 +01:00
parent 5d316597e7
commit 9fd20dd7b1
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
3 changed files with 13 additions and 10 deletions

View file

@ -214,7 +214,7 @@ public class StreamHandlers {
}
if (lbryURL != null)
streams.videoStreams.add(0, new PipedStream(lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
streams.videoStreams.add(0, new PipedStream(-1, lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
// Attempt to get dislikes calculating with the RYD API rating
if (streams.dislikes < 0 && streams.likes >= 0) {
@ -260,10 +260,10 @@ public class StreamHandlers {
}
if (lbryHlsURL != null)
streams.videoStreams.add(0, new PipedStream(lbryHlsURL, "HLS", "LBRY HLS", "application/x-mpegurl", false, -1));
streams.videoStreams.add(0, new PipedStream(-1, lbryHlsURL, "HLS", "LBRY HLS", "application/x-mpegurl", false, -1));
if (lbryURL != null)
streams.videoStreams.add(0, new PipedStream(lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
streams.videoStreams.add(0, new PipedStream(-1, lbryURL, "MP4", "LBRY", "video/mp4", false, -1));
long time = info.getUploadDate() != null ? info.getUploadDate().offsetDateTime().toInstant().toEpochMilli()
: System.currentTimeMillis();

View file

@ -45,17 +45,17 @@ public class CollectionUtils {
boolean livestream = info.getStreamType() == StreamType.LIVE_STREAM;
if (!livestream) {
info.getVideoOnlyStreams().forEach(stream -> videoStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()),
info.getVideoOnlyStreams().forEach(stream -> videoStreams.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()),
String.valueOf(stream.getFormat()), stream.getResolution(), stream.getFormat().getMimeType(), true,
stream.getBitrate(), stream.getInitStart(), stream.getInitEnd(), stream.getIndexStart(),
stream.getIndexEnd(), stream.getCodec(), stream.getWidth(), stream.getHeight(), stream.getFps(), stream.getItagItem().getContentLength())));
info.getVideoStreams()
.forEach(stream -> videoStreams
.add(new PipedStream(rewriteVideoURL(stream.getContent()), String.valueOf(stream.getFormat()),
.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()), String.valueOf(stream.getFormat()),
stream.getResolution(), stream.getFormat().getMimeType(), false, stream.getItagItem().getContentLength())));
info.getAudioStreams()
.forEach(stream -> audioStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()),
.forEach(stream -> audioStreams.add(new PipedStream(stream.getItag(), rewriteVideoURL(stream.getContent()),
String.valueOf(stream.getFormat()), stream.getAverageBitrate() + " kbps",
stream.getFormat().getMimeType(), false, stream.getBitrate(), stream.getInitStart(),
stream.getInitEnd(), stream.getIndexStart(), stream.getIndexEnd(), stream.getItagItem().getContentLength(), stream.getCodec(), stream.getAudioTrackId(),

View file

@ -8,11 +8,12 @@ public class PipedStream {
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType, audioTrackLocale;
public boolean videoOnly;
public int bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
public int itag, bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
public long contentLength;
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, long contentLength) {
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, long contentLength) {
this.itag = itag;
this.url = url;
this.format = format;
this.quality = quality;
@ -21,9 +22,10 @@ public class PipedStream {
this.contentLength = contentLength;
}
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
int initStart, int initEnd, int indexStart, int indexEnd, long contentLength, String codec,
String audioTrackId, String audioTrackName, String audioTrackType, String audioTrackLocale) {
this.itag = itag;
this.url = url;
this.format = format;
this.quality = quality;
@ -42,8 +44,9 @@ public class PipedStream {
this.audioTrackLocale = audioTrackLocale;
}
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
public PipedStream(int itag, String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
int initStart, int initEnd, int indexStart, int indexEnd, String codec, int width, int height, int fps, long contentLength) {
this.itag = itag;
this.url = url;
this.format = format;
this.quality = quality;