diff options
author | Jeix <devnull@localhost> | 2010-06-16 20:49:47 +0200 |
---|---|---|
committer | Jeix <devnull@localhost> | 2010-06-16 20:49:47 +0200 |
commit | fbd15be9a429c0d62782e7acfc73758a24546b63 (patch) | |
tree | 88386a67161541ecc3f68f1d089300e3af20b4dc /module | |
parent | fix last fix (diff) | |
download | pyload-fbd15be9a429c0d62782e7acfc73758a24546b63.tar.xz |
extended LinkList plugin. Now it's possible to add comments, packages and links as usual via linklist.
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/container/LinkList.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index cadf491a9..6352746fd 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -9,8 +9,8 @@ class LinkList(Container): __version__ = "0.1" __pattern__ = r"(?!http://).*\.txt" __description__ = """Read Link Lists in txt format""" - __author_name__ = ("spoob") - __author_mail__ = ("spoob@pyload.org") + __author_name__ = ("spoob", "jeix") + __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") def __init__(self, parent): Container.__init__(self, parent) @@ -19,13 +19,25 @@ class LinkList(Container): self.read_config() def proceed(self, linkList, location): - tmpLinks = [] txt = open(linkList, 'r') links = txt.readlines() + packages = {"Parsed links":[],} + curPack = "Parsed links" for link in links: if link != "\n": - tmpLinks.append(link.replace("\n", "")) + if link.startswith(";"): + continue + if link.startswith("[") and link.endswith("]\n"): + # new package + curPack = link[1:-2] + 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"] if not self.parent.core.config['general']['debug_mode']: txt = open(linkList, 'w') @@ -33,4 +45,4 @@ class LinkList(Container): txt.close() #@TODO: maybe delete read txt file? - self.links = tmpLinks + self.links = packages |