diff --git a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy index 5dacfd23..2a25c902 100644 --- a/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy +++ b/source/net/sourceforge/filebot/cli/ScriptShell.lib.groovy @@ -205,7 +205,7 @@ List.metaClass.sortBySimilarity = { prime, Closure toStringFunction = { obj -> o // call scripts def include(String input, Map parameters = [:], Object... args) { // initialize default parameter - parameters.args = (args as List).findResults{ it as File } + parameters.args = (args as List).flatten().findResults{ it as File } // run given script and catch exceptions _guarded { _shell.runScript(input, new javax.script.SimpleBindings(parameters)) } diff --git a/website/scripts/housekeeping.groovy b/website/scripts/housekeeping.groovy index 54a2cd5c..407da0e7 100644 --- a/website/scripts/housekeeping.groovy +++ b/website/scripts/housekeeping.groovy @@ -1,21 +1,17 @@ -// filebot -script "http://filebot.sf.net/scripts/housekeeping.groovy" +// filebot -script fn:housekeeping /path/to/folder/ --output /output/folder/ --format /* -* Watch folder for new tv shows and automatically -* move/rename new episodes into a predefined folder structure +* Watch folder for new tv shows and automatically move/rename new episodes */ // check for new media files once every 5 minutes def updateFrequency = 5 * 60 * 1000 -// V:/TV Shows/Stargate/Season 1/Stargate.S01E01.Pilot -def episodeFormat = "{com.sun.jna.Platform.isWindows() ? file[0] : home}/TV Shows/{n}{'/Season '+s}/{n.space('.')}.{s00e00}.{t.space('.')}" - // spawn daemon thread Thread.startDaemon { while (sleep(updateFrequency) || true) { args.eachMediaFolder { - rename(folder:it, db: "thetvdb", format:episodeFormat) + rename(folder:it) } } } diff --git a/website/scripts/watcher.groovy b/website/scripts/watcher.groovy index 3d51340e..fb297129 100644 --- a/website/scripts/watcher.groovy +++ b/website/scripts/watcher.groovy @@ -1,18 +1,9 @@ -// filebot -script "http://filebot.sf.net/scripts/watcher.groovy" --format +// filebot -script fn:watcher /path/to/folder/ --output /output/folder/ --format -// SANITY CHECK -if (_prop['java.runtime.version'] < '1.7') throw new Exception('Java 7 required') -if (!(new File(_args.format ?: '').absolute)) throw new Exception('Absolute target path format required') - - -// watch folders and print files that were added/modified (requires Java 7) -def watchman = args.watch { changes -> - println "Processing $changes" - rename(file:changes) +// watch folders and print files that were added/modified +args.watch { changes -> + rename(file:changes) } -// process after 5 minutes without any changes to the folder -watchman.setCommitDelay(5 * 60 * 1000) - println "Waiting for events" console.readLine() // keep running and watch for changes