How To: Send emails when FileBot renames or moves files.
Posted: 06 Mar 2012, 00:22
Well, for this one we can thanks rednoah for fixing it up.
I'm using my Gmail account, however you can probably use SMTP server you want.
1) Download filebot 2.6 from here: http://filebot.sourceforge.net/#download
2) Install it or upgrade the older version
3) Download a program called SendEmail from: here or from DropBox
4) Extract the SendEmail.exe into C:\Windows\System32
5) Create a file called email.groovy and put it in the directory of Filebot
6) Open email.grooxy and copy the following code into it:
For example:
Now, when you call Filebot you need to call this script with it. If it renames the media then it will send you an email saying:
I'm using my Gmail account, however you can probably use SMTP server you want.
1) Download filebot 2.6 from here: http://filebot.sourceforge.net/#download
2) Install it or upgrade the older version
3) Download a program called SendEmail from: here or from DropBox
4) Extract the SendEmail.exe into C:\Windows\System32
5) Create a file called email.groovy and put it in the directory of Filebot
6) Open email.grooxy and copy the following code into it:
Code: Select all
def updateFreq = 5 * 60 * 1000
Thread.startDaemon
{
while (sleep(updateFreq) || true) {
def groups = args.getFiles().groupBy{
def tvs = detectSeriesName(it)
def mov = detectMovie(it, false)
println "$it.name [series: $tvs, movie: $mov]"
// DECIDE EPISODE VS MOVIE (IF NOT CLEAR)
if (tvs && mov) {
if (it.name =~ "(?i:$tvs - .+)" || parseEpisodeNumber(it.name) || parseDate(it.name)) {
println "Exclude Movie: $mov"
mov = null
} else if (detectMovie(it, true)) {
println "Exclude Series: $tvs"
tvs = null
}
}
return [tvs:tvs, mov:mov]
}
groups.each{ group, files ->
// EPISODE MODE
if (group.tvs && !group.mov) {
args.eachMediaFolder() {
//CHANGE THE FORMAT AS YOU WISH
def paths = rename(file:files, format:'H:/TV/{n}/Season {s}/{n} Season {s} Episode {e} {t}', db:'thetvdb', strict:false)
paths.each {
def msg = "${it.name} has been added to the library"
//EDIT YOUR DETAILS
execute("sendemail.exe", "-f", "[b]FROM EMAIL ADDRESS[/b]", "-t", "[b]TO EMAIL ADDRESS[/b]", "-s", "[b]SMTP SERVER:PORT[/b]", "-xu", "[b]SMTP USERNAME[/b]", "-xp", "[b]SMTP PASSWORD[/b]", "-u", msg, "-m", msg)
}
} }
// MOVIE MODE
if (group.mov && !group.tvs) {
args.eachMediaFolder() {
//CHANGE THE FORMAT AS YOU WISH
def paths = rename(file:files, format:'G:/Videos/Films/{n} ({y})', db:'TheMovieDB', strict:false)
paths.each {
def msg = "${it.name} has been added to the library"
//EDIT YOUR DETAILS
execute("sendemail.exe", "-f", "[b]FROM EMAIL ADDRESS[/b]", "-t", "[b]TO EMAIL ADDRESS[/b]", "-s", "[b]SMTP SERVER:PORT[/b]", "-xu", "[b]SMTP USERNAME[/b]", "-xp", "[b]SMTP PASSWORD[/b]", "-u", msg, "-m", msg)
}
} }
}
}
}
println "Press ENTER to abort"
console.readLine()
From Email Address = [email protected]
To Email Address = [email protected]
SMTP Server & Port = smtp.gmail.com:587
SMTP Username = [email protected]
SMTP Password = Password123
Now, when you call Filebot you need to call this script with it. If it renames the media then it will send you an email saying:
and it will store them in:<Media Name> has been added to the library
For example. I call it usingG:/TV/<Show Name>/<Season Number>/<Show> <Season Number> <Episode Number> - <Episode Name>
Code: Select all
filebot -script "C:/Program Files/Filebot/email.groovy" -trust-script