* tuned basic -rename series/movie-mode decision logic
* update fn:renall to support --def target=folder option to easily rename folders specifically (only works for movie mode)
This commit is contained in:
parent
d1010338ec
commit
b638092409
|
@ -57,6 +57,7 @@ import net.sourceforge.filebot.format.MediaBindingBean;
|
||||||
import net.sourceforge.filebot.hash.HashType;
|
import net.sourceforge.filebot.hash.HashType;
|
||||||
import net.sourceforge.filebot.hash.VerificationFileReader;
|
import net.sourceforge.filebot.hash.VerificationFileReader;
|
||||||
import net.sourceforge.filebot.hash.VerificationFileWriter;
|
import net.sourceforge.filebot.hash.VerificationFileWriter;
|
||||||
|
import net.sourceforge.filebot.media.MediaDetection;
|
||||||
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
||||||
import net.sourceforge.filebot.similarity.Match;
|
import net.sourceforge.filebot.similarity.Match;
|
||||||
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
||||||
|
@ -115,7 +116,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
|
|
||||||
for (File f : mediaFiles) {
|
for (File f : mediaFiles) {
|
||||||
// count SxE matches
|
// count SxE matches
|
||||||
if (nameMatcher.matchByEpisodeIdentifier(f.getName()) != null) {
|
if (MediaDetection.getEpisodeIdentifier(f.getName(), true) != null) {
|
||||||
sxe++;
|
sxe++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
CLILogger.finest(format("Filename pattern: [%.02f] SxE, [%.02f] CWS", sxe / max, cws / max));
|
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
|
return renameSeries(files, action, conflictAction, outputDir, format, WebServices.TheTVDB, query, SortOrder.forName(sortOrder), filter, locale, strict); // use default episode db
|
||||||
} else {
|
} else {
|
||||||
return renameMovie(files, action, conflictAction, outputDir, format, WebServices.TMDb, query, locale, strict); // use default movie db
|
return renameMovie(files, action, conflictAction, outputDir, format, WebServices.TMDb, query, locale, strict); // use default movie db
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
// filebot -script fn:renall <options> <folder>
|
// filebot -script fn:renall <options> <folder> --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.
|
||||||
*/
|
*/
|
||||||
|
def target = tryQuietly{ target } ?: 'file' // target files by default
|
||||||
|
|
||||||
args.eachMediaFolder {
|
args.eachMediaFolder {
|
||||||
rename(folder:it)
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue