diff --git a/website/scripts/sortivo.groovy b/website/scripts/sortivo.groovy index d546a5a8..940d2b54 100644 --- a/website/scripts/sortivo.groovy +++ b/website/scripts/sortivo.groovy @@ -41,11 +41,11 @@ def groups = input.groupBy{ f -> groups.each{ group, files -> // EPISODE MODE if (group.tvs && !group.mov) { - return rename(file:files, format:'TV Shows/{n} - {s00e00} - {t}', db:'TheTVDB') + rename(file:files, format:'TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}', db:'TheTVDB') } // MOVIE MODE if (group.mov && !group.tvs) { - return rename(file:files, format:'Movies/{n} ({y}){" CD$pi"}', db:'TheMovieDB') + rename(file:files, format:'Movies/{n} ({y})/{n} ({y}){" CD$pi"}', db:'TheMovieDB') } } diff --git a/website/scripts/utorrent-postprocess.groovy b/website/scripts/utorrent-postprocess.groovy index 8272e5d4..b2ae9065 100644 --- a/website/scripts/utorrent-postprocess.groovy +++ b/website/scripts/utorrent-postprocess.groovy @@ -5,10 +5,16 @@ def failOnError = _args.conflict == 'fail' // print input parameters _args.parameters.each{ k, v -> println "Parameter: $k = $v" } -if (ut_kind == "multi") { - input += new File(ut_dir).getFiles() // multi-file torrent +if (args.empty) { + // assume we're called with utorrent parameters + if (ut_kind == "multi") { + input += new File(ut_dir).getFiles() // multi-file torrent + } else { + input += new File(ut_dir, ut_file) // single-file torrent + } } else { - input += new File(ut_dir, ut_file) // single-file torrent + // assume we're called normally with arguments + input += args.getFiles() } // extract archives if necessary