diff --git a/source/net/filebot/cli/ScriptShellBaseClass.java b/source/net/filebot/cli/ScriptShellBaseClass.java index d78ec41e..8af1bd93 100644 --- a/source/net/filebot/cli/ScriptShellBaseClass.java +++ b/source/net/filebot/cli/ScriptShellBaseClass.java @@ -458,7 +458,7 @@ public abstract class ScriptShellBaseClass extends Script { Object folder = parameters.get("folder"); if (folder != null) { - return listFiles(asFileList(folder), 0, FILES, HUMAN_ORDER); + return listFiles(asFileList(folder), 0, FILES, HUMAN_NAME_ORDER); } return emptyList(); diff --git a/source/net/filebot/cli/ScriptShellMethods.java b/source/net/filebot/cli/ScriptShellMethods.java index 4aa74e52..9fd8b2dd 100644 --- a/source/net/filebot/cli/ScriptShellMethods.java +++ b/source/net/filebot/cli/ScriptShellMethods.java @@ -118,7 +118,7 @@ public class ScriptShellMethods { } public static List listTree(File self, int maxDepth) { - return FileUtilities.listFiles(singleton(self), maxDepth, FILES, HUMAN_ORDER); + return FileUtilities.listFiles(singleton(self), maxDepth, FILES, HUMAN_NAME_ORDER); } public static List getFiles(File self) { @@ -136,7 +136,7 @@ public class ScriptShellMethods { public static List getFiles(Collection self, Closure closure) { List roots = FileUtilities.asFileList(self.toArray()); - List files = FileUtilities.listFiles(roots, FILES, HUMAN_ORDER); + List files = FileUtilities.listFiles(roots, FILES, HUMAN_NAME_ORDER); if (closure != null) { files = DefaultGroovyMethods.findAll(files, closure); } @@ -159,7 +159,7 @@ public class ScriptShellMethods { public static List getFolders(Collection self, Closure closure) { List roots = FileUtilities.asFileList(self.toArray()); - List folders = FileUtilities.listFolders(roots, HUMAN_ORDER); + List folders = FileUtilities.listFolders(roots, HUMAN_NAME_ORDER); if (closure != null) { folders = DefaultGroovyMethods.findAll(folders, closure); } diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 002b622e..c5f93cb0 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -990,7 +990,7 @@ public class MediaBindingBean { public File getInferredMediaFile() { if (getMediaFile().isDirectory()) { // just select the first video file in the folder as media sample - List videos = listFiles(getMediaFile(), VIDEO_FILES, CASE_INSENSITIVE_ORDER); + List videos = listFiles(getMediaFile(), VIDEO_FILES, CASE_INSENSITIVE_PATH_ORDER); if (videos.size() > 0) { return videos.get(0); } diff --git a/source/net/filebot/media/AutoDetection.java b/source/net/filebot/media/AutoDetection.java index 705a1f99..30af7b16 100644 --- a/source/net/filebot/media/AutoDetection.java +++ b/source/net/filebot/media/AutoDetection.java @@ -300,7 +300,7 @@ public class AutoDetection { } public boolean commonNumberPattern() { - return getChildren(f.getParentFile(), VIDEO_FILES, HUMAN_ORDER).stream().filter(it -> { + return getChildren(f.getParentFile(), VIDEO_FILES, HUMAN_NAME_ORDER).stream().filter(it -> { return find(dn, snm) || find(normalize(it.getName()), snm); }).map(it -> { return streamMatches(it.getName(), EPISODE_NUMBERS).map(Integer::new).collect(toSet()); diff --git a/source/net/filebot/ui/filter/AttributeTool.java b/source/net/filebot/ui/filter/AttributeTool.java index 4ad7d0d4..f96a2b47 100644 --- a/source/net/filebot/ui/filter/AttributeTool.java +++ b/source/net/filebot/ui/filter/AttributeTool.java @@ -55,7 +55,7 @@ class AttributeTool extends Tool { return model; } - List files = listFiles(root, filter(VIDEO_FILES, SUBTITLE_FILES), HUMAN_ORDER); + List files = listFiles(root, filter(VIDEO_FILES, SUBTITLE_FILES), HUMAN_NAME_ORDER); for (File file : files) { Object metaObject = xattr.getMetaInfo(file); diff --git a/source/net/filebot/ui/filter/ExtractTool.java b/source/net/filebot/ui/filter/ExtractTool.java index 8144b60b..1472c0b9 100644 --- a/source/net/filebot/ui/filter/ExtractTool.java +++ b/source/net/filebot/ui/filter/ExtractTool.java @@ -82,7 +82,7 @@ class ExtractTool extends Tool { } // ignore non-archives files and trailing multi-volume parts - List files = listFiles(root, Archive.VOLUME_ONE_FILTER, HUMAN_ORDER); + List files = listFiles(root, Archive.VOLUME_ONE_FILTER, HUMAN_NAME_ORDER); List entries = new ArrayList(); try { diff --git a/source/net/filebot/ui/filter/FileTreeTransferablePolicy.java b/source/net/filebot/ui/filter/FileTreeTransferablePolicy.java index aa82f5f7..a37f3c15 100644 --- a/source/net/filebot/ui/filter/FileTreeTransferablePolicy.java +++ b/source/net/filebot/ui/filter/FileTreeTransferablePolicy.java @@ -87,7 +87,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy children = new LinkedList(); - for (File f : getChildren(file, NOT_HIDDEN, HUMAN_ORDER)) { + for (File f : getChildren(file, NOT_HIDDEN, HUMAN_NAME_ORDER)) { if (f.isDirectory()) { children.addFirst(getTreeNode(f)); } else { diff --git a/source/net/filebot/ui/filter/MediaInfoTool.java b/source/net/filebot/ui/filter/MediaInfoTool.java index 582c70d6..e30cea1d 100644 --- a/source/net/filebot/ui/filter/MediaInfoTool.java +++ b/source/net/filebot/ui/filter/MediaInfoTool.java @@ -58,7 +58,7 @@ class MediaInfoTool extends Tool { return new MediaInfoTableModel(); } - List files = listFiles(root, filter(VIDEO_FILES, AUDIO_FILES), HUMAN_ORDER); + List files = listFiles(root, filter(VIDEO_FILES, AUDIO_FILES), HUMAN_NAME_ORDER); Map data = new TreeMap(); try (MediaInfo mi = new MediaInfo()) { diff --git a/source/net/filebot/ui/filter/SplitTool.java b/source/net/filebot/ui/filter/SplitTool.java index a257264a..cb956ea6 100644 --- a/source/net/filebot/ui/filter/SplitTool.java +++ b/source/net/filebot/ui/filter/SplitTool.java @@ -76,7 +76,7 @@ class SplitTool extends Tool { int nextPart = 1; long splitSize = getSplitSize(); - List files = listFiles(root, FILES, HUMAN_ORDER); + List files = listFiles(root, FILES, HUMAN_NAME_ORDER); List rootGroup = new ArrayList(); List currentPart = new ArrayList(); diff --git a/source/net/filebot/ui/filter/TypeTool.java b/source/net/filebot/ui/filter/TypeTool.java index 629e1743..28c76b3f 100644 --- a/source/net/filebot/ui/filter/TypeTool.java +++ b/source/net/filebot/ui/filter/TypeTool.java @@ -49,7 +49,7 @@ class TypeTool extends Tool { return new DefaultTreeModel(new FolderNode("Types", emptyList())); } - List filesAndFolders = listFiles(root, NOT_HIDDEN, HUMAN_ORDER); + List filesAndFolders = listFiles(root, NOT_HIDDEN, HUMAN_NAME_ORDER); List groups = new ArrayList(); for (Entry it : getMetaTypes().entrySet()) { diff --git a/source/net/filebot/ui/list/FileListTransferablePolicy.java b/source/net/filebot/ui/list/FileListTransferablePolicy.java index 9706561e..dc215ecb 100644 --- a/source/net/filebot/ui/list/FileListTransferablePolicy.java +++ b/source/net/filebot/ui/list/FileListTransferablePolicy.java @@ -84,7 +84,7 @@ class FileListTransferablePolicy extends FileTransferablePolicy { // load all files from the given folders recursively up do a depth of 32 format.accept(ListPanel.DEFAULT_FILE_FORMAT); - model.accept(listFiles(files, FILES, HUMAN_ORDER)); + model.accept(listFiles(files, FILES, HUMAN_NAME_ORDER)); } } diff --git a/source/net/filebot/ui/rename/EpisodeListMatcher.java b/source/net/filebot/ui/rename/EpisodeListMatcher.java index 66fd2c83..ca5535ec 100644 --- a/source/net/filebot/ui/rename/EpisodeListMatcher.java +++ b/source/net/filebot/ui/rename/EpisodeListMatcher.java @@ -297,7 +297,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher { } protected String getQueryInputMessage(String header, String message, Collection files) throws Exception { - List selection = files.stream().sorted(comparing(File::length).reversed()).limit(5).sorted(HUMAN_ORDER).collect(toList()); + List selection = files.stream().sorted(comparing(File::length).reversed()).limit(5).sorted(HUMAN_NAME_ORDER).collect(toList()); if (selection.isEmpty()) { return ""; } diff --git a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java index 3e63a080..c0d5abd6 100644 --- a/source/net/filebot/ui/rename/FilesListTransferablePolicy.java +++ b/source/net/filebot/ui/rename/FilesListTransferablePolicy.java @@ -92,7 +92,7 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy // load folders recursively else if (f.isDirectory()) { - load(getChildren(f, NOT_HIDDEN, HUMAN_ORDER), true, sink); // FORCE NATURAL FILE ORDER + load(getChildren(f, NOT_HIDDEN, HUMAN_NAME_ORDER), true, sink); // FORCE NATURAL FILE ORDER } } } diff --git a/source/net/filebot/ui/rename/NamesListTransferablePolicy.java b/source/net/filebot/ui/rename/NamesListTransferablePolicy.java index 4998b3fe..9d4f3aef 100644 --- a/source/net/filebot/ui/rename/NamesListTransferablePolicy.java +++ b/source/net/filebot/ui/rename/NamesListTransferablePolicy.java @@ -97,7 +97,7 @@ class NamesListTransferablePolicy extends FileTransferablePolicy { loadTorrentFiles(files, values); } else { // load all files from the given folders recursively up do a depth of 32 - listFiles(files, FILES, HUMAN_ORDER).stream().map(FastFile::new).forEach(values::add); + listFiles(files, FILES, HUMAN_NAME_ORDER).stream().map(FastFile::new).forEach(values::add); } model.addAll(values); diff --git a/source/net/filebot/ui/rename/Preset.java b/source/net/filebot/ui/rename/Preset.java index 4d14a4de..a7c8e4fe 100644 --- a/source/net/filebot/ui/rename/Preset.java +++ b/source/net/filebot/ui/rename/Preset.java @@ -84,7 +84,7 @@ public class Preset { } } - return listFiles(getInputFolder(), f -> f.isFile() && filter.accept(f), HUMAN_ORDER); + return listFiles(getInputFolder(), f -> f.isFile() && filter.accept(f), HUMAN_NAME_ORDER); } public AutoCompleteMatcher getAutoCompleteMatcher() { diff --git a/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java b/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java index 3cd90470..7a983432 100644 --- a/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java +++ b/source/net/filebot/ui/sfv/ChecksumTableTransferablePolicy.java @@ -96,7 +96,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy files = listFiles(selection, VIDEO_FILES, HUMAN_ORDER); + List files = listFiles(selection, VIDEO_FILES, HUMAN_NAME_ORDER); if (files.size() > 0) { handleDownload(files); @@ -249,7 +249,7 @@ abstract class SubtitleDropTarget extends JButton { } // perform a drop action depending on the given files - List files = listFiles(selection, FILES, HUMAN_ORDER); + List files = listFiles(selection, FILES, HUMAN_NAME_ORDER); List videos = filter(files, VIDEO_FILES); List subtitles = filter(files, SUBTITLE_FILES); diff --git a/source/net/filebot/util/FileUtilities.java b/source/net/filebot/util/FileUtilities.java index 9a1d6192..c7070c58 100644 --- a/source/net/filebot/util/FileUtilities.java +++ b/source/net/filebot/util/FileUtilities.java @@ -365,7 +365,7 @@ public final class FileUtilities { public static List sortByUniquePath(Collection files) { // sort by unique lower-case paths - TreeSet sortedSet = new TreeSet(CASE_INSENSITIVE_ORDER); + TreeSet sortedSet = new TreeSet(CASE_INSENSITIVE_PATH_ORDER); sortedSet.addAll(files); return new ArrayList(sortedSet); @@ -787,9 +787,9 @@ public final class FileUtilities { } } - public static final Comparator CASE_INSENSITIVE_ORDER = comparing(File::getPath, String.CASE_INSENSITIVE_ORDER); + public static final Comparator CASE_INSENSITIVE_PATH_ORDER = comparing(File::getPath, String.CASE_INSENSITIVE_ORDER); - public static final Comparator HUMAN_ORDER = comparing(File::getName, new AlphanumComparator(Locale.ENGLISH)); + public static final Comparator HUMAN_NAME_ORDER = comparing(File::getName, new AlphanumComparator(Locale.ENGLISH)); /** * Dummy constructor to prevent instantiation.