Page 1 of 3

SABnzbd stats script for XChat (linux)

Posted: June 16th, 2009, 4:13 pm
by fredlkrue
I search everywhere for such plug-in/script without any luck. Few months ago when I used to use HellaNZB there was a script located at http://nerdsonlinux.com/x-chat-plugins/nzbstats/ what workd flawless, but I had to switch to SABnzbd+. HellaNZB is outdated and has a lot annoying bugs... I got no knowledge in any programming what so ever... so if anyone can help me edit that script to work in SABnzb or find another one I will be thankful..

Re: SABnzbd stats script for XChat (linux)

Posted: June 24th, 2009, 3:59 am
by lommes
Download

works with authentification now!

Hi,

maybe this will be helpfull. I'm not really experienced in bash/tcl programming but somehow made it work (for me version: 0.4.9)

Its a simple bash script with some switches, which should be located in a folder like /usr/bin and a tcl file for xchat which calls this bash script and returns the output

In xchat the output will be something like:

sabnzb+ Current Speed: KB/s | Queue MB | ETA | Overall Download   GB

*edit* deleted

it takes a while until the ouput appears.

*edit*deleted

*edit* works only WITHOUT user authentification!

If it works HF :)

*edit2* feedback welcome! this script took me a while because of the regex which i'm not really familiar with. If some ppl are intressted i maybe will spend some more time on it!

Re: SABnzbd stats script for XChat (linux)

Posted: June 24th, 2009, 8:54 am
by fredlkrue
Thanks, I will give it a try.. also there's a small typo on the tlc file "sabnbd+" should be sabnzbd+ or SABnzbd+ :)

EDIT: I keep getting this error:

[10:58:28] Tcl plugin ERROR (alias SAB)
[10:58:28] missing close-bracket
[10:58:28]    while compiling
[10:58:28] "/say SABnbzd+ - Current Speed: [string trim [exec sabgetdata speed] KB/s | Queue: [string trim [exec sabgetdata queue] MB | ETA: [string trim [exec sa..."

Re: SABnzbd stats script for XChat (linux)

Posted: June 24th, 2009, 11:06 am
by lommes
as said ... recoded without testing ;) there are several brackets missing

alias sab {
  /say sabnzbd+ - Current Speed: [string trim [exec sabgetdata speed]] KB/s | Queue: [string trim [exec sabgetdata queue]] MB | ETA: [string trim [exec sabgetdata eta]] | Overall Download: [string trim [exec sabgetdata dltotal]] GB
  }

this should look better ;)

but i'm still not sure if exec with a switch works like this :/


*edit*

Image

there you go :)

thats how these lines like at my system (still with the typo ;)) and there seems to be an error with the overall download, because some are missing (but also in my history)

Re: SABnzbd stats script for XChat (linux)

Posted: June 24th, 2009, 12:29 pm
by fredlkrue
Thanks, but you have to give executable permissions (Ubuntu 9.04) for that file with the command: "sudo chmod 755 /usr/bin/sabgetdata".

Re: SABnzbd stats script for XChat (linux)

Posted: June 24th, 2009, 12:33 pm
by lommes
Yeah and only working with Plush so far. The other templates do not inlude the information at the same place.

Re: SABnzbd stats script for XChat (linux)

Posted: June 26th, 2009, 12:59 pm
by lommes
Update:

First of all THX to jcfp for reviewing, shortening, improveing and speeding up my code from the first post!

This version:
- much faster
- using api
- some more options in XChat (i.e. display to yourself only ... /sab help or have a look to the README)
- README file which explains how to install and use
- working with templates other than Plush



Image

Re: SABnzbd stats script for XChat (linux)

Posted: June 26th, 2009, 7:58 pm
by fredlkrue
Great improvement, fast response. I think you need to add in the README file that we need to install xml2, also I suggest you change sabnzbd+ to SABnzbd+, I think it will look much better :)

EDIT: Will it be possible to have just one file, like for example just the tcl file. Also add the name of the current downloading (NZB) file to the stat spam.

Re: SABnzbd stats script for XChat (linux)

Posted: June 27th, 2009, 9:54 am
by lommes
I added the possibility to add the current nzb to the output, but its optional because it maybe a very long term or illegal stuff.

AUTHENTIFICATION ADDED!

/sab nzb - will print the current nzb to yourself
/sab +nzb - will add the nzb to the channel spam

README is updated and sabnzbd+ is changed to SABnzbd+ in the XChat output.

It should be possible to merge the files so only the tcl is needed, but i use this script for other purpose too so it would double my work in updating ;)

Re: SABnzbd stats script for XChat (linux)

Posted: June 27th, 2009, 11:12 am
by fredlkrue
Thanks a lot  ;) ..

Re: SABnzbd stats script for XChat (linux)

Posted: June 29th, 2009, 12:07 pm
by lommes
* Added Pause/Resume
* Menu in XChat
* Script is now executed from ~/.xchat2

Image

Re: SABnzbd stats script for XChat (linux)

Posted: June 29th, 2009, 12:14 pm
by Shadowtester
Is there any chance to get this working in window xp for us poor saps who have to use windows on some pc's who also use Xchat and SABnzbd+ on remote machines

Re: SABnzbd stats script for XChat (linux)

Posted: June 29th, 2009, 12:32 pm
by lommes
The Script uses many unix commands to arange the SABnzbd+ output. These commands are not available in WinXP (out of the box). Most of them 'maybe' available through gnuwin32 (like sed). But even if all of the used commands are available there is no guarantee that the script will work. I don't have any windows running so no chance to do some testing.

Re: SABnzbd stats script for XChat (linux)

Posted: June 29th, 2009, 2:31 pm
by fredlkrue
Thanks a lot lommes, great features :)

Maybe too much to ask, but maybe a way to be able to change colors without editing the script with a text editor, like using a gui in xchat.

EDIT: Maybe its a good idea to add the options pause and resume under "Valid options"

Code: Select all

		print "Usage: /sab option"
		print ""
		print "Valid options are:"
		print "speed    - Current Speed"
		print "queue    - Queue Size"
		print "eta      - ETA"
		print "dltotal  - Totally downloaded"
		print "e        - Displays all the above options"
		print "nzb      - Displays the current NZB"
		print "+nzb     - Adds the NZB to the channel spam"
		print "pause    - Pauses SABnzbd+"
		print "resume   - Resumes SABnzbd+"
		print ""

Re: SABnzbd stats script for XChat (linux)

Posted: June 30th, 2009, 3:41 pm
by lommes
Download see first reply

Changes:
0.6

* added trigger /sabadd
* 'silent' output of /sab nzb now includes the remaining size of the current download
* output of option help updated


0.5

* XChat menu added
* pause/resume added


0.4

* authentification added
* option nzb and +nzb added
* changed sabnzbd+ to SABnzbd+ in the XChat output