* account for huge list of files

This commit is contained in:
Reinhard Pointner 2014-07-19 08:08:02 +00:00
parent 02f789e1bf
commit 0a2b9c7760
1 changed files with 18 additions and 1 deletions

View File

@ -310,11 +310,24 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
}
protected String getQueryInputMessage(List<File> files) throws Exception {
int limit = 20;
List<File> selection = new ArrayList<File>(files);
if (selection.size() > limit) {
sort(selection, new Comparator<File>() {
@Override
public int compare(File o1, File o2) {
return Long.compare(o2.length(), o1.length());
}
});
selection = selection.subList(0, limit);
}
StringBuilder html = new StringBuilder(512);
html.append("<html>");
html.append("Unable to identify the following files:").append("<br>");
for (File file : sortByUniquePath(files)) {
for (File file : sortByUniquePath(selection)) {
html.append("<nobr>");
html.append("");
@ -328,6 +341,10 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
html.append("<br>");
}
if (selection.size() < files.size()) {
html.append("").append("").append("<br>");
}
html.append("<br>");
html.append("Please enter series name:");
html.append("</html>");