1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 23:05:03 -05:00

* use pre-processed batchsets properly in CLI mode

This commit is contained in:
Reinhard Pointner 2012-03-12 13:45:37 +00:00
parent c7c9083bc3
commit 8204d07434
2 changed files with 13 additions and 11 deletions

View File

@ -169,8 +169,8 @@ public class CmdlineOperations implements CmdlineInterface {
Set<Episode> episodes = fetchEpisodeSet(db, seriesNames, sortOrder, locale, strict); Set<Episode> episodes = fetchEpisodeSet(db, seriesNames, sortOrder, locale, strict);
if (episodes.size() > 0) { if (episodes.size() > 0) {
matches.addAll(matchEpisodes(filter(mediaFiles, VIDEO_FILES), episodes, sequence)); matches.addAll(matchEpisodes(filter(batch, VIDEO_FILES), episodes, sequence));
matches.addAll(matchEpisodes(filter(mediaFiles, SUBTITLE_FILES), episodes, sequence)); matches.addAll(matchEpisodes(filter(batch, SUBTITLE_FILES), episodes, sequence));
} else { } else {
CLILogger.warning("Failed to fetch episode data: " + seriesNames); CLILogger.warning("Failed to fetch episode data: " + seriesNames);
} }

View File

@ -1,17 +1,16 @@
// filebot -script "http://filebot.sf.net/scripts/sortivo.groovy" <folder> [-non-strict] [--output path/to/folder] // filebot -script "http://filebot.sf.net/scripts/sortivo.groovy" -trust-script <folder> [-non-strict] [--output path/to/folder]
/* /*
* Move/Rename a mix of episodes and movies that are all in the same 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 tvs = detectSeriesName(it)
def mov = detectMovie(it, false) def mov = detectMovie(it, false)
println "$it.name [series: $tvs, movie: $mov]" println "$it.name [series: $tvs, movie: $mov]"
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR) // DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
if (tvs && mov) { 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" println "Exclude Movie: $mov"
mov = null mov = null
} else if (detectMovie(it, true)) { } else if (detectMovie(it, true)) {
@ -19,14 +18,17 @@ args.getFiles{ it.isVideo() }.each{
tvs = null tvs = null
} }
} }
return [tvs:tvs, mov:mov]
}
groups.each{ group, files ->
// EPISODE MODE // EPISODE MODE
if (tvs && !mov) { if (group.tvs && !group.mov) {
return rename(file:it, format:'{n} - {s00e00} - {t}', db:'TheTVDB') return rename(file:files, format:'{n} - {s00e00} - {t}', db:'TheTVDB')
} }
// MOVIE MODE // MOVIE MODE
if (mov && !tvs) { if (group.mov && !group.tvs) {
return rename(file:it, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB') return rename(file:files, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB')
} }
} }