From 0edfa6cced93416b5c0bb6c8148a5802c28d65ce Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 9 Nov 2013 05:54:11 +0000 Subject: [PATCH] * exclude list check/update support for AMC script so we can ignore files that have already been processed in previous runs e.g. --def excludeList=amc-index.txt --- website/scripts/amc.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/scripts/amc.groovy b/website/scripts/amc.groovy index a7282d0f..6fcb09d2 100644 --- a/website/scripts/amc.groovy +++ b/website/scripts/amc.groovy @@ -30,6 +30,7 @@ def xbmc = tryQuietly{ xbmc.split(/[ ,|]+/) } def plex = tryQuietly{ plex.split(/[ ,|]+/) } // myepisodes updates and email notifications +def excludeList = tryQuietly { new File(_args.output, excludeList) } def myepisodes = tryQuietly { myepisodes.split(':', 2) } def gmail = tryQuietly{ gmail.split(':', 2) } def pushover = tryQuietly{ pushover.toString() } @@ -111,6 +112,17 @@ input = input.findAll{ f -> (f.isVideo() && !tryQuietly{ f.hasExtension('iso') & // ignore clutter files input = input.findAll{ f -> !(f.path =~ /\b(?i:sample|trailer|extras|music.video|scrapbook|behind.the.scenes|extended.scenes|deleted.scenes|s\d{2}c\d{2}|mini.series)\b/ || (f.isFile() && f.length() < minFileSize)) } +// check and update exclude list (e.g. to make sure files are only processed once) +if (excludeList) { + // check excludes from previous runs + def excludePathSet = excludeList.exists() ? excludeList.text.split('\n') as HashSet : [] + input = input.findAll{ f -> !excludePathSet.contains(f.path) } + + // update excludes with input of this run + excludePathSet += input + excludePathSet.join('\n').saveAs(excludeList) +} + // print input fileset input.each{ f -> _log.finest("Input: $f") }