MCPcopy Index your code
hub / github.com/pyload/pyload / decrypt

Method decrypt

module/plugins/container/TORRENT.py:26–44  ·  view source on GitHub ↗
(self, pyfile)

Source from the content-addressed store, hash-verified

24 __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")]
25
26 def decrypt(self, pyfile):
27 fs_filename = fs_encode(pyfile.url)
28 with open(fs_filename, "rb") as f:
29 torrent_content = f.read()
30
31 time_ref = ("%.2f" % time.time())[-6:].replace(".", "")
32
33 pack_name = "torrent %s" % time_ref
34 m = re.search(r'name(\d+):', torrent_content)
35 if m:
36 m = re.search(r'name%s:(.{%s})' % (m.group(1), m.group(1)), torrent_content)
37 if m:
38 pack_name = safename(decode(m.group(1)))
39
40 torrent_filename = fsjoin("tmp", "tmp_%s.torrent" % pack_name)
41 with open(torrent_filename, "wb") as f:
42 f.write(torrent_content)
43
44 self.packages.append((pack_name, ["file://%s" % urllib.pathname2url(torrent_filename.encode('utf8'))], pack_name))

Callers

nothing calls this directly

Calls 10

safenameFunction · 0.85
fsjoinFunction · 0.85
fs_encodeFunction · 0.50
decodeFunction · 0.50
readMethod · 0.45
replaceMethod · 0.45
searchMethod · 0.45
writeMethod · 0.45
appendMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected