Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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) {
- def renamedFiles = rename(file:changes)
- def message = renamedFiles.name.join('\n')
- execute("sendemail.exe", "-f", "sender@mail.com", "-t", "recipient@mail.com", "-s", "smtp.server.com:port", "-u", "Changes", "-m", message)
- }
- }
- watchman.commitDelay = 5000 // default = 5s
- watchman.commitPerFolder = true // default = true
- println "Waiting for events"
- if (console) { console.readLine() } else { sleep(Long.MAX_VALUE) } // keep running and watch for changes
Add Comment
Please, Sign In to add comment