Add audio track locale info.

This commit is contained in:
Kavin 2023-05-05 21:30:13 +01:00
parent 8596211445
commit 32db19956b
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 java.util.List;
import java.util.Locale;
import java.util.Optional;
import static me.kavin.piped.utils.URLUtils.*;
@ -54,7 +55,8 @@ public class CollectionUtils {
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(),
Optional.ofNullable(stream.getAudioTrackType()).map(Enum::name).orElse(null)
Optional.ofNullable(stream.getAudioTrackType()).map(Enum::name).orElse(null),
Optional.ofNullable(stream.getAudioLocale()).map(Locale::toLanguageTag).orElse(null)
)));
}

View file

@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class PipedStream {
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType;
public String url, format, quality, mimeType, codec, audioTrackId, audioTrackName, audioTrackType, audioTrackLocale;
public boolean videoOnly;
public int bitrate, initStart, initEnd, indexStart, indexEnd, width, height, fps;
@ -19,7 +19,8 @@ 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, String audioTrackType) {
int initStart, int initEnd, int indexStart, int indexEnd, String codec, String audioTrackId,
String audioTrackName, String audioTrackType, String audioTrackLocale) {
this.url = url;
this.format = format;
this.quality = quality;
@ -34,6 +35,7 @@ public class PipedStream {
this.audioTrackId = audioTrackId;
this.audioTrackName = audioTrackName;
this.audioTrackType = audioTrackType;
this.audioTrackLocale = audioTrackLocale;
}
public PipedStream(String url, String format, String quality, String mimeType, boolean videoOnly, int bitrate,