Merge pull request #584 from TeamPiped/audio-track-field

Add audio track type field.
This commit is contained in:
Kavin 2023-05-04 20:39:29 +01:00 committed by GitHub
commit 8596211445
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 java.util.List;
import java.util.Optional;
import static me.kavin.piped.utils.URLUtils.*;
@ -52,7 +53,9 @@ public class CollectionUtils {
.forEach(stream -> audioStreams.add(new PipedStream(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.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());

View file

@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
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 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,
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.format = format;
this.quality = quality;
@ -33,6 +33,7 @@ public class PipedStream {
this.codec = codec;
this.audioTrackId = audioTrackId;
this.audioTrackName = audioTrackName;
this.audioTrackType = audioTrackType;
}
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,