summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/MegaCoNz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/MegaCoNz.py')
-rw-r--r--module/plugins/hoster/MegaCoNz.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py
index 36ad929f4..59d75d445 100644
--- a/module/plugins/hoster/MegaCoNz.py
+++ b/module/plugins/hoster/MegaCoNz.py
@@ -2,18 +2,18 @@
import array
import os
-# import pycurl
import random
import re
+# import pycurl
+
from base64 import standard_b64decode
from Crypto.Cipher import AES
from Crypto.Util import Counter
-from module.common.json_layer import json_loads, json_dumps
from module.plugins.internal.Hoster import Hoster
-from module.utils import decode, fs_decode, fs_encode
+from module.plugins.internal.utils import decode, encode, json
############################ General errors ###################################
@@ -48,7 +48,7 @@ from module.utils import decode, fs_decode, fs_encode
class MegaCoNz(Hoster):
__name__ = "MegaCoNz"
__type__ = "hoster"
- __version__ = "0.31"
+ __version__ = "0.32"
__status__ = "testing"
__pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w\-,]+)'
@@ -89,9 +89,9 @@ class MegaCoNz(Hoster):
#: 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]))
+ res = self.load(self.API_URL, get={'id': uid}, post=json.dumps([kwargs]))
self.log_debug("Api Response: " + res)
- return json_loads(res)
+ return json.loads(res)
def decrypt_attr(self, data, key):
@@ -104,7 +104,7 @@ class MegaCoNz(Hoster):
self.fail(_("Decryption failed"))
#: Data is padded, 0-bytes must be stripped
- return json_loads(re.search(r'{.+?}', attr).group(0))
+ return json.loads(re.search(r'{.+?}', attr).group(0))
def decrypt_file(self, key):
@@ -122,7 +122,7 @@ class MegaCoNz(Hoster):
self.pyfile.setStatus("decrypting")
self.pyfile.setProgress(0)
- file_crypted = fs_encode(self.last_download)
+ file_crypted = encode(self.last_download)
file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0]
try:
@@ -169,7 +169,7 @@ class MegaCoNz(Hoster):
# self.fail(_("Checksum mismatch"))
os.remove(file_crypted)
- self.last_download = fs_decode(file_decrypted)
+ self.last_download = decode(file_decrypted)
def check_error(self, code):