diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-31 20:44:42 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-07-31 20:44:42 +0200 |
commit | b06286d2d6693931e7956dba10c07073e69b5909 (patch) | |
tree | e195016b9b58b4c0c3e996ffb3a0cb234cafc217 /module/plugins/container | |
parent | daily commit (diff) | |
download | pyload-b06286d2d6693931e7956dba10c07073e69b5909.tar.xz |
some changes
Diffstat (limited to 'module/plugins/container')
-rw-r--r-- | module/plugins/container/LinkList.py | 56 |
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)) |