Setup sabnzbd

From WikiDLXTV
Revision as of 19:29, 27 April 2013 by Spazlon (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SABnzbd is an Open Source Binary Newsreader written in Python.

What is SABnzbd?

SABnzbd[1] is an Open Source Binary Newsreader written in Python.

It's totally free, incredibly easy to use, and works practically everywhere.

SABnzbd makes Usenet[2] as simple and streamlined as possible by automating everything we can. All you have to do is add an .nzb. SABnzbd takes over from there, where it will be automatically downloaded, verified, repaired, extracted and filed away with zero human interaction.

Installation

Prerequisites

Setup

  1. SSH into your WDTV and navigate to the root of your USB drive. (ie. /tmp/media/usb/USB1/49dke83hdkj482/)
  2. Download and extract Optware, then reboot:
    wget http://b-rad.cc/binaries/opt.bin.tgz && tar -zxvf opt.bin.tgz && reboot
  3. After the WDTV reboots, SSH in again.
  4. Update Optware, install SABnzb+ and its dependencies: (this could take a while)
    ipkg update && ipkg install sabnzbdplus python26 py26-cheetah py26-openssl screen unrar htop iftop git
  5. Update to the newest SABnzbd:
    cd /opt/share && rm -r SABnzbd && git clone https://github.com/sabnzbd/sabnzbd.git SABnzbd
  6. Rename conflicting library:
    mv /opt/lib/python2.6/lib-dynload/_locale.so /opt/lib/python2.6/lib-dynload/_locale.so.bak
  7. Reboot:
    reboot
  8. After the WDTV reboots, SSH in again.
  9. Start SABnzb for the first time in a screen (this will take a few seconds):
    screen -dmS SABnzbd /opt/bin/python2.6 /opt/share/SABnzbd/SABnzbd.py -s 0.0.0.0:8080 -f /opt/share/SABnzbd/sabnzbd.ini -b 0 -l 2 -w 1 --log-all
  10. SABnzbd is now running in a screen on your WDTV. On a PC navigate to http://<wdtv ip>:8080/sabnzbd. A wizard will launch and allow you to complete the SABnzbd setup.
  11. After you complete the setup wizard you will need to move some folders and restart SABnzbd. Press CTRL+C in SSH to stop SABnzbd.
  12. Move the cache to your HDD so you don't run out of space on the WDTV:
    mkdir /tmp/media/usb/USB1/49dke83hdkj482/.downloads/ && mv /opt/shareSABnzbd/cache /tmp/media/usb/USB1/49dke83hdkj482/.downloads
  13. Edit your sabnzbd.ini to update the new folders (edit the complete_dir, incomplete_dir and cache_dir directories):
    nano /opt/share/SABnzbd/sabnzbd.ini
  14. Start SABnzbd again.
    screen -dmS SABnzbd /opt/bin/python2.6 /opt/share/SABnzbd/SABnzbd.py
  15. Load SABnzbd on your PC again.


Autostart

If this was a success, you might be interested in getting SABnzdplus to launch automatically at boot. This is done by creating a script and placing it in /opt/etc/init.d/. Here's how my script looks. Adjust according to IP, paths, user/pass etc.

#!/opt/bin/bash
case "$1" in
start)
  echo "Starting SABnzbd."
  /opt/bin/python2.6 /opt/share/SABnzbd/SABnzbd.py -f /opt/share/SABnzbd/sabnzbd.ini -d
;;
stop)
  echo "Shutting down SABnzbd."
  wget -q --delete-after "http://localhost:8080/sabnzbd/api?mode=shutdown&ma_username=[USER]&ma_password=[PASS]&apikey=[APIKEY]"
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
;;
esac
exit 0


Just save it as "S##SABnzbd", the # being a numeric value between 0 and 9 in accordance with WDLXTV's execution order (thanks b-rad). For instance, the name "S89SABnzbd" works for me. Remember to place the file in /opt/etc/init.d/, locate it using telnet/ssh and use the following command to get it executable:

chmod +x S89SABnzbd


Now everything left for you to do is configuring SABnzdplus. Enjoy

/ch1ptune

taken from: Wdlxtv Forum

Fix Memory Usage

SABnzbd uses a lot of RAM. When you run SickBeard and Couch Potato along with it the WDTV can start to really slow down to the point where it is almost unusable. The way to get around this is to use a kernel that has swap support.

This is for a WDTV Live Plus only!!! Do not use this kernel on any other WDTV or you will brick it! Use at your own risk!

Here are the step to create a swap file:

  1. Download this kernel from b-rad's site[3] (Thanks b-rad)
  2. Re-flash your firmware with it. This will work on any of the WDTV Live Plus firmwares. Do not use this on anything other than a Live Plus.
  3. Log into the WEC and on the Main tab near the bottom you will see Advanced:Swap.
  4. Enter then amount of space you want and click submit. (Thanks RMerlin)

High-Speed Tweaks

Try to use python2.5 instead of python2.6, seems like python2.5 is a little bit faster.

Set the article cache in Config -> General. This will keep articles in memory and not write them to disk (which is slower). Try 50M or 70M (the M denotes megabytes and is required). Keep in mind that wdtv has not much free memory! 50M seems to be a good value.

