diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index acd85cb5..fa66c663 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -57,6 +57,7 @@ import net.sourceforge.filebot.format.MediaBindingBean; import net.sourceforge.filebot.hash.HashType; import net.sourceforge.filebot.hash.VerificationFileReader; import net.sourceforge.filebot.hash.VerificationFileWriter; +import net.sourceforge.filebot.media.MediaDetection; import net.sourceforge.filebot.similarity.EpisodeMatcher; import net.sourceforge.filebot.similarity.Match; import net.sourceforge.filebot.similarity.NameSimilarityMetric; @@ -115,7 +116,7 @@ public class CmdlineOperations implements CmdlineInterface { for (File f : mediaFiles) { // count SxE matches - if (nameMatcher.matchByEpisodeIdentifier(f.getName()) != null) { + if (MediaDetection.getEpisodeIdentifier(f.getName(), true) != null) { sxe++; } @@ -129,7 +130,7 @@ public class CmdlineOperations implements CmdlineInterface { } CLILogger.finest(format("Filename pattern: [%.02f] SxE, [%.02f] CWS", sxe / max, cws / max)); - if (sxe >= (max * 0.65) || cws >= (max * 0.65)) { + if (sxe > (max * 0.65) || cws > (max * 0.65)) { return renameSeries(files, action, conflictAction, outputDir, format, WebServices.TheTVDB, query, SortOrder.forName(sortOrder), filter, locale, strict); // use default episode db } else { return renameMovie(files, action, conflictAction, outputDir, format, WebServices.TMDb, query, locale, strict); // use default movie db diff --git a/website/scripts/renall.groovy b/website/scripts/renall.groovy index b12d8ff5..6228ef6f 100644 --- a/website/scripts/renall.groovy +++ b/website/scripts/renall.groovy @@ -1,8 +1,13 @@ -// filebot -script fn:renall +// filebot -script fn:renall --def target=[file|folder] /* - * Rename all tv shows, anime or movies using given or default options + * Rename all tv shows, anime or movies folder by folder using given or default options. */ -args.eachMediaFolder { - rename(folder:it) +def target = tryQuietly{ target } ?: 'file' // target files by default + +args.eachMediaFolder { + switch(target) { + case 'file' : return rename(folder:it) // rename files within each folder + case 'folder' : return rename(file :it) // rename folders as if they were files + } }