jplehmann/coursera — pull request #126 by jonasdt (2013-06-19 19:19:52+00:00)
Title: Refactor downloading

This pull requests was motivated by the discussion in issue #118.

The `downloaders` module provides the interfaces to the external downloaders (curl,
…) and our own native downloader.

The class structure is deliberately very simple:
A downloader is a class that extends `downloaders.Downloader`. The only thing that it should implement is a `_start_download`method, which has as arguments the url to download and the target file.

Using a downloader is straightforward:

>>> import downloaders
>>> d = downloaders.SubclassFromDownloader(args)
>>> d.download('http://example.com', 'save/to/this/file')

The external downloaders all subclass `downloaders.ExternalDownloader`.
The native downloader is `downloader.NativeDownloader`.

In the main program we use the `coursera_dl.get_downloader` factory.

Everything still works for me, but please test!