richardasaurus/mega.py — pull request #70 by andy-g (2014-03-25 08:59:29+00:00)
Title: Added support for resuming downloads

I've added provisional support for resuming downloads. I've done it in such a way as to leave the existing functionality as is, which does leave the code a little more verbose.

I initially struggled trying to recreate the previous AES Counter, so I could pick up from where the download failed, but I couldn't get this to work, so when the resume parameter is set to True, the file is downloaded encrypted, and the decryption only takes place after the entire file is down. If you can work out how to store the previous Counter it may make for a cleaner implementation, and allow for resuming downloads without needing the resume parameter or changing the current download implementation.

I'm pretty new to python, so I wouldn't be surprised if you can find a number of optimisations.

```
m.download_url('https://mega.co.nz/#!...!.....',resume=True)
```