mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-21 23:38:50 -05:00
Use both "Channel(s)_Original" or "Channel(s)" just use the first one that actually has a valid value.
https://www.filebot.net/forums/viewtopic.php?f=5&t=10773&p=43876#p43869
This commit is contained in:
parent
570e5ecbee
commit
7b6d154392
@ -398,16 +398,16 @@ public class MediaBindingBean {
|
||||
|
||||
@Define("channels")
|
||||
public String getAudioChannelPositions() {
|
||||
String channels = getMediaInfo(StreamKind.Audio, 0, "ChannelPositions/String2", "Channel(s)_Original", "Channel(s)");
|
||||
|
||||
// e.g. ChannelPositions/String2: 3/2/2.1 / 3/2/0.1 (one audio stream may contain multiple multi-channel streams)
|
||||
double d = tokenize(channels).mapToDouble(s -> {
|
||||
try {
|
||||
return tokenize(s, SLASH).mapToDouble(Double::parseDouble).reduce(0, (a, b) -> a + b);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}).filter(it -> it > 0).max().getAsDouble();
|
||||
double d = getMediaInfo(StreamKind.Audio, "ChannelPositions/String2", "Channel(s)_Original", "Channel(s)").map(channels -> {
|
||||
return tokenize(channels).mapToDouble(s -> {
|
||||
try {
|
||||
return tokenize(s, SLASH).mapToDouble(Double::parseDouble).reduce(0, (a, b) -> a + b);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}).max().orElse(0);
|
||||
}).filter(i -> i > 0).findFirst().get();
|
||||
|
||||
return BigDecimal.valueOf(d).setScale(1, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user