Usenet downloader

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 08:45, 28 November 2007 by Methanoid (Talk | contribs)

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

[Sources/Credits Methanoid & Fantasymick on NAS-central.org, Caveman on OpenFSG.com and DrChair at wl500g.info]

This has been tested and works well on a ARM9 Linkstation Live. Should work on others. Initial work: You need access to the box via Freelink or Open Stock firmware or similar You need IPKG installed and to have picked up the ARM9 feed from NSLU2-Linux.org You need to telnet into the box as root.

Installing is made much easier by a recent update in the ARM9 feed which now includes a Hellanzb package.

ipkg update ipkg install py-hellanzb (or if you want to use python2.5, then ipkg install py25-hellanzb)

This installs Python, HellaNZB and all the dependencies such as Twisted, RAR, Par2Cmdline and the faster YEnc decoder

But you will need to configure Hellanzb

cd /opt/local/bin vi hellanzb.conf

You need to change the settings to match those of your usenet provider (username, password, server,number of connections). Remember, the Linkstation is a NAS box not a high spec PC so don't be too greedy on the number of connections as it might actually make it go slower. For example, I can happily max out a 4Mbit line with 4 connections. Try different numbers and see how you get on.

  1. Set both the username and password to 'None' (without the quotes) if your
  2. usenet server does not require authorization

defineServer(id = 'your usenet', hosts = [ 'yourusenet:119' ],

  1. hosts = [ 'news.changeme.com', 'morenews.changeme.com:8000' ],

username = 'your username', password = 'your password',

  1. username = None, # no auth
  2. password = None,

connections = 4,

  1. Important locations

Hellanzb.PREFIX_DIR = '/mnt/disk1/shared/download'

A further important change is to fix the permissions (you want to be able to move files from the download directory presumably?) so change Hellanzb.UMASK = 0022 to Hellanzb.UMASK = 0000

Move the resulting config file to where the actual Hellanzb python script is located

mv hellanzb.conf /opt/local/bin/hellanzb.conf

Now there should be hellanzb.py and your hellanzb.conf there. Now you can fire up hellanzb either from command line or from script.

cd /opt/local/bin python hellanzb.py -D

The -D makes it run in Daemon mode, i.e it runs in the background until stopped.

{edit] put script reference in here - the script is something like S71hellanzb and to run sh it. ./opt/etc/init.d/S71hellanzb If everything went well hellanzb is running and will create the necessary sub-dirs in the dir you created

/mnt/disk1/shared/download /mnt/disk1/shared/download/nzb /mnt/disk1/shared/download/nzb/daemon.current /mnt/disk1/shared/download/nzb/daemon.queue /mnt/disk1/shared/download/nzb/daemon.postponed /mnt/disk1/shared/download/nzb/daemon.temp /mnt/disk1/shared/download/nzb/daemon.processing /mnt/disk1/shared/download/nzb/daemon.working

Just pop your NZB file in the /mnt/disk1/shared/download/nzb/daemon.queue dir and hellanzb will start downloading and pop the unarchived resulting files in your destination directory.

You can monitor (without a web frontend) by typing python hellanzb.py status

Realistically you will probably want a web based frontend. Hellahella doesn't seme to want to run but Zussaweb works fine with Lighttpd. You could use a 2nd instance of Apache or maybe piggyback on the Apache that runs the LS's web interface but it didn't work for me.

ipkg update ipkg install lighttpd ipkg install fcgi-php

You'll need to configure (of course)

vi /opt/etc/lighttpd/lighttpd.conf

change

  1. "mod_fastcgi",
 into
                               "mod_fastcgi",
change

url.access-deny = ( "~", ".inc" )

 into

url.access-deny = ( "~", ".inc", ".sqlite" )

 change
  1. fastcgi.server = ( ".php" =>
  2. ( "localhost" =>
  3. (
  4. "socket" => "/tmp/php-fastcgi.socket",
  5. "bin-path" => "/usr/local/bin/php"
  6. )
  7. )
  8. )
 into

fastcgi.server = ( ".php" =>

                              ( "localhost" =>
                                (
                                  "socket" => "/tmp/php-fastcgi.socket",
                                  "bin-path" => "/opt/bin/php-fcgi"
                                )
                              )
                           )


Give some thought as to where you want to have your webpages. I like mine accessible to my Windows PCs so that I can edit directly in Frontpage or whatever but in this case I won't change the defaults.. Also you may need to open a port to the webserver if you want to have your Zussaweb available remotely over the internet.

Now you are ready to start lighttpd by /opt/etc/init.d/S80lighttpd

Next download and unpack zussaweb:

cd /opt/tmp wget http://download.sourceforge.net/sourceforge/zussaweb/zussaweb03.tar.gz cd /opt/share/www/lighttpd/ tar -xzvf /opt/tmp/zussaweb03.tar.gz

Next you need to change the values of $disk and $download_nzb_path in the file /opt/share/www/lighttpd/zussaweb/settings.php

Finally we need to fix a bug: Edit /opt/share/www/lighttpd/zussaweb/functions.php and change:

function freediskspace() {

       return (round (disk_free_space(disk)/1024/1024,2));

}

to

function freediskspace($disk) {

       return (round (disk_free_space($disk)/1024/1024,2));


Now you can use the interface at http://linkstation:8081/zussaweb/

Remaining issues needing fixing

1) Getting Hellanzb to start up in daemon mode when LS starts. 2) Getting the "upload an NZB" and "enter Newzbin ref" options in Zussaweb to work right.