A lightweight NZB downloader

by Emanuele Oriani

What's this myNZB

myNZB is a simple NZB client; its main purpose is not to be a flashy super-duper 1000 features NZB software but merely the kind of software you invoke like this:
myNZB -s my.nntp.server nzb_file1.nzb nzb_file2.nzb ... nzb_fileN.nzb
and then, magic, it will donwload the content of the NZB.


Naturally it has some nice features:
  • Multithread download (you can set how many threads/connections it can use)
  • Uses a connection pool (tries to minimize TCP/IP traffic)
  • Automatically retries to retrieve failed files
  • Uses libnotify to signal the progress of NZB files (dynamically - no need to install it to run myNZB)
  • Written in C++
  • Depends only on yydecode and libmlx2 packages/libraries
And that's it.
You'd say: is not that much!, but think... what do you need an NZB client for?
Donwload NZB and notify what is going on.

How to use it

Once installed, simply invoke:
myNZB [options]... file0.nzb file1.nzb ... fileN.nzb
Options table:
Option Argument Effect
-s server:port NNTP server to connect (port 119 is default port value if not specified)
-u username NNTP username (optional)
-p password NNTP password (optional)
-c [0,n] Number of parallel connections to NNTP server (default 2)
-t [0,n] Wait time (ms) in between downloading NZB segments (default 0)
-y yydecode path Set yydecode path (default "/usr/bin/yydecode")
-o path Set output directory (default "./")
-x [0.0,1.0] Percentage error to retry segments download (default 0.2 that is 20%)
-r (none) Reset the connections to NNTP server for each segment (default not set)
-n (none) Do NOT use libnotify to report about progress (default not set)
-l [0,4] Log level, 0 none - 4 all (default 3)
-Y (none) Strict yEnc encoding search (default not set)
-P (none) (try to) skip the .par2 files
-T (none) Set temporary directory (default "./", suggest to use "/dev/shm" to use ramdisk)
-S [0,n] Set NNTP connections timeout in msec (default 2000, 2 secs)
-W port:password Specify a port:password for the report HTTP web server (default 0, disabled)
-h (none) Print this help and exit

Get it!

This software is written for linux, having Ubuntu as dev platform.
Below are the links to:

Version 0.2.4
  • Ubuntu 32 bit binary here
  • Ubuntu 64 bit binary here
  • Source code (you need libxml2-dev to compile it) here
It is released under the GPL v3, so you'll be entitled to amend/look at the sources!
Just keep in mind that myNZB will use yydecode. If you do compile it yourself (and don't install from packages where instead the dependencies are satisfied) remember to install yydecode (on Ubuntu is sudo apt-get yydecode).
Have fun!
Ps. All old sources/packages are here!


  • When using -T specify /dev/shm to write tmp files in memory, not on disk (less disk usage)
  • Specify the -P flag to skip the par2 files; usually those are not needed


Version 0.2.4
  • ADD ability to save files in subdirectories
  • FIX (www.cpp) web server now uses password instead of directory
Version 0.2.3
  • ADD ability to skip par files
  • ADD memory manager to optimize mem allocation for buffers
  • ADD log debug mode (default is disabled)
  • FIX (main.cpp) now properly try to parse all the NZB files before throwing any error
  • FIX (notify.cpp) restored original notifications
  • FIX (nzb.cpp) now managers/pools/singletons are properly initialized in ST segment of code
  • FIX (nzb.cpp) now fetch_body/fetch_article/dot_unstuff properly terminate the buffer with '\0'
Version 0.2.2
  • ADD report HTTP web server (useful if you want to see what is going on from your phone/away)
  • FIX (nzb.cpp) remove in auto_filer destroyer was calling its method instead of ::remove
  • FIX (connection.cpp) close socket only when valid
  • FIX (notify.cpp) now notifications are being updated; 2 after other very fast will be overwritten (you'll se only last one) but should not have memleaks
Version 0.2.1
  • ADD option to set NNTP connections timeout
Version 0.2
  • First version

Known issues

All the know issues are (so far):

  • Google Chrome is not able to render the progress bar when the web report is being used. A bug has been opened. I hope they'll fix this ASAP.
  • Google Chrome doesn't refresh the page when Refresh button is being hit. This is actually a defect of Chrome (another sigh); then next revision of myNZB will try to cope with this Chrome defect. For now, with Chrome, just reload the page without hitting refresh.
  • Some memory is could be leaking due to libnotify usage (I have to investigate)
If you happen to have any crash, please do feel free to talk about it with me via email. Below is my address!


Why did you develop it?
I was using LottaNZB but that software realies on HellaNZB that with my ISP does suck (a lot of corrupted/unfinished files), so began with the purpose to understand what was going wrong with this software and my ISP. I first developed four stupid lines of code, then I've put them together a little bit better and finally I realized I was going to incorporate some other cool features so...I ended up polishing the code and releasing it.

Why C++ and not ...?
Because C++ allows you to have some kind of flexibility, compactness and speed that many other languages don't offer. Plus I managed to recicle a lot of classes I already wrote for other projects.

Some operations/classes aren't very clear to me.
Don't worry send me an email and I'll explain why...if the comment is interesting I'll post on the website.

Contact the author (Emanuele Oriani)

To contact me send an email to _ema/ at fast_web/ (remove _ / and that is it)

Last update 5 Feb 2010, 9:32