1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00
filebot/website/data/shell/watcher.groovy

12 lines
439 B
Groovy
Raw Normal View History

2011-12-01 12:06:51 -05:00
// watch folders and print files that were added/modified (requires Java 7)
2011-12-19 21:39:33 -05:00
def watchman = args.getFolders().watch { changes ->
println "Processing $changes"
rename(file:changes, format:"/media/storage/files/tv/{n}{'/Season '+s}/{episode}")
}
// process after 10 minutes without any changes to the folder
watchman.setCommitDelay(10 * 60 * 1000)
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