summaryrefslogtreecommitdiffstats
path: root/module/plugins/container/LinkList.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-02-27 22:56:22 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-02-27 22:56:22 +0100
commit4d25665bb3e8cf7c22a9efc6a3bbf29f29856642 (patch)
tree43311c5f380582bd22c46d3d9a1b6fba83266845 /module/plugins/container/LinkList.py
parentSingle "if" check instead of two. (diff)
downloadpyload-4d25665bb3e8cf7c22a9efc6a3bbf29f29856642.tar.xz
fixed #532, #543, letitbit, extabit, linkdecrypter; allow rs+nl.in free account
Diffstat (limited to 'module/plugins/container/LinkList.py')
-rw-r--r--module/plugins/container/LinkList.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py
index b9eb4b972..fefeaf486 100644
--- a/module/plugins/container/LinkList.py
+++ b/module/plugins/container/LinkList.py
@@ -1,21 +1,32 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-
+import codecs
+from module.utils import fs_encode
from module.plugins.Container import Container
class LinkList(Container):
__name__ = "LinkList"
- __version__ = "0.11"
+ __version__ = "0.12"
__pattern__ = r".+\.txt$"
__description__ = """Read Link Lists in txt format"""
- __config__ = [("clear", "bool", "Clear Linklist after adding", False)]
+ __config__ = [("clear", "bool", "Clear Linklist after adding", False),
+ ("encoding", "string", "File encoding (default utf-8)", "")]
__author_name__ = ("spoob", "jeix")
__author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com")
-
def decrypt(self, pyfile):
- txt = open(pyfile.url, 'r')
+ try:
+ file_enc = codecs.lookup(self.getConfig("encoding")).name
+ except:
+ file_enc = "utf-8"
+
+ print repr(pyfile.url)
+ print pyfile.url
+
+ file_name = fs_encode(pyfile.url)
+
+ txt = codecs.open(file_name, 'r', file_enc)
links = txt.readlines()
curPack = "Parsed links from %s" % pyfile.name
@@ -48,7 +59,7 @@ class LinkList(Container):
if self.getConfig("clear"):
try:
- txt = open(pyfile.url, 'wb')
+ txt = open(file_name, 'wb')
txt.close()
except:
self.log.warning(_("LinkList could not be cleared."))