diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 3d24cac8..bd438d9f 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -167,7 +167,7 @@ public class CmdlineOperations implements CmdlineInterface { // auto-detect series name if not given if (query == null) { // detect series name by common word sequence - seriesNames = detectSeriesNames(batch, locale, db != AniDB, db == AniDB); + seriesNames = detectSeriesNames(batch, db != AniDB, db == AniDB, locale); CLILogger.config("Auto-detected query: " + seriesNames); } else { // use --q option @@ -686,7 +686,7 @@ public class CmdlineOperations implements CmdlineInterface { if (query == null) { try { List videoFiles = filter(files, VIDEO_FILES); - querySet.addAll(detectSeriesNames(videoFiles, language.getLocale(), true, false)); + querySet.addAll(detectSeriesNames(videoFiles, true, false, language.getLocale())); // auto-detect movie names for (File f : videoFiles) { diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index c34cdc0d..cfa8159d 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -229,8 +229,8 @@ def parseDate(path) { return MediaDetection.parseDate(input) } -def detectSeriesName(files, locale = Locale.ENGLISH) { - def names = MediaDetection.detectSeriesNames(files instanceof Collection ? files : [files as File], locale) +def detectSeriesName(files, boolean useSeriesIndex = true, boolean useAnimeIndex = false, Locale locale = Locale.ENGLISH) { + def names = MediaDetection.detectSeriesNames(files instanceof Collection ? files : [files as File], useSeriesIndex, useAnimeIndex, locale) return names == null || names.isEmpty() ? null : names.toList()[0] } diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 8a28d549..b6472c77 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -141,7 +141,7 @@ public class MediaDetection { for (Entry> it : filesByFolder.entrySet()) { Set namesForFolder = new TreeSet(getLenientCollator(locale)); - namesForFolder.addAll(detectSeriesNames(it.getValue(), locale, useSeriesIndex, useAnimeIndex)); + namesForFolder.addAll(detectSeriesNames(it.getValue(), useSeriesIndex, useAnimeIndex, locale)); seriesNamesByFolder.put(it.getKey(), namesForFolder); } @@ -270,11 +270,7 @@ public class MediaDetection { return match; } - public static List detectSeriesNames(Collection files, Locale locale) throws Exception { - return detectSeriesNames(files, locale, true, true); - } - - public static List detectSeriesNames(Collection files, Locale locale, boolean useSeriesIndex, boolean useAnimeIndex) throws Exception { + public static List detectSeriesNames(Collection files, boolean useSeriesIndex, boolean useAnimeIndex, Locale locale) throws Exception { List> index = new ArrayList>(); if (useSeriesIndex) index.addAll(getSeriesIndex()); diff --git a/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java b/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java index 72c4473e..77151a82 100644 --- a/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java +++ b/source/net/sourceforge/filebot/ui/rename/EpisodeListMatcher.java @@ -270,7 +270,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher { // require user input if auto-detection has failed or has been disabled if (episodes.isEmpty()) { - List detectedSeriesNames = detectSeriesNames(files, locale, useSeriesIndex, useAnimeIndex); + List detectedSeriesNames = detectSeriesNames(files, useSeriesIndex, useAnimeIndex, locale); String parentPathHint = normalizePathSeparators(getRelativePathTail(files.get(0).getParentFile(), 2).getPath()); String suggestion = detectedSeriesNames.size() > 0 ? join(detectedSeriesNames, ", ") : parentPathHint; diff --git a/source/net/sourceforge/filebot/ui/subtitle/SubtitleAutoMatchDialog.java b/source/net/sourceforge/filebot/ui/subtitle/SubtitleAutoMatchDialog.java index 3491393e..a9ab9df9 100644 --- a/source/net/sourceforge/filebot/ui/subtitle/SubtitleAutoMatchDialog.java +++ b/source/net/sourceforge/filebot/ui/subtitle/SubtitleAutoMatchDialog.java @@ -935,7 +935,7 @@ class SubtitleAutoMatchDialog extends JDialog { Collection querySet = new TreeSet(String.CASE_INSENSITIVE_ORDER); // auto-detect series names - querySet.addAll(detectSeriesNames(files, Locale.ROOT, true, false)); + querySet.addAll(detectSeriesNames(files, true, false, Locale.ROOT)); // auto-detect movie names for (File f : files) {