1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 09:18:51 -05:00
filebot/website/scripts/watcher.groovy

23 lines
686 B
Groovy
Raw Normal View History

// filebot -script fn:watcher /path/to/folder/ --output /output/folder/ --format <expression>
// watch folders and print files that were added/modified
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-19 21:39:33 -05:00
}
watchman.commitDelay = 5 * 1000 // default = 5s
watchman.commitPerFolder = true // default = true
2011-12-01 12:06:51 -05:00
println "Waiting for events"
2011-12-19 21:39:33 -05:00
console.readLine() // keep running and watch for changes