nznzb 0.50
==========

nznzb is a multi-threaded NZB file downloader for usenet. You need
to grab a nzb file from somewhere, then pass it as an argument to 
nznzb. For example:

   nznzb somethinguseful.nzb

This will kick off multiple download streams to improve
speed.

If the NZB file refers to a multipart rar archive, nznzb will 
try to download the rar files in the order required to unrar them.
Once nznzb has downloaded the first rar file, unrar is launched as
a background task and will progressively extract as new rar files
finish downloading. This is useful if you are downloading a video file
that has been broken into multiple rar files. This effectively
gives you very basic streaming. ie. You can watch something while its 
downloading assuming your internet connection is fast enough (this
also assumes that the rar parts aren't corrupt)

Installation
============

On linux:

   gcc -o nznzb -lpthread -lssl -DLINUX nznzb.c

On Mac OS X:

   gcc -o nznzb -lpthread -lssl -DMACOSX nznzb.c

(I'm not too sure about other Unix's, but if you
 have a BSD type system, try compiling it for OS X)

Now copy the nznzb binary to somewhere in your path:

eg.

  sudo cp nznzb /usr/local/bin


Config
======

You have to have a config file in your home directory

Filename is $HOME/.nznzbrc

It should look like:
####################
# comments
server = nntp.someprovider.net
port = 119

user=myusername
pass=blahblah

threads=7

auto_unrar =1 
extract_to /tmp

#######################

If you want to use SSL with your provider then
put in the right server and port as well as ssl=1:

server = nntps.someprovider.net
port = 563
ssl = 1

user and pass are for NNTP servers that require a username and
password. Leave them or comment them out if your server doesn't
require a user/pass

thread is for how many parallel download streams you want.

auto_unrar=1 means that if the thing you're downloading is a
multipart rar, then start unrar'ing it as soon as the first 
rar part finishes downloading (you need to have unrar in your path 
somewhere for this to work). For example, if the first file 
is myhomevidio.rar, then that will get downloaded first,
and it'll run unrar in the background. As soon as myhomevideo.r00 
downloads it'll get fed into unrar to continue the process and so on

extract_to is only relevant to the unrar process. Its the 
destination directory for the unrar. If you don't specify it in the
.nznzbrc file you can put it on the command line:

   nznzb somefile.nzb /mystuff


History
=======

v0.50  - 10.9.2007
         Added in SSL support, and also got the uudecode stuff going again. Not well
         tested though. yEnc stuff works very well though.
         uudecoding is handled by running the program 'uudecode' 
         externally (ie. must be in your path somewhere)
         yEnc decoding is handled internally 
         Can now compile on a MAC as well. Lots of ifdefs in the pseudo term
         stuff for MACs
         You can actually compile it without SSL support by commenting out the USE_SSL
         define at the top of the source code.


Bugs/Features
=============

- Since I started writing this thing I hav occasions when all the socket
  connections to my usenet host die (or more importantly fgets returns an error).
  There is quite a bit of logic to try to reconnect again and go ... but 
  I'm not 100% sure its the greatest solution. Still working on it
- Change DEBUG to 1 in the source file to get more debug output
- It will tend to resume (to some degree). If you have downloaded blah.rar,
  blak.r00, blah.r01 , and then ctrl-c out and start again, it will start to 
  download blah.rar, but work out it's already got it while reading the first segment.
  ie. it'll download a bit of each of those files again, before eventually
  getting to blah.r02. The stats about the ETA and transfer speed will be wildly
  wrong ... but it will finish OK.
- The mini-expect code needs to be a bit smarter. Has a horrible buffer
  limit that is annoying.
- I don't think this version will handle multiple nzb files specified on the
  command line. 
- Each download thread generates a file called 'thread_....', and each file
  segment will end up with a part_x_y file. You can generally do a
   rm thread_* part* 
  before starting nznzb again
