1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-13 21:05:01 -05:00
filebot/website/scripts/housekeeping.groovy

25 lines
758 B
Groovy
Raw Normal View History

// filebot -script "http://filebot.sf.net/scripts/housekeeping.groovy" <folder>
/*
* Watch folder for new tv shows and automatically
* move/rename new episodes into a predefined folder structure
*/
2012-01-05 00:30:22 -05:00
// 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)
}
}
}
println "Press ENTER to abort"
console.readLine() // keep script running until aborted by user