2012-07-21 20:35:13 +00:00
|
|
|
// filebot -script fn:watcher /path/to/folder/ --output /output/folder/ --format <expression>
|
2011-12-22 19:36:31 +00:00
|
|
|
|
2012-07-21 20:35:13 +00:00
|
|
|
// watch folders and print files that were added/modified
|
2012-07-23 04:54:50 +00:00
|
|
|
def watchman = args.watch { changes ->
|
|
|
|
// extract all
|
|
|
|
if (_args.extract)
|
|
|
|
changes += extract(file:changes.findAll{ it.isArchive() }, output:'.')
|
|
|
|
|
|
|
|
// subtitles for all
|
|
|
|
if (_args.getSubtitles)
|
|
|
|
changes += getMissingSubtitles(file:changes.findAll{ it.isVideo() }, output:'srt')
|
|
|
|
|
|
|
|
// rename all
|
|
|
|
if (_args.rename)
|
|
|
|
rename(file:changes)
|
2011-12-20 02:39:33 +00:00
|
|
|
}
|
|
|
|
|
2012-07-23 04:54:50 +00:00
|
|
|
watchman.commitDelay = 5 * 1000 // default = 5s
|
|
|
|
watchman.commitPerFolder = true // default = true
|
|
|
|
|
2011-12-01 17:06:51 +00:00
|
|
|
println "Waiting for events"
|
2011-12-20 02:39:33 +00:00
|
|
|
console.readLine() // keep running and watch for changes
|