Add audio track type field.

This commit is contained in:
Kavin 2023-05-04 20:38:29 +01:00
parent 8614e6a0d8
commit c7fab90f66
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 7 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.stream.StreamType;
import java.util.List; import java.util.List;
import java.util.Optional;
import static me.kavin.piped.utils.URLUtils.*; import static me.kavin.piped.utils.URLUtils.*;
@ -52,7 +53,9 @@ public class CollectionUtils {
.forEach(stream -> audioStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()), .forEach(stream -> audioStreams.add(new PipedStream(rewriteVideoURL(stream.getContent()),
String.valueOf(stream.getFormat()), stream.getAverageBitrate() + " kbps", String.valueOf(stream.getFormat()), stream.getAverageBitrate() + " kbps",
stream.getFormat().getMimeType(), false, stream.getBitrate(), stream.getInitStart(), stream.getFormat().getMimeType(), false, stream.getBitrate(), stream.getInitStart(),
stream.getInitEnd(), stream.getIndexStart(), stream.getIndexEnd(), stream.getCodec(), stream.getAudioTrackId(), stream.getAudioTrackName()))); stream.getInitEnd(), stream.getIndexStart(), stream.getIndexEnd(), stream.getCodec(), stream.getAudioTrackId(), stream.getAudioTrackName(),
Optional.ofNullable(stream.getAudioTrackType()).map(Enum::name).orElse(null)
)));
} }
final List<ContentItem> relatedStreams = collectRelatedItems(info.getRelatedItems()); final List<ContentItem> relatedStreams = collectRelatedItems(info.getRelatedItems());

View File

@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor @NoArgsConstructor
public class PipedStream { public class PipedStream {
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName; public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType;
public boolean videoOnly; public boolean videoOnly;
public int bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps; public int bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
@ -19,7 +19,7 @@ public class PipedStream {
} }
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate, public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,
int initStart, int initEnd, int indexStart, int indexEnd, String codec, String audioTrackId, String audioTrackName) { int initStart, int initEnd, int indexStart, int indexEnd, String codec, String audioTrackId, String audioTrackName, String audioTrackType) {
this.url = url; this.url = url;
this.format = format; this.format = format;
this.quality = quality; this.quality = quality;
@ -33,6 +33,7 @@ public class PipedStream {
this.codec = codec; this.codec = codec;
this.audioTrackId = audioTrackId; this.audioTrackId = audioTrackId;
this.audioTrackName = audioTrackName; this.audioTrackName = audioTrackName;
this.audioTrackType = audioTrackType;
} }
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate, public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,