Page 1 of 1

How to add an NZB from the command line

Posted: September 1st, 2010, 6:52 am
by revelation60
I am writing a .desktop file for sabnzbd, so I can just click on my NZBs to load them into SABnzbd. What I don't know is what URL I should call to add a file. Or should I invoke a python script?

Re: How to add an NZB from the command line

Posted: September 1st, 2010, 6:56 am
by shypike
Which Operating System are you using?

Re: How to add an NZB from the command line

Posted: September 1st, 2010, 6:58 am
by revelation60
Linux.

Re: How to add an NZB from the command line

Posted: September 1st, 2010, 9:14 am
by revelation60
How do you do it in Windows? It must be somewhat the same, as python and the http calls are platform independent.

Re: How to add an NZB from the command line

Posted: September 1st, 2010, 2:48 pm
by shypike
On Windows SABnzbd can bind itself to the NZB extension.
I'm not sure how to do that on Linux.
From the command line you just start SABnzbd again with the nzb-path as the only parameter.
It will try to find out if another instance is running and pass the NZB.
You should either use the standard profile location ~/.sabnzbd or pass the same -f parameter as well.

Re: How to add an NZB from the command line

Posted: September 2nd, 2010, 3:53 pm
by revelation60
I can't manage to get sabnzbd to load an nzb. I tried the following things:

python /opt/sabnzbd/SABnzbd.py test.nzb
python /opt/sabnzbd/SABnzbd.py test.nzb -f /opt/sabnzbd/sabnzbd.ini
sudo su - sabnzbd -c "python /opt/sabnzbd/SABnzbd.py -f /opt/sabnzbd/sabnzbd.ini -s localhost:8080 test.nzb"

The command only has to work when there is already an instance of sabnzbd running. I hope the solution is similar to my first attempt, because I can't specify a lot of customized parameters from a file association.

Re: How to add an NZB from the command line

Posted: September 3rd, 2010, 5:48 am
by shypike
Personally I would setup a "Watched" Folder" in SABnzbd and use
a small script to copy the NZB into the Watched folder.
Associate the script with the .nzb extension.

Re: How to add an NZB from the command line

Posted: September 3rd, 2010, 9:00 am
by revelation60
Ok. I am trying to add this feature to a package, because I am the maintainer, so setting up a folder is not really going to work. I will try adding through the API now, although I would have preferred just calling the python file.

Re: How to add an NZB from the command line

Posted: September 3rd, 2010, 1:45 pm
by jcfp
Maybe this could be of use?