diff options
author | 2015-07-19 00:05:58 +0200 | |
---|---|---|
committer | 2015-07-19 00:05:58 +0200 | |
commit | dad722ac7255640e7e0541c4094a4d2e4de79cd3 (patch) | |
tree | 893a08e83fb9b465cd0ecf0b0315a5e820b06b06 /module/plugins/hoster/MegaCoNz.py | |
parent | [Hoster] Fix the http request issue (diff) | |
download | pyload-dad722ac7255640e7e0541c4094a4d2e4de79cd3.tar.xz |
Code cosmetics (2)
Diffstat (limited to 'module/plugins/hoster/MegaCoNz.py')
-rw-r--r-- | module/plugins/hoster/MegaCoNz.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 411c12c4a..9a2726448 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -84,7 +84,7 @@ class MegaCoNz(Hoster): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ - #: generate a session id, no idea where to obtain elsewhere + #: Generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) @@ -109,10 +109,10 @@ class MegaCoNz(Hoster): """ Decrypts the file at lastDownload` """ - #: upper 64 bit of counter start + #: Upper 64 bit of counter start n = self.b64_decode(key)[16:24] - #: convert counter to long and shift bytes + #: Convert counter to long and shift bytes k, iv, meta_mac = self.get_cipher_key(key) ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) cipher = AES.new(k, AES.MODE_CTR, counter=ctr) @@ -130,8 +130,8 @@ class MegaCoNz(Hoster): except IOError, e: self.fail(e) - chunk_size = 2 ** 15 #: buffer size, 32k - #: file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum + chunk_size = 2 ** 15 #: Buffer size, 32k + # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum chunks = os.path.getsize(file_crypted) / chunk_size + 1 for i in xrange(chunks): @@ -144,27 +144,27 @@ class MegaCoNz(Hoster): self.pyfile.setProgress(int((100.0 / chunks) * i)) - #: chunk_mac = [iv[0], iv[1], iv[0], iv[1]] - #: for i in xrange(0, chunk_size, 16): - #: block = chunk[i:i+16] - #: if len(block) % 16: - #: block += '=' * (16 - (len(block) % 16)) - #: block = array.array("I", block) + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array.array("I", block) - #: chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] - #: chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) - #: file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] - #: file_mac = aes_cbc_encrypt_a32(file_mac, k) + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) self.pyfile.setProgress(100) f.close() df.close() - #: if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: - #: os.remove(file_decrypted) - #: self.fail(_("Checksum mismatch")) + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail(_("Checksum mismatch")) os.remove(file_crypted) self.last_download = fs_decode(file_decrypted) @@ -194,8 +194,8 @@ class MegaCoNz(Hoster): self.log_debug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) - #: g is for requesting a download url - #: this is similar to the calls in the mega js app, documentation is very bad + #: G is for requesting a download url + #: This is similar to the calls in the mega js app, documentation is very bad if public: mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] else: @@ -211,7 +211,7 @@ class MegaCoNz(Hoster): pyfile.name = attr['n'] + self.FILE_SUFFIX pyfile.size = mega['s'] - #: self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") self.download(mega['g']) |