summaryrefslogtreecommitdiffstats
path: root/core/module/plugins/container/LinkList.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-08-25 16:48:55 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-08-25 16:48:55 +0200
commit3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea (patch)
treec5b2b1bfeb7eb8df2b97be118f6cbcec4e29cb3b /core/module/plugins/container/LinkList.py
parentul.to fetching, so.biz expire (diff)
downloadpyload-3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea.tar.xz
merged gui
Diffstat (limited to 'core/module/plugins/container/LinkList.py')
-rw-r--r--core/module/plugins/container/LinkList.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/core/module/plugins/container/LinkList.py b/core/module/plugins/container/LinkList.py
new file mode 100644
index 000000000..c9e7a85a3
--- /dev/null
+++ b/core/module/plugins/container/LinkList.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+from module.plugins.Container import Container
+
+class LinkList(Container):
+ __name__ = "LinkList"
+ __version__ = "0.1"
+ __pattern__ = r".*\.txt$"
+ __description__ = """Read Link Lists in txt format"""
+ __author_name__ = ("spoob", "jeix")
+ __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com")
+
+
+ def decrypt(self, pyfile):
+
+ txt = open(pyfile.url, 'r')
+ links = txt.readlines()
+ curPack = "Parsed links %s" % pyfile.name
+
+ packages = {curPack:[],}
+
+ for link in links:
+ link = link.strip()
+ if not link: continue
+
+ if link.startswith(";"):
+ continue
+ if link.startswith("[") and link.endswith("]"):
+ # new package
+ curPack = link[1:-1]
+ packages[curPack] = []
+ continue
+ packages[curPack].append(link.replace("\n", ""))
+ txt.close()
+
+ # empty packages fix
+
+ delete = []
+
+ for key,value in packages.iteritems():
+ if not value:
+ delete.append(key)
+
+ for key in delete:
+ del packages[key]
+
+ if not self.core.debug:
+ txt = open(linkList, 'w')
+ txt.write("")
+ txt.close()
+ #@TODO: maybe delete read txt file?
+
+ for name, links in packages.iteritems():
+ self.packages.append((name, links, name))