MCPcopy
hub / github.com/pyload/pyload / decrypt

Method decrypt

module/plugins/container/TXT.py:27–72  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

25 ("jeix", "jeix@hasnomail.com")]
26
27 def decrypt(self, pyfile):
28 try:
29 encoding = codecs.lookup(self.config.get('encoding')).name
30
31 except Exception:
32 encoding = "utf-8"
33
34 fs_filename = fs_encode(pyfile.url)
35 txt = codecs.open(fs_filename, 'r', encoding)
36 curPack = "Parsed links from %s" % pyfile.name
37 packages = {curPack: [], }
38
39 for link in txt.readlines():
40 link = link.strip()
41
42 if not link:
43 continue
44
45 if link.startswith(";"):
46 continue
47
48 if link.startswith("[") and link.endswith("]"):
49 #: New package
50 curPack = link[1:-1]
51 packages[curPack] = []
52 continue
53
54 packages[curPack].append(link)
55
56 txt.close()
57
58 #: Empty packages fix
59 for key, value in packages.items():
60 if not value:
61 packages.pop(key, None)
62
63 if self.config.get('flush'):
64 try:
65 txt = open(fs_filename, 'wb')
66 txt.close()
67
68 except IOError:
69 self.log_warning(_("Failed to flush list"))
70
71 for name, links in packages.items():
72 self.packages.append((name, links, name))

Callers 15

decryptContainerMethod · 0.45
addcrypted2Method · 0.45
aesDecryptFunction · 0.45
addcrypted2Method · 0.45
signinMethod · 0.45
signinMethod · 0.45
signinMethod · 0.45
handle_freeMethod · 0.45
handle_freeMethod · 0.45
cbc_decryptMethod · 0.45
ecb_decryptMethod · 0.45
decrypt_fileMethod · 0.45

Calls 10

readlinesMethod · 0.80
itemsMethod · 0.80
popMethod · 0.80
log_warningMethod · 0.80
fs_encodeFunction · 0.50
_Function · 0.50
getMethod · 0.45
openMethod · 0.45
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected