diff --git a/source/net/filebot/media/AutoDetection.java b/source/net/filebot/media/AutoDetection.java index 30af7b16..5a5b08a1 100644 --- a/source/net/filebot/media/AutoDetection.java +++ b/source/net/filebot/media/AutoDetection.java @@ -48,8 +48,15 @@ public class AutoDetection { private Locale locale; public AutoDetection(Collection root, boolean resolve, Locale locale) { - this.files = (resolve ? resolve(root.stream().map(FastFile::new), getSystemFilesFilter()) : root.stream()).toArray(File[]::new); this.locale = locale; + + // require a set of distinct files + this.files = root.stream().sorted().distinct().map(FastFile::new).toArray(File[]::new); + + // resolve folders if required + if (resolve) { + this.files = resolve(stream(files), getSystemFilesFilter()).toArray(File[]::new); + } } protected Stream resolve(Stream root, FileFilter excludes) {