From 8204d0743472cbbe51f39945e6783390d4512665 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 12 Mar 2012 13:45:37 +0000 Subject: [PATCH] * use pre-processed batchsets properly in CLI mode --- .../filebot/cli/CmdlineOperations.java | 4 ++-- website/scripts/sortivo.groovy | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source/net/sourceforge/filebot/cli/CmdlineOperations.java b/source/net/sourceforge/filebot/cli/CmdlineOperations.java index 83960d29..da7665fc 100644 --- a/source/net/sourceforge/filebot/cli/CmdlineOperations.java +++ b/source/net/sourceforge/filebot/cli/CmdlineOperations.java @@ -169,8 +169,8 @@ public class CmdlineOperations implements CmdlineInterface { Set episodes = fetchEpisodeSet(db, seriesNames, sortOrder, locale, strict); if (episodes.size() > 0) { - matches.addAll(matchEpisodes(filter(mediaFiles, VIDEO_FILES), episodes, sequence)); - matches.addAll(matchEpisodes(filter(mediaFiles, SUBTITLE_FILES), episodes, sequence)); + matches.addAll(matchEpisodes(filter(batch, VIDEO_FILES), episodes, sequence)); + matches.addAll(matchEpisodes(filter(batch, SUBTITLE_FILES), episodes, sequence)); } else { CLILogger.warning("Failed to fetch episode data: " + seriesNames); } diff --git a/website/scripts/sortivo.groovy b/website/scripts/sortivo.groovy index 5d52fb84..c381c1d8 100644 --- a/website/scripts/sortivo.groovy +++ b/website/scripts/sortivo.groovy @@ -1,17 +1,16 @@ -// filebot -script "http://filebot.sf.net/scripts/sortivo.groovy" [-non-strict] [--output path/to/folder] +// filebot -script "http://filebot.sf.net/scripts/sortivo.groovy" -trust-script [-non-strict] [--output path/to/folder] /* * Move/Rename a mix of episodes and movies that are all in the same folder. */ -args.getFiles{ it.isVideo() }.each{ +def groups = args.getFiles().groupBy{ def tvs = detectSeriesName(it) def mov = detectMovie(it, false) - println "$it.name [series: $tvs, movie: $mov]" // DECIDE EPISODE VS MOVIE (IF NOT CLEAR) if (tvs && mov) { - if (it.name =~ "(?i:$tvs - .+)" || parseEpisodeNumber(it) || parseDate(it)) { + if (it.name =~ "(?i:$tvs - .+)" || parseEpisodeNumber(it.name) || parseDate(it.name)) { println "Exclude Movie: $mov" mov = null } else if (detectMovie(it, true)) { @@ -19,14 +18,17 @@ args.getFiles{ it.isVideo() }.each{ tvs = null } } - + return [tvs:tvs, mov:mov] +} + +groups.each{ group, files -> // EPISODE MODE - if (tvs && !mov) { - return rename(file:it, format:'{n} - {s00e00} - {t}', db:'TheTVDB') + if (group.tvs && !group.mov) { + return rename(file:files, format:'{n} - {s00e00} - {t}', db:'TheTVDB') } // MOVIE MODE - if (mov && !tvs) { - return rename(file:it, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB') + if (group.mov && !group.tvs) { + return rename(file:files, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB') } }