tumblr_backup: remove an unnecessary with statement
tumblr_backup: add support for downloading audio and videos

Optional dependency to youtube_dl for external embedded videos.

On Debian: apt-get install youtube-dl

Also see http://rg3.github.io/youtube-dl/index.html
tumblr_backup: minimal cleanup of the previous commit
tumblr_backup: more minor cleanups for audio/video downloads
tumblr_backup: add two options to enable audio and video download
tumblr_backup: fix error while d/l protocol agnostic inline images

Fixes #30.

Got this error while doing python tumblr_backup.py -t me nikkiediamond
(NSFW!):

Traceback (most recent call last):
 File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "tumblr_backup.py", line 799, in handler
    work()
  File "tumblr_backup.py", line 559, in save_content
    append_try('regular-body')
  File "tumblr_backup.py", line 549, in append_try
    self.get_inline_image, elt
  File "/usr/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "tumblr_backup.py", line 658, in get_inline_image
    saved_name = self.download_image(image_url, image_filename)
  File "tumblr_backup.py", line 675, in download_image
    image_response = urllib2.urlopen(image_url, timeout=HTTP_TIMEOUT)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 393, in open
    protocol = req.get_type()
  File "/usr/lib/python2.7/urllib2.py", line 255, in get_type
    raise ValueError, "unknown url type: %s" % self.__original
ValueError: unknown url type: //i.imgflip.com/8kv0m.gif [NSFW!]
Merge branch 'master' into api-v2
tumblr_backup: unify media download

All media are saved in media/. Use the same method to download photos,
audio and Tumblr-hosted video. Media are downloaded in 1MB-sized chunks.

NOTE: The old 'images' directory is left as-is, because old saved posts
may still point to images saved there. If you intend to do a new
complete backup, it makes sense to rename 'images' to 'media' first, so
that the images already downloaded can be reused.
tumblr_backup: documentation update
tumblr_backup: refactor file name generation
Merge branch 'gh-32' into api-v2

NOTE: The 'images' directory is renamed to 'media'.

The old 'images' directory is left as-is, because old saved posts
may still point to images saved there. If you intend to do a new
complete backup, it makes sense to rename 'images' to 'media' first, so
that the images already downloaded can be reused.
Remove password option

Remove password option which is no more available with api-v2
Add a -Q option to perform complex saving requests

Add the following option: -Q REQUEST, --request=REQUEST

Save posts following the pattern TYPE:TAGS. TYPE can be any, text,
quote, link, answer, video, audio, photo, chat; TAGS can be omitted.
TAGS can be comma-separated values, REQUEST semicolon-separated
patterns. Example: "-Q any:personal;quote;photo:me,self"

This is a squashed commit of the following:

commit 908a74b734f342a1515f6da085d8a72e32bfa67a
Author: WyohKnott <clare.tor86@gmail.com>
Date:   Mon Oct 27 14:35:31 2014 +0100

    Convert -T and -t options to the request syntax

    - the -t and -T options callbacks convert the parameters to the request
      syntax
    - a new function request_append merge the filters set by -t, -T and -Q
      callbacks
    - requesting an entire type supersedes any tag based filter. For
      example, using "-T text -t personal" will save all posts tagged
      personal and all text posts.

commit 3ccadc5e1b9457052b5e6b1f6f72be5621c4e5d1
Author: WyohKnott <clare.tor86@gmail.com>
Date:   Mon Oct 27 11:58:03 2014 +0100

    Simplified options.request callback

commit e725998a047f561891d5c221c0f1297fd8905883
Author: WyohKnott <clare.tor86@gmail.com>
Date:   Sun Oct 26 11:03:51 2014 +0100

    Add a -Q option to perform complex saving requests
tumblr_backup: simplify the -Q handling
tumblr_backup: simplify -Q syntax

WARNING: This commit breaks existing scripts that use -Q.

Change the TAG separator to colon, and the rule separator to comma.
The new rule syntax is now TYPE:TAG:TAG:…,TYPE:TAG:…,….

This is a win because of two factors:

  - The semicolons between the rules had to be quoted in typical Unix
    shells.

  - Using the same separator inside one rule makes parsing the rule
    easier.

In effect, the -T and -Q options are now equivalent. But don't tell
anyone, because the manual doesn't say so ;-)

Also add documentation for -t and -Q.
Merge branch 'gh-39' into api-v2
tumblr_backup: fix a forgotten variable rename
tumblr_backup: mark threadpool tasks as done if they throw an exception
Merge branch 'master' into api-v2
tumblr_backup: DRY the format of the archive file name