fix: audio stream cache key, code fmt

This commit is contained in:
ThetaDev 2023-05-01 00:04:04 +02:00
parent 4e837e838d
commit 22671ca16c
4 changed files with 12 additions and 6 deletions

View file

@ -470,9 +470,7 @@ public class DownloadDialog extends DialogFragment
dialogBinding.audioTrackSpinner.setVisibility(
isVideoOnly && wrappedAudioTracks.size() > 1 ? View.VISIBLE : View.GONE);
dialogBinding.defaultAudioTrackPresentText.setVisibility(
!isVideoOnly && wrappedAudioTracks.size() > 1 ? View.VISIBLE : View.GONE
);
!isVideoOnly && wrappedAudioTracks.size() > 1 ? View.VISIBLE : View.GONE);
}
private void setupSubtitleSpinner() {

View file

@ -161,6 +161,11 @@ public interface PlaybackResolver extends Resolver<StreamInfo, MediaSource> {
cacheKey.append(audioStream.getAudioTrackId());
}
if (audioStream.getAudioLocale() != null) {
cacheKey.append(" ");
cacheKey.append(audioStream.getAudioLocale().getISO3Language());
}
return cacheKey.toString();
}

View file

@ -797,7 +797,8 @@ public final class ListHelper {
* @return Comparator
*/
static Comparator<AudioStream> getAudioTrackComparator(
final Locale preferredLanguage, final boolean preferOriginalAudio,
final Locale preferredLanguage,
final boolean preferOriginalAudio,
final boolean preferDescriptiveAudio) {
final String langCode = preferredLanguage.getISO3Language();
final List<AudioTrackType> trackTypeRanking = preferDescriptiveAudio

View file

@ -451,8 +451,10 @@ public class ListHelperTest {
}
private static AudioStream generateAudioTrack(
@NonNull final String id, @Nullable final String trackId,
@Nullable final Locale locale, @Nullable final AudioTrackType trackType) {
@NonNull final String id,
@Nullable final String trackId,
@Nullable final Locale locale,
@Nullable final AudioTrackType trackType) {
return new AudioStream.Builder()
.setId(id)
.setContent("", true)