mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 02:53:09 +01:00
Add support for secondary audio track type
This commit is contained in:
parent
a962e6d633
commit
1f634770f1
@ -48,10 +48,12 @@ public final class ListHelper {
|
|||||||
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
|
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
|
||||||
// Audio track types in order of priority. 0=lowest, n=highest
|
// Audio track types in order of priority. 0=lowest, n=highest
|
||||||
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING =
|
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING =
|
||||||
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.DUBBED, AudioTrackType.ORIGINAL);
|
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.SECONDARY, AudioTrackType.DUBBED,
|
||||||
|
AudioTrackType.ORIGINAL);
|
||||||
// Audio track types in order of priority when descriptive audio is preferred.
|
// Audio track types in order of priority when descriptive audio is preferred.
|
||||||
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING_DESCRIPTIVE =
|
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING_DESCRIPTIVE =
|
||||||
List.of(AudioTrackType.ORIGINAL, AudioTrackType.DUBBED, AudioTrackType.DESCRIPTIVE);
|
List.of(AudioTrackType.ORIGINAL, AudioTrackType.DUBBED, AudioTrackType.SECONDARY,
|
||||||
|
AudioTrackType.DESCRIPTIVE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of supported YouTube Itag ids.
|
* List of supported YouTube Itag ids.
|
||||||
|
@ -342,25 +342,20 @@ public final class Localization {
|
|||||||
|
|
||||||
if (track.getAudioTrackType() != null) {
|
if (track.getAudioTrackType() != null) {
|
||||||
final String trackType = audioTrackType(context, track.getAudioTrackType());
|
final String trackType = audioTrackType(context, track.getAudioTrackType());
|
||||||
if (trackType != null) {
|
return context.getString(R.string.audio_track_name, name, trackType);
|
||||||
return context.getString(R.string.audio_track_name, name, trackType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@NonNull
|
||||||
private static String audioTrackType(@NonNull final Context context,
|
private static String audioTrackType(@NonNull final Context context,
|
||||||
final AudioTrackType trackType) {
|
@NonNull final AudioTrackType trackType) {
|
||||||
switch (trackType) {
|
return switch (trackType) {
|
||||||
case ORIGINAL:
|
case ORIGINAL -> context.getString(R.string.audio_track_type_original);
|
||||||
return context.getString(R.string.audio_track_type_original);
|
case DUBBED -> context.getString(R.string.audio_track_type_dubbed);
|
||||||
case DUBBED:
|
case DESCRIPTIVE -> context.getString(R.string.audio_track_type_descriptive);
|
||||||
return context.getString(R.string.audio_track_type_dubbed);
|
case SECONDARY -> context.getString(R.string.audio_track_type_secondary);
|
||||||
case DESCRIPTIVE:
|
};
|
||||||
return context.getString(R.string.audio_track_type_descriptive);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -816,6 +816,7 @@
|
|||||||
<string name="audio_track_type_original">original</string>
|
<string name="audio_track_type_original">original</string>
|
||||||
<string name="audio_track_type_dubbed">dubbed</string>
|
<string name="audio_track_type_dubbed">dubbed</string>
|
||||||
<string name="audio_track_type_descriptive">descriptive</string>
|
<string name="audio_track_type_descriptive">descriptive</string>
|
||||||
|
<string name="audio_track_type_secondary">secondary</string>
|
||||||
<string name="channel_tab_videos">Videos</string>
|
<string name="channel_tab_videos">Videos</string>
|
||||||
<string name="channel_tab_tracks">Tracks</string>
|
<string name="channel_tab_tracks">Tracks</string>
|
||||||
<string name="channel_tab_shorts">Shorts</string>
|
<string name="channel_tab_shorts">Shorts</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user