* utorrent-postprocess work standalone easily by adding args

This commit is contained in:
Reinhard Pointner 2012-07-13 14:33:39 +00:00
parent bcfb4d3380
commit f28a361d98
2 changed files with 11 additions and 5 deletions

View File

@ -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')
}
}

View File

@ -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") {
if (args.empty) {
// assume we're called with utorrent parameters
if (ut_kind == "multi") {
input += new File(ut_dir).getFiles() // multi-file torrent
} else {
} else {
input += new File(ut_dir, ut_file) // single-file torrent
}
} else {
// assume we're called normally with arguments
input += args.getFiles()
}
// extract archives if necessary