Added parameter to create playlists after downloading a class section
Small change on path to return after playlist creation
Merge pull request #198 from asiviero/master

Added parameter to create playlists after downloading a class section
coursera: Remove superfluous comparison with True.
coursera: Remove trailing whitespace.
coursera: Wrap comment.
coursera: Avoid calling glob.glob too many times.
coursera: Use 4-space indenting.

I hope that I didn't modify the semantics of the code while doing so.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
coursera: Use `with` statement for writing a short file.

This way, we hope to be safer with respect to exceptions and doing it "The
Python Way" (TM).

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
coursera: Use fewer statements per line.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
coursera: Improve help message for the new option.

As suggested by me and agreed by John, we use "for".

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Fix dangling links in documentation.

Some links were already broken, while others are likely to become broken
soon.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
coursera: Add a resource filter.

This useful when courses offer videos in two resolutions (say, high
resolution and low resolution) and you only want one of them.

In my limited experience, the low resolution files are both *much* larger in
size (about 3 times the size of the respective regular resolution videos)
and uglier.

I avoid them with a regular expression passed as:

    --resource_filter '\d+_(?!Low.*Res).*'

Note that every character above in the negative lookup seem to matter.  If
the regular expression can be made shorter or easier to read, I'd like to
know.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Minor PEP-8 fixes.

[ci skip]
Fix url transform for preview view

Accessing preview videos using the `view?lecture_id=` format was giving errors.
Implement a basic, light sanitized version of filename sanitization.

This is potentially dangerous (we are external sources write almost
arbitrary strings as filenames), but some people may need filenames from
higher portions of the Unicode space.

This is still *not* hooked via a command line option, but is only for
evaluation purposes, to address issues pointed in comments of bug report

Still, the default will be to keep backwards compatibility and the user will
have to knowingly enable this feature.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
Encode local_page to utf-8

Otherwise we can get "UnicodeEncodeError: 'ascii' codec can't encode
characters in position …" errors
Add --clear-cache option

Allow users to clear the cache.
Return boolean in do_we_have_enough_cookies
Remove stale session from cookiejar