SABnzbd Java API

Got a program that plays well with SABnzbd? Share it here!

SABnzbd Java API

Postby adam » February 20th, 2010, 10:46 am

HI guys, started using SABnzbd a couple of weeks back, fantastic work guys. I have started development of a Java API (I believe one does not exist?). For more information please visit my blog for now: http://aboulton.blogspot.com/2010/02/sa ... a-api.html

Currently got a few mates doing some tests and I will be releasing it soon. I hope some of you will find this useful. Here is my "hello world" example of utilising the API:

String[] nzbs =
{"http://www.newzbin.com/browse/post/5569239/nzb",
"http://www.newzbin.com/browse/post/5568352/nzb"};

String sabURL= "http://sabserverurl";
SABnzbd mySabServer= new SABnzbd(sabURL, "uname", "pwd");

System.out.println("Current download speed: " + mySabServer.getDownloadSpeed());

for(String nzb: nzbs)
{
mySabServer.download(nzb);
}

List queue = mySabServer.getQueue();

if (queue.isEmpty()) {
  System.out.println("No download entries");
} else {
  for (QueueEntry qu : queue) {
    System.out.println("---- New Entry --- ");
    System.out.println("Category: " + qu.getCategory());
    System.out.println("Name: " + qu.getName());
    System.out.println("Reamining " + qu.getRemain());
    System.out.println("Total:" + qu.getTotal());
    System.out.println("ETA: " + qu.getEta());
  }
}


Also, I am considering putting together a client together for the BlackBerry, would people find this useful?

Cheers and keep up the great work guys!


Adam
Last edited by adam on February 20th, 2010, 11:13 am, edited 1 time in total.
adam
Newbie
Newbie
 
Posts: 5
Joined: February 20th, 2010, 10:38 am

Re: SABnzbd Java API

Postby adam » February 20th, 2010, 11:14 am

adam wrote:HI guys, started using SABnzbd a couple of weeks back, fantastic work guys. I have started development of a Java API (I believe one does not exist?). For more information please visit my blog for now: http://aboulton.blogspot.com/2010/02/sa ... a-api.html

Currently got a few mates doing some tests and I will be releasing it soon. I hope some of you will find this useful. Here is my "hello world" example of utilising the API:

String[] nzbs =
{"http://www.newzbin.com/browse/post/5569239/nzb",
"http://www.newzbin.com/browse/post/5568352/nzb"};

String sabURL= "http://sabserverurl";
SABnzbd mySabServer= new SABnzbd(sabURL, "uname", "pwd");

System.out.println("Current download speed: " + mySabServer.getDownloadSpeed());

for(String nzb: nzbs)
{
mySabServer.download(nzb);
}

List queue = mySabServer.getQueue();

if (queue.isEmpty()) {
  System.out.println("No download entries");
} else {
  for (QueueEntry qu : queue) {
    System.out.println("---- New Entry --- ");
    System.out.println("Category: " + qu.getCategory());
    System.out.println("Name: " + qu.getName());
    System.out.println("Reamining " + qu.getRemain());
    System.out.println("Total:" + qu.getTotal());
    System.out.println("ETA: " + qu.getEta());
  }
}


Also, I am considering putting together a client together for the BlackBerry, would people find this useful?

Cheers and keep up the great work guys!


Adam
adam
Newbie
Newbie
 
Posts: 5
Joined: February 20th, 2010, 10:38 am

Re: SABnzbd Java API

Postby bdawg » May 5th, 2010, 7:59 am

Hi Adam,

I'm a BlackBerry fanatic, and would love a BB client for SABnzbd!

I work in the messaging space, and spend a lot of time with BES solutions. I am happy to test any applications that you may have, though I am not a developer so I can't really help out too much in that area.

Let me know if you need me to test anything and I'd be happy to do so :)
bdawg
Newbie
Newbie
 
Posts: 5
Joined: March 29th, 2010, 5:14 pm

Re: SABnzbd Java API

Postby adam » July 4th, 2010, 9:34 am

Hi,

In regards to the Java Sabnzbd API there is now a Google Code project page that I have setup. The API is extremely easy to use. You can find more details about this project here:

http://code.google.com/p/jsabnzbd/

I have started development for the BlackBerry client and hopefully should have something decent by the end of the month (July 2010).

Cheers and I look forward to any feedback in regards to the Java API.
adam
Newbie
Newbie
 
Posts: 5
Joined: February 20th, 2010, 10:38 am

Re: SABnzbd Java API

Postby jonneymendoza » July 14th, 2010, 7:32 am

eh? why would you need a java api to use this server? whats wrong with using the sab's own API like the rest of us? im working on a android java app and im doing fine using SAB's api.

not trying to sound rude but trying to understand why you need a SAB java api
jonneymendoza
Newbie
Newbie
 
Posts: 36
Joined: April 27th, 2010, 6:12 am

Re: SABnzbd Java API

Postby adam » July 14th, 2010, 9:44 am

Hi,

"whats wrong with using the sab's own API like the rest of us?"

There is nothing wrong with the SAB API, it is well designed and developed.

"why would you need a java api to use this server?"

The reason I fitted a Java API around the SAB API (which is just GET requests) is that it easily allows for me to utilise more of Java technologies, such as utilising this in applets, RMI and providing a simplified use of serialising the data. Not only that, if offers more support for validation and error handling.

If anyone is using the SAB API in a Java based application (or any other language) you will have to manage the HTTP requests and parsing of the XML feeds, just like my API does internally. So, to help improve development times and re-usability I offered up my Java API. As you can see from the sample code on the Google project page it is extremely easy to use.

As a Developer, you will understand that when coding you strive to develop an API (if you don't use OO languages I appreciate this may be difficult to grasp). I have also written the API for the BlackBerry platform, as it makes sense to do so.

Kind regards

Adam
adam
Newbie
Newbie
 
Posts: 5
Joined: February 20th, 2010, 10:38 am

Re: SABnzbd Java API

Postby CranialBlaze » January 5th, 2011, 6:51 pm

How does one use this, i have a blackberry and it does not recognize the jar as in installable file
CranialBlaze
Newbie
Newbie
 
Posts: 7
Joined: May 29th, 2010, 7:57 am

Re: SABnzbd Java API

Postby atnguyen001 » January 6th, 2011, 3:38 am

String[] nzbs =
{"http://www.newzbin.com/browse/post/5569239/nzb",
"http://www.newzbin.com/browse/post/5568352/nzb"};

String sabURL= "http://sabserverurl";
SABnzbd mySabServer= new SABnzbd(sabURL, "uname", "pwd");

System.out.println("Current download speed: " + mySabServer.getDownloadSpeed());

for(String nzb: nzbs)
{
mySabServer.download(nzb);
}

List queue = mySabServer.getQueue();

if (queue.isEmpty()) {
  System.out.println("No download entries");
} else {
  for (QueueEntry qu : queue) {
    System.out.println("---- New Entry --- ");
    System.out.println("Category: " + qu.getCategory());
    System.out.println("Name: " + qu.getName());
    System.out.println("Reamining " + qu.getRemain());
    System.out.println("Total:" + qu.getTotal());
    System.out.println("ETA: " + qu.getEta());
  }
}

Nice ,thanks.
I'm using BB, this is very useful
Life isn't waiting tu bep, tu bep dep, tu van kien truc.
atnguyen001
Newbie
Newbie
 
Posts: 1
Joined: January 6th, 2011, 3:28 am


Return to Third-party Addons