lemoncube.com Search: (normal)
Articles
Links
News
Projects

Disclaimer

nznzb - NZB download utility

Quickstart

nznzb is a utility for downloading multi-part binaries off usenet using NZB files. There is usually just one option; an NZB file:
  nznzb something.nzb
All temp files, log files and the resulting binary files you're downloading end up in the current directory. Make sure you have plenty of disk space.

Details of the usenet server you're connecting to are kept in your ~/.nznzbrc file. Currently there aren't too many options to fuss over:

   # A comment
   server = myusenet.serve.net
   port = 119

   user=hamster
   pass=getwell

   threads=7
The .nznzbrc file is reasonably free form; you can have blank lines, comments, and spaces before and after the = signs. server is mandatory, but port will default to 119 if you leave it out. The user, pass settings are only required if your usenet server requires authentication. If you leave the user/pass settings out of the .nznzbrc file, it'll assume that no authentication is required. The threads setting defines how many download threads you want running. Generally the more you have, the faster you get your files. There is a limit of 15 threads, and you should check with your usenet provider, as they may impose a limit anyway.

nznzb has a builtin yEnc decoder so as a 'part' is downloaded it'll be written to a temp file called 'part_??'. When that's complete, the builtin yEnc decoder will try to decode the file. If the decode successds the part_?? file is deleted, and just get the resulting output file. If it fails for any reason, it'll rename the part_?? file to something like

   crap.rar.SIZEMISMATCH
   crap.rar.CRCFAILED
where 'crap.rar' is meant to be the real name of the file. You might want to try uudeview on the supposed broken file, just in case my yEnc decoder is crap.

If you try to download something which is UUencoded, then nznzb will try to run the external program 'uudecode' against it.

If your usenet server is missing some segments referenced in your NZB file, the resulting output file ends up with padding so that subsequent segments end up at the correct byte offsets. The idea is that when you do a par2repair (assuming there are PAR2 blocks to help you recover) then there'll be more recoverable blocks.

There is also a primitive form of streaming support. If the NZB file refers to a video file that has been broken up into a multipart rar file, nznzb will try to download the rar parts in the correct order required by 'unrar', and feed each rar part to 'unrar' as they arrive. What this means is that as soon as you get the very first rar part, the video will start to be extracted. As additional rar parts are retrieved, extraction of the video will continue. So, as soon as the first rar part is retrieved you can point mplayer at the video file and start watching. There's more information in the README file.

Compiling

Too easy:
   gcc -o nznzb -lpthread -lssl -DLINUX nznzb.c
That works on linux. If you're porting to other platforms, the most likely prob is the type used for the crc32 table. I've just wacked in 'unsigned int' but technically it should be a uint32.

Have fun. I wrote this because I was frustrated with all the dependencies that other linux NZB tools have.

Download