I'm looking for a post processing script which announces finished downloads to an IRC Channel.
It also would be nice to get a message when sabnzbd started with an NZB, but AFAIK there is currently no way to launch an external script for this event?
I don't know if it is even possible to send messages from the shell to an eggdrop bot...any IRC experts here?
Send Events to IRC
Re: Send Events to IRC
This isn't too hard of a task. Just out of curiosity, I have created a php script that connects to IRC and then tells a bot to say something on the channel.
There are plenty of tutorials on how to connect to IRC using PHP, perl, or any other language out there and its not very hard. It took about 20 minutes of coding to accomplish this. I'll clean up my PHP code and post it here for others to see.
There are plenty of tutorials on how to connect to IRC using PHP, perl, or any other language out there and its not very hard. It took about 20 minutes of coding to accomplish this. I'll clean up my PHP code and post it here for others to see.
Re: Send Events to IRC
Nice to hear that I am looking forward to your PHP!
Re: Send Events to IRC
Alright,
Most of this code was stolen from another website, I just adapted it a little bit.
Basically, it connect to an IRC server, waits for a response from nickserv then sends a few commands to a bot living on a channel. It can either be an eggdrop bot or any other bot that supports the "say" command.
This script takes 1 argument, what you want it to say. So I call this script from my post processing script like this: /usr/local/bin/botsay "file download details here"
Remember to change your PHP path and all the variables and then make the script executable.
Your bot may or may not require authentication to use the "say" command so comment out the auth line if you don't need it.
You can also comment out the echo bits in the script, they are simply there for debugging.
let me know if you need any help with this, its really pretty simple.
For some reason, the forum software wont let me use the code tag, so I have included a pastebin link:
http://pastebin.com/fed0efe4
Most of this code was stolen from another website, I just adapted it a little bit.
Basically, it connect to an IRC server, waits for a response from nickserv then sends a few commands to a bot living on a channel. It can either be an eggdrop bot or any other bot that supports the "say" command.
This script takes 1 argument, what you want it to say. So I call this script from my post processing script like this: /usr/local/bin/botsay "file download details here"
Remember to change your PHP path and all the variables and then make the script executable.
Your bot may or may not require authentication to use the "say" command so comment out the auth line if you don't need it.
You can also comment out the echo bits in the script, they are simply there for debugging.
let me know if you need any help with this, its really pretty simple.
For some reason, the forum software wont let me use the code tag, so I have included a pastebin link:
http://pastebin.com/fed0efe4
Re: Send Events to IRC
Thanks for your PHP
Question: Isn't this a bad solution? As I understand, the PHP connects for each message to the IRC Server just to handover the message to the eggdrop. Isn't there a way to give the message directly to the bot without joining and leaving the IRC network?
Question: Isn't this a bad solution? As I understand, the PHP connects for each message to the IRC Server just to handover the message to the eggdrop. Isn't there a way to give the message directly to the bot without joining and leaving the IRC network?
Re: Send Events to IRC
yeah, its probably not the best solution, but I am on a private IRC network (that I run) so I don't mind it.
If you're looking for a cleaner solution, check out this thread: http://forums.sabnzbd.org/index.php?topic=1353.0
There is a eggdrop script that can connect to sabnzbd. I'm sure it would be easy to make it announce to the channel when a download is completed.
If you're looking for a cleaner solution, check out this thread: http://forums.sabnzbd.org/index.php?topic=1353.0
There is a eggdrop script that can connect to sabnzbd. I'm sure it would be easy to make it announce to the channel when a download is completed.
Re: Send Events to IRC
I am now using a slightly different method I want to share.
Besides sabnzbd, a glftpd and a sitebot with zipscript is running on my box. Whenever a download finishes, sabnzbd calls my postprocessing script which starts with the following lines:
This writes the event to glftpd.log which is monitored by the sitebot.
To get this event recognized by the bot, you need to add the following to /path/to/eggdrop/scripts/pzs-ng/dZSbot.conf:
And last but not least add this line to your favorite zipscript theme, in my case /path/to/eggdrop/scripts/pzs-ng/themes/dakrer.zst:
Besides sabnzbd, a glftpd and a sitebot with zipscript is running on my box. Whenever a download finishes, sabnzbd calls my postprocessing script which starts with the following lines:
Code: Select all
#!/bin/bash
echo `date "+%a %b %e %T %Y"` USENETMESSAGE: \"$3\" >> /path/to/glftpd/ftp-data/logs/glftpd.log
To get this event recognized by the bot, you need to add the following to /path/to/eggdrop/scripts/pzs-ng/dZSbot.conf:
Code: Select all
set msgtypes(DEFAULT) "ADDUSER GADDUSER CHGRPADD CHGRPDEL ADDIP DELIP READDED DELUSER PURGED KILLED SYSOP BADHOSTMASK BADMSGINVITE BADPASSWORD
BANNEDHOST DELETED LOGIN LOGOUT IPNOTADDED KILLGHOST TAGLINE TIMEOUT DEBUG INVITE MSGINVITE REQFILLED REQUEST TURGEN WHOIS USENETMESSAGE"
set disable(USENETMESSAGE) 0
set variables(USENETMESSAGE) "%var1"
Code: Select all
announce.USENETMESSAGE = "[%c4{%b{USENET}}] %var1"
Re: Send Events to IRC
This is an updated (up-fancied) version of what knatsch did in 2009.
Here is the bash script for your SABnzbd:
This is what you need in ngBot.conf:
And here is an excerpt from my theme:
In the end it looks like this, when done properly:
Have fun and keep glftpd alive.
Here is the bash script for your SABnzbd:
Code: Select all
#!/bin/bash
case $7 in
0)
STATUS="OK"
;;
1)
STATUS="Verification failed"
;;
2)
STATUS="Unpack failed"
;;
3)
STATUS="Unpack+Verification failed"
;;
*)
STATUS="Unknown"
;;
esac
if [ "$5" = "*" ]; then
CATEGORY="DEFAULT"
else
CATEGORY=$5
fi
echo `date "+%a %b %e %T %Y"` USENETMESSAGE: \"$3\" \"$CATEGORY\" \"$6\" \"$STATUS\" >> /path/to/glftpd/ftp-data/logs/glftpd.log
Code: Select all
# SABNZD 2 GLFTPD
set msgtypes(DEFAULT) "ADDUSER GADDUSER CHGRPADD CHGRPDEL ADDIP DELIP READDED DELUSER PURGED KILLED SYSOP BADHOSTMASK BADMSGINVITE BADPASSWORD
BANNEDHOST DELETED LOGIN LOGOUT IPNOTADDED KILLGHOST TAGLINE TIMEOUT DEBUG INVITE MSGINVITE REQFILLED REQUEST TURGEN WHOIS USENETMESSAGE"
set disable(USENETMESSAGE) 0
set variables(USENETMESSAGE) "%nzb_path %nzb_category %nzb_group %nzb_status"
Code: Select all
announce.USENETMESSAGE = "%b{%c3{NZB-DONE}} in %c8{%nzb_category} : -> %b{%c8{%nzb_path}} from %c1{%nzb_group} with %b{Post-Process: %c1{%nzb_status}} by %c1{SABnzbd}."
Have fun and keep glftpd alive.
Re: Send Events to IRC
Nice update haxogen, any idee how to get this work for windows (ioftpd/eggdrop)
For some reason it wont logs on ioftpd.log (created a bat on sabnzbd/script)
*had to change some parameters
For some reason it wont logs on ioftpd.log (created a bat on sabnzbd/script)
*had to change some parameters
Re: Send Events to IRC
Thanks for the improved version haxogen! Works perfectly