2012-03-12 09:45:37 -04:00
|
|
|
// filebot -script "http://filebot.sf.net/scripts/sortivo.groovy" -trust-script <folder> [-non-strict] [--output path/to/folder]
|
2012-03-02 02:08:54 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Move/Rename a mix of episodes and movies that are all in the same folder.
|
|
|
|
*/
|
2012-03-12 09:45:37 -04:00
|
|
|
def groups = args.getFiles().groupBy{
|
2012-03-02 02:08:54 -05:00
|
|
|
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) {
|
2012-03-12 09:45:37 -04:00
|
|
|
if (it.name =~ "(?i:$tvs - .+)" || parseEpisodeNumber(it.name) || parseDate(it.name)) {
|
2012-03-02 02:08:54 -05:00
|
|
|
println "Exclude Movie: $mov"
|
|
|
|
mov = null
|
2012-03-10 05:47:39 -05:00
|
|
|
} else if (detectMovie(it, true)) {
|
2012-03-02 02:08:54 -05:00
|
|
|
println "Exclude Series: $tvs"
|
|
|
|
tvs = null
|
|
|
|
}
|
|
|
|
}
|
2012-03-12 09:45:37 -04:00
|
|
|
return [tvs:tvs, mov:mov]
|
|
|
|
}
|
|
|
|
|
|
|
|
groups.each{ group, files ->
|
2012-03-02 02:08:54 -05:00
|
|
|
// EPISODE MODE
|
2012-03-12 09:45:37 -04:00
|
|
|
if (group.tvs && !group.mov) {
|
|
|
|
return rename(file:files, format:'{n} - {s00e00} - {t}', db:'TheTVDB')
|
2012-03-02 02:08:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// MOVIE MODE
|
2012-03-12 09:45:37 -04:00
|
|
|
if (group.mov && !group.tvs) {
|
|
|
|
return rename(file:files, format:'{n} ({y}){" CD$pi"}', db:'TheMovieDB')
|
2012-03-02 02:08:54 -05:00
|
|
|
}
|
|
|
|
}
|