np1/pafy — pull request #8 by ElegantMonkey (2013-09-06 17:12:41+00:00)
Title: Download function with callbacks

This implements a download function that uses callbacks instead of printing. The new function is under `Stream.download_with_callback(self, prepare_callback=None, progress_callback=None, filepath="")`. If passed None, function won't be called.

* Prepare callback has one argument - total - that is the total size of the video.
* Progress callback has four arguments - bytesdone, percentage, eta, rate - correspondant to those used with print.

The old, printing function - download - is still there, but now uses callbacks for printing.