parent
56316af826
commit
e3fe2fd094
|
@ -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();
|
||||
|
|
|
@ -118,7 +118,7 @@ public class ScriptShellMethods {
|
|||
}
|
||||
|
||||
public static List<File> 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<File> getFiles(File self) {
|
||||
|
@ -136,7 +136,7 @@ public class ScriptShellMethods {
|
|||
public static List<File> getFiles(Collection<?> self, Closure<?> closure) {
|
||||
List<File> roots = FileUtilities.asFileList(self.toArray());
|
||||
|
||||
List<File> files = FileUtilities.listFiles(roots, FILES, HUMAN_ORDER);
|
||||
List<File> 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<File> getFolders(Collection<?> self, Closure<?> closure) {
|
||||
List<File> roots = FileUtilities.asFileList(self.toArray());
|
||||
|
||||
List<File> folders = FileUtilities.listFolders(roots, HUMAN_ORDER);
|
||||
List<File> folders = FileUtilities.listFolders(roots, HUMAN_NAME_ORDER);
|
||||
if (closure != null) {
|
||||
folders = DefaultGroovyMethods.findAll(folders, closure);
|
||||
}
|
||||
|
|
|
@ -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<File> videos = listFiles(getMediaFile(), VIDEO_FILES, CASE_INSENSITIVE_ORDER);
|
||||
List<File> videos = listFiles(getMediaFile(), VIDEO_FILES, CASE_INSENSITIVE_PATH_ORDER);
|
||||
if (videos.size() > 0) {
|
||||
return videos.get(0);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -55,7 +55,7 @@ class AttributeTool extends Tool<TableModel> {
|
|||
return model;
|
||||
}
|
||||
|
||||
List<File> files = listFiles(root, filter(VIDEO_FILES, SUBTITLE_FILES), HUMAN_ORDER);
|
||||
List<File> files = listFiles(root, filter(VIDEO_FILES, SUBTITLE_FILES), HUMAN_NAME_ORDER);
|
||||
|
||||
for (File file : files) {
|
||||
Object metaObject = xattr.getMetaInfo(file);
|
||||
|
|
|
@ -82,7 +82,7 @@ class ExtractTool extends Tool<TableModel> {
|
|||
}
|
||||
|
||||
// ignore non-archives files and trailing multi-volume parts
|
||||
List<File> files = listFiles(root, Archive.VOLUME_ONE_FILTER, HUMAN_ORDER);
|
||||
List<File> files = listFiles(root, Archive.VOLUME_ONE_FILTER, HUMAN_NAME_ORDER);
|
||||
List<ArchiveEntry> entries = new ArrayList<ArchiveEntry>();
|
||||
|
||||
try {
|
||||
|
|
|
@ -87,7 +87,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<TreeNo
|
|||
if (file.isDirectory()) {
|
||||
LinkedList<TreeNode> children = new LinkedList<TreeNode>();
|
||||
|
||||
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 {
|
||||
|
|
|
@ -58,7 +58,7 @@ class MediaInfoTool extends Tool<TableModel> {
|
|||
return new MediaInfoTableModel();
|
||||
}
|
||||
|
||||
List<File> files = listFiles(root, filter(VIDEO_FILES, AUDIO_FILES), HUMAN_ORDER);
|
||||
List<File> files = listFiles(root, filter(VIDEO_FILES, AUDIO_FILES), HUMAN_NAME_ORDER);
|
||||
Map<MediaInfoKey, String[]> data = new TreeMap<MediaInfoKey, String[]>();
|
||||
|
||||
try (MediaInfo mi = new MediaInfo()) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class SplitTool extends Tool<TreeModel> {
|
|||
int nextPart = 1;
|
||||
long splitSize = getSplitSize();
|
||||
|
||||
List<File> files = listFiles(root, FILES, HUMAN_ORDER);
|
||||
List<File> files = listFiles(root, FILES, HUMAN_NAME_ORDER);
|
||||
|
||||
List<TreeNode> rootGroup = new ArrayList<TreeNode>();
|
||||
List<File> currentPart = new ArrayList<File>();
|
||||
|
|
|
@ -49,7 +49,7 @@ class TypeTool extends Tool<TreeModel> {
|
|||
return new DefaultTreeModel(new FolderNode("Types", emptyList()));
|
||||
}
|
||||
|
||||
List<File> filesAndFolders = listFiles(root, NOT_HIDDEN, HUMAN_ORDER);
|
||||
List<File> filesAndFolders = listFiles(root, NOT_HIDDEN, HUMAN_NAME_ORDER);
|
||||
List<TreeNode> groups = new ArrayList<TreeNode>();
|
||||
|
||||
for (Entry<String, FileFilter> it : getMetaTypes().entrySet()) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||
}
|
||||
|
||||
protected String getQueryInputMessage(String header, String message, Collection<File> files) throws Exception {
|
||||
List<File> selection = files.stream().sorted(comparing(File::length).reversed()).limit(5).sorted(HUMAN_ORDER).collect(toList());
|
||||
List<File> selection = files.stream().sorted(comparing(File::length).reversed()).limit(5).sorted(HUMAN_NAME_ORDER).collect(toList());
|
||||
if (selection.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy<File>
|
|||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -96,7 +96,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<C
|
|||
// handle single folder drop
|
||||
if (files.size() == 1 && containsOnly(files, FOLDERS)) {
|
||||
for (File folder : files) {
|
||||
for (File file : getChildren(folder, NOT_HIDDEN, HUMAN_ORDER)) {
|
||||
for (File file : getChildren(folder, NOT_HIDDEN, HUMAN_NAME_ORDER)) {
|
||||
load(file, null, folder);
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ class ChecksumTableTransferablePolicy extends BackgroundFileTransferablePolicy<C
|
|||
|
||||
if (absoluteFile.isDirectory()) {
|
||||
// load all files in the file tree
|
||||
for (File child : getChildren(absoluteFile, NOT_HIDDEN, HUMAN_ORDER)) {
|
||||
for (File child : getChildren(absoluteFile, NOT_HIDDEN, HUMAN_NAME_ORDER)) {
|
||||
load(child, relativeFile, root);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -175,7 +175,7 @@ abstract class SubtitleDropTarget extends JButton {
|
|||
return false;
|
||||
}
|
||||
|
||||
List<File> files = listFiles(selection, VIDEO_FILES, HUMAN_ORDER);
|
||||
List<File> 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<File> files = listFiles(selection, FILES, HUMAN_ORDER);
|
||||
List<File> files = listFiles(selection, FILES, HUMAN_NAME_ORDER);
|
||||
|
||||
List<File> videos = filter(files, VIDEO_FILES);
|
||||
List<File> subtitles = filter(files, SUBTITLE_FILES);
|
||||
|
|
|
@ -365,7 +365,7 @@ public final class FileUtilities {
|
|||
|
||||
public static List<File> sortByUniquePath(Collection<File> files) {
|
||||
// sort by unique lower-case paths
|
||||
TreeSet<File> sortedSet = new TreeSet<File>(CASE_INSENSITIVE_ORDER);
|
||||
TreeSet<File> sortedSet = new TreeSet<File>(CASE_INSENSITIVE_PATH_ORDER);
|
||||
sortedSet.addAll(files);
|
||||
|
||||
return new ArrayList<File>(sortedSet);
|
||||
|
@ -787,9 +787,9 @@ public final class FileUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static final Comparator<File> CASE_INSENSITIVE_ORDER = comparing(File::getPath, String.CASE_INSENSITIVE_ORDER);
|
||||
public static final Comparator<File> CASE_INSENSITIVE_PATH_ORDER = comparing(File::getPath, String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
public static final Comparator<File> HUMAN_ORDER = comparing(File::getName, new AlphanumComparator(Locale.ENGLISH));
|
||||
public static final Comparator<File> HUMAN_NAME_ORDER = comparing(File::getName, new AlphanumComparator(Locale.ENGLISH));
|
||||
|
||||
/**
|
||||
* Dummy constructor to prevent instantiation.
|
||||
|
|
Loading…
Reference in New Issue