Make sure python-yenc is installed (yenc-0.3.tar.gz or higher). This will speed up decoding as it will use C code instead of python code. The logging will say at startup whether this module has been installed. It will be installed with python2.5. It seems there is no package for python2.6.

Lower your connection count in Config -> Servers. Good values are 3-6 connections.

It seems like max speed with sabnzbd on wdtv is around 2 Mbit/s!

Troubleshooting

If you get "Segmentation fault" try the following: Start sabnzb with "-v" (verbose).

/opt/bin/python2.6 /opt/share/SABnzbd/SABnzbd.py -f /opt/share/SABnzbd/sabnzbd.ini -d -v

Then you see the lib that is causing the error. Should be perl/lib/xxxx.so. Just rename the file and start sabnzbd again.

(I don't know who wrote the above, but it didn't work for me. If it doesn't work for anybody else, please remove it. - spazlon)

For anything specific to SABnzb please refer to their various options for support:

What's Next?

Get a usenet account

SABnzb isn't much use without a usenet account. Most people use something like GigaNews, but there are alternatives out there depending on your needs. Here are a few I have found, feel free to add anything you recommend.

UseNet Providers
Name Price DL Retention Connections SSL Bandwidth Free Trial Notes
SuperNews $10/mo Unlimited 1,215 Days 30 Yes 100Mb No This service is comparable to GigaNews. They have very similar specs, but SuperNews is cheaper (but doesn't have all the options like VPN service). This is the service recommended by the guys in the SABnzbd chat room.
GigaNews $17/mo Unlimited 1,225 Days 50 Yes 1Gb 14 Days Probably the most popular usenet provider. Their premium package listed here also provides a VPN and a usenet client. They have other packages, but this is the best one for the price. You also get the first month free when you sign up.
EasyNews $30/mo 150GB 1,200 Days Unlimited Yes 1Gb 14 Days These guys are pretty good. I just listed the most expensive package here because it is the best value, but they have cheaper packages. The best thing about EasyNews is that they have Rollover Gigs. That means if you don't use all the bandwidth you paid for, it will roll over to the following month. See here[4] for details.
XS Usenet Free Unlimited Unknown 2 Yes 1Mb Free service This is what I use. They aren't the greatest, but they are the cheapest I have found so far. With their free account you are limited to 2 connections (with SSL) and a 1Mb download. I don't know what their retention is, but they always have the newest show I am looking for. If you aren't sure if usenet is for you, try this service first.


Sign up for a NZB service

To start downloading files you need to get NZBs. These are pointers to the actual files, kind of like torrents. There are several options, but the 2 easiest are:

  • NZB Matrix - Here you can download up to 10 zipped NZB files per day for free. When you upload these ZIP files to SABnzbd's web interface it will begin to download the file from your usenet service. For ~$10 every 10 years ($1/yr) you get unlimited downloads, bookmarks, RSS feeds and much more.
  • Newzbin - Newzbin is similar to NZB Matrix, but they charge a very small fee per NZB. Check their site for details, but I felt the price to be a bit too much for me.
  • RSS Feeds - If you find a site that releases NZBs in an RSS feed, you can use Yahoo! Pipes to create a custom feed of only the files you want, then add that to SABnzbd in the configuration settings.

Sickbeard

Sick Beard is a PVR for newsgroup users (with limited torrent support). It watches for new episodes of your favorite shows and when they are posted it downloads them, sorts and renames them, and optionally generates metadata for them. It currently supports NZBs.org, NZBMatrix, NZBs'R'Us, Newzbin, Womble's Index, NZB.su, TVTorrents and EZRSS and retrieves show information from theTVDB.com and TVRage.com.

Installation

  1. SSH into your WDTV.
  2. cd into /opt/share.
  3. Get the newest SickBeard:
    git clone https://github.com/midgetspy/Sick-Beard.git SickBeard
  4. Run SickBeard in a new screen:
    screen -dmS SickBeard /opt/bin/python2.6 /opt/share/SickBeard/SickBeard.py

Autorun

#!/opt/bin/bash
case "$1" in
start)
  echo "Starting SickBeard."
  screen -dmS SickBeard /opt/bin/python2.6 /opt/share/SickBeard/SickBeard.py
;;
stop)
  echo "Shutting down SickBeard."
  wget -O - -q --delete-after --user=USERNAME --password=PASSWORD "http://localhost:8081/home/shutdown/" >/dev/null
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
;;
esac
exit 0


Couch Potato

CouchPotato is an automatic NZB and torrent downloader. You can keep a "movies I want"-list and it will search for NZBs/torrents of these movies every X hours. Once a movie is found, it will send it to SABnzbd or download the .nzb or .torrent to a specified directory.

I haven't tried these yet, but people in the forums have reported that it works. When I get these working I will update this. If anybody else has this working, please add your contributions!

Tips

  • Screen will create a new session. If you want to continue to run the process in the background, or detach the screen, press CTRL+A, then CRTL+D. This will leave the screen and bring you back to your original SSH session. To go back to your detached screen, use screen -r.