diff --git a/source/net/filebot/UserFiles.java b/source/net/filebot/UserFiles.java index 48e613e1..b0c51c0f 100644 --- a/source/net/filebot/UserFiles.java +++ b/source/net/filebot/UserFiles.java @@ -3,6 +3,7 @@ package net.filebot; import static java.util.Arrays.*; import static java.util.Collections.*; import static net.filebot.Settings.*; +import static net.filebot.similarity.Normalization.*; import static net.filebot.util.ui.SwingUI.*; import java.awt.Desktop; @@ -113,7 +114,7 @@ public class UserFiles { } if (filter != null && !filter.acceptAny()) { - chooser.setFileFilter(new javax.swing.filechooser.FileNameExtensionFilter(filter.toString(), filter.extensions())); + chooser.setFileFilter(new javax.swing.filechooser.FileNameExtensionFilter(truncateText(filter.toString(), 80), filter.extensions())); } if (chooser.showOpenDialog(getWindow(evt.getSource())) == JFileChooser.APPROVE_OPTION) { diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index bbb3235c..46e81948 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -970,24 +970,6 @@ public class MediaBindingBean { } } - private String truncateText(String title, int limit) { - if (title.length() < limit) { - return title; - } - - String[] words = title.split("\\s+"); - StringBuilder s = new StringBuilder(); - - for (int i = 0; i < words.length && s.length() + words[i].length() < limit; i++) { - if (i > 0) { - s.append(' '); - } - s.append(words[i]); - } - - return s.toString().trim(); - } - private List getKeywords() { // collect key information Set keys = new HashSet(); diff --git a/source/net/filebot/similarity/Normalization.java b/source/net/filebot/similarity/Normalization.java index af719822..2ec4c888 100644 --- a/source/net/filebot/similarity/Normalization.java +++ b/source/net/filebot/similarity/Normalization.java @@ -63,4 +63,22 @@ public class Normalization { return trailingParentheses.matcher(name).replaceAll("").trim(); } + public static String truncateText(String title, int limit) { + if (title.length() < limit) { + return title; + } + + String[] words = space.split(title); + StringBuilder s = new StringBuilder(); + + for (int i = 0; i < words.length && s.length() + words[i].length() < limit; i++) { + if (i > 0) { + s.append(' '); + } + s.append(words[i]); + } + + return s.toString().trim(); + } + }