mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
[MediaCCC] Extract audio language property for single language audio tracks
This commit is contained in:
parent
7f0269c4c7
commit
30a0f8c510
@ -24,6 +24,7 @@ import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
|||||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||||
import org.schabi.newpipe.extractor.utils.JsonUtils;
|
import org.schabi.newpipe.extractor.utils.JsonUtils;
|
||||||
|
import org.schabi.newpipe.extractor.utils.LocaleCompat;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -114,15 +115,24 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
|
|||||||
mediaFormat = null;
|
mediaFormat = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not checking containsSimilarStream here, since MediaCCC does not provide enough
|
final AudioStream.Builder builder = new AudioStream.Builder()
|
||||||
// information to decide whether two streams are similar. Hence that method would
|
|
||||||
// always return false, e.g. even for different language variations.
|
|
||||||
audioStreams.add(new AudioStream.Builder()
|
|
||||||
.setId(recording.getString("filename", ID_UNKNOWN))
|
.setId(recording.getString("filename", ID_UNKNOWN))
|
||||||
.setContent(recording.getString("recording_url"), true)
|
.setContent(recording.getString("recording_url"), true)
|
||||||
.setMediaFormat(mediaFormat)
|
.setMediaFormat(mediaFormat)
|
||||||
.setAverageBitrate(UNKNOWN_BITRATE)
|
.setAverageBitrate(UNKNOWN_BITRATE);
|
||||||
.build());
|
|
||||||
|
final String language = recording.getString("language");
|
||||||
|
// If the language contains a - symbol, this means that the stream has an audio
|
||||||
|
// track with multiple languages, so there is no specific language for this stream
|
||||||
|
// Don't set the audio language in this case
|
||||||
|
if (language != null && !language.contains("-")) {
|
||||||
|
builder.setAudioLocale(LocaleCompat.forLanguageTag(language));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not checking containsSimilarStream here, since MediaCCC does not provide enough
|
||||||
|
// information to decide whether two streams are similar. Hence that method would
|
||||||
|
// always return false, e.g. even for different language variations.
|
||||||
|
audioStreams.add(builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return audioStreams;
|
return audioStreams;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user