summaryrefslogtreecommitdiffstats
path: root/module/plugins/container
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-07-31 20:44:42 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-07-31 20:44:42 +0200
commitb06286d2d6693931e7956dba10c07073e69b5909 (patch)
treee195016b9b58b4c0c3e996ffb3a0cb234cafc217 /module/plugins/container
parentdaily commit (diff)
downloadpyload-b06286d2d6693931e7956dba10c07073e69b5909.tar.xz
some changes
Diffstat (limited to 'module/plugins/container')
-rw-r--r--module/plugins/container/LinkList.py56
1 files changed, 35 insertions, 21 deletions
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py
index 3ffeeb193..9668b34ad 100644
--- a/module/plugins/container/LinkList.py
+++ b/module/plugins/container/LinkList.py
@@ -7,38 +7,52 @@ from module.plugins.Container import Container
class LinkList(Container):
__name__ = "LinkList"
__version__ = "0.1"
- __pattern__ = r"(?!http://).*\.txt"
+ __pattern__ = r".*\.txt$"
__description__ = """Read Link Lists in txt format"""
__author_name__ = ("spoob", "jeix")
__author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com")
- def proceed(self, linkList, location):
- txt = open(linkList, 'r')
+ def decrypt(self, pyfile):
+
+ self.loadToDisk()
+
+ txt = open(pyfile.url, 'r')
links = txt.readlines()
- packages = {"Parsed links":[],}
- curPack = "Parsed links"
+ curPack = "Parsed links %s" % pyfile.name
+
+ packages = {curPack:[],}
+
for link in links:
- if link != "\n":
- link = link.strip()
- 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", ""))
+ 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 Parsed links fix
- if len(packages["Parsed links"]) < 1:
- del packages["Parsed links"]
+ # empty packages fix
- if not self.parent.core.config['general']['debug_mode']:
+ 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?
-
- self.links = packages
+
+ for name, links in packages.iteritems():
+ self.packages.append((name, links, name))