From f28a361d98f25d4b5d838dbd6d41a22c4960d192 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 13 Jul 2012 14:33:39 +0000 Subject: [PATCH] * utorrent-postprocess work standalone easily by adding args --- website/scripts/sortivo.groovy | 4 ++-- website/scripts/utorrent-postprocess.groovy | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) 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