diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 74b74b29..13ccc69d 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -313,7 +313,7 @@ public class MediaBindingBean { String extensions = getMediaInfo(StreamKind.General, 0, "Codec/Extensions", "Format"); // get first extension - return new Scanner(extensions).next().toLowerCase(); + return SPACE.splitAsStream(extensions).findFirst().get().toLowerCase(); } @Define("vf") @@ -350,8 +350,8 @@ public class MediaBindingBean { public String getAudioChannels() { String channels = getMediaInfo(StreamKind.Audio, 0, "Channel(s)_Original", "Channel(s)"); - // e.g. 6ch - return channels + "ch"; + // get first number, e.g. 6ch + return SPACE.splitAsStream(channels).findFirst().get() + "ch"; } @Define("resolution") diff --git a/source/net/filebot/util/StringUtilities.java b/source/net/filebot/util/StringUtilities.java index 2b07e0e0..71bf1c3b 100644 --- a/source/net/filebot/util/StringUtilities.java +++ b/source/net/filebot/util/StringUtilities.java @@ -11,6 +11,7 @@ import java.util.regex.Pattern; public final class StringUtilities { + public static final Pattern SPACE = Pattern.compile("\\s+"); public static final Pattern DIGIT = Pattern.compile("\\d+"); public static final Pattern NON_DIGIT = Pattern.compile("\\D+");