* support activating the cleaner right out of utorrent-postprocess via --def clean=y

This commit is contained in:
Reinhard Pointner 2013-01-05 04:25:21 +00:00
parent 6ce7ee5cd7
commit a7ea715836
2 changed files with 9 additions and 2 deletions

View File

@ -29,4 +29,4 @@ def clean(f) {
args.getFiles{ isClutter(it) && !it.dir.hasFile{ (it.isVideo() || it.isAudio()) && !isClutter(it) }}.each { clean(it) } args.getFiles{ isClutter(it) && !it.dir.hasFile{ (it.isVideo() || it.isAudio()) && !isClutter(it) }}.each { clean(it) }
// delete empty folders but exclude given args // delete empty folders but exclude given args
args.getFolders{ it.listFiles().length == 0 && !args.contains(it) }.each { clean(it) } args.getFolders{ it.listFiles().length == 0 }.each { clean(it) }

View File

@ -15,6 +15,7 @@ if (tryQuietly{ ut_state != ut_state_allow }) {
def subtitles = tryQuietly{ subtitles.toBoolean() } def subtitles = tryQuietly{ subtitles.toBoolean() }
def artwork = tryQuietly{ artwork.toBoolean() } def artwork = tryQuietly{ artwork.toBoolean() }
def backdrops = tryQuietly{ backdrops.toBoolean() } def backdrops = tryQuietly{ backdrops.toBoolean() }
def clean = tryQuietly{ clean.toBoolean() }
// array of xbmc/plex hosts // array of xbmc/plex hosts
def xbmc = tryQuietly{ xbmc.split(/[ ,|]+/) } def xbmc = tryQuietly{ xbmc.split(/[ ,|]+/) }
@ -201,7 +202,7 @@ plex?.each{
// mark episodes as 'acquired' // mark episodes as 'acquired'
if (myepisodes) { if (myepisodes) {
println "Update MyEpisodes" println 'Update MyEpisodes'
include('fn:update-mes', [login:myepisodes.join(':'), addshows:false], getRenameLog().values()) include('fn:update-mes', [login:myepisodes.join(':'), addshows:false], getRenameLog().values())
} }
@ -241,3 +242,9 @@ if (gmail && !getRenameLog().isEmpty()) {
user: gmail[0], password: gmail[1] user: gmail[0], password: gmail[1]
) )
} }
// clean empty folders, clutter files, etc after move
if (clean) {
println 'Clean clutter files and empty folders'
include('fn:cleaner', [:], !args.empty ? args : ut_kind == 'multi' && ut_dir ? [ut_dir as File] : [])
}