After fiddling around for some time, I have it kinda working
Instead of getting just the filename after the rename process I got it to send me the filename and full path to the original file. This is good enough for me at this point as I still get notified of what has been added.
And there's one MAJOR problem with the script, you get an email for every .rar packet.... so not that great.
My full script for those who are interested:
Code: Select all
//filebot -script fatty.groovy -extract -rename -get-subtitles d:/temp/ --lang en -non-strict
// Input Folders
def episodeDir = '''D:/temp/TV Shows'''
def movieDir = '''D:/temp/Movies'''
def animeDir = '''D:/temp/Anime'''
// Output Folders and format
def episodeFormat = '''D:/TV Shows/{n}/Season {s}/{fn}'''
def movieFormat = '''D:/Movies/{n}/{fn}'''
def animeFormat = '''D:/Anime/{primaryTitle}/{fn}'''
//START ALL THE AUTOMATIONS!!!
// 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)
episodeDir.getFolders{ it.hasFile{ it.isVideo() } }.each{ dir ->
println "Processing $dir"
def files = dir.listFiles{ it.isVideo() }
// sort episodes
rename(file:changes, db:'TheTVDB', format:episodeFormat)
execute("sendemail.exe", "-f", "[email protected]", "-t", "[email protected]", "-s", "smtp.server.com:port", "-u", "Email title for TV Shows", "-m", files)
}
movieDir.getFolders{it.hasFile{ it.isVideo() } }.each{ dir ->
println "Processing $dir"
def files = dir.listFiles{ it.isVideo() }
// sort movies
rename(file:changes, db:'TheMovieDB', format:movieFormat)
execute("sendemail.exe", "-f", "[email protected]", "-t", "[email protected]", "-s", "smtp.server.com:port", "-u", "Email title for movies", "-m", files)
}
animeDir.getFolders{it.hasFile{ it.isVideo() } }.each{ dir ->
println "Processing $dir"
def files = dir.listFiles{ it.isVideo() }
// sort anime
rename(file:changes, db:'AniDB', format:animeFormat)
execute("sendemail.exe", "-f", "[email protected]", "-t", "[email protected]", "-s", "smtp.server.com:port", "-u", "Email title for anime", "-m", files)
}
}
watchman.commitDelay = 5 * 1000 // 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
I use this script with a seedbox with automated rss downloads, automated ftp download to get files from the seedbox and plex media server.
edit: I forgot to write about that MAJOR problem... my bad...
Most of the code is "stolen" from rednoahs watcher.groovy script and Evos email.groovy. So thank you guys!