diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-13 23:24:21 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-13 23:24:21 +0100 |
commit | c7ad1cc5b4a5d190a060e3ddd9274c3065da6708 (patch) | |
tree | 639062525ddde3b8c785f26a0f4091ec10d9e204 /module | |
parent | fixed pyflakes and sloccount (diff) | |
download | pyload-c7ad1cc5b4a5d190a060e3ddd9274c3065da6708.tar.xz |
Diffstat (limited to 'module')
-rw-r--r-- | module/HookManager.py | 2 | ||||
-rw-r--r-- | module/network/HTTPRequest.py | 2 | ||||
-rw-r--r-- | module/plugins/Hoster.py | 3 | ||||
-rw-r--r-- | module/plugins/crypter/FilesonicComFolder.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/FilesMailRu.py | 3 | ||||
-rw-r--r-- | module/plugins/hoster/HotfileCom.py | 3 | ||||
-rw-r--r-- | module/plugins/hoster/NetloadIn.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 3 | ||||
-rw-r--r-- | module/threads/BaseThread.py | 1 | ||||
-rw-r--r-- | module/utils/__init__.py | 7 | ||||
-rw-r--r-- | module/utils/fs.py | 2 |
12 files changed, 24 insertions, 22 deletions
diff --git a/module/HookManager.py b/module/HookManager.py index 8afd6fe26..0ad37b321 100644 --- a/module/HookManager.py +++ b/module/HookManager.py @@ -200,7 +200,7 @@ class HookManager: def activePlugins(self): """ returns all active plugins """ - return [x for x in self.plugins if x.isActivated()] + return [x for x in self.plugins.itervalues() if x.isActivated()] def getAllInfo(self): """returns info stored by hook plugins""" diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py index 4684397d9..7887081e7 100644 --- a/module/network/HTTPRequest.py +++ b/module/network/HTTPRequest.py @@ -206,7 +206,7 @@ class HTTPRequest(): finally: self.c.setopt(pycurl.FOLLOWLOCATION, 1) self.c.setopt(pycurl.NOBODY, 0) - self.c.setopt(pycurl.CUSTOMREQUEST, 0) + self.c.unsetopt(pycurl.CUSTOMREQUEST) else: self.c.perform() diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 7c43c6444..4a5d15759 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -28,9 +28,12 @@ if os.name != "nt": from grp import getgrnam from Base import Base, Fail, Retry +from module.utils import chunks as _chunks from module.utils.fs import save_join, save_filename, fs_encode, fs_decode,\ remove, makedirs, chmod, stat, exists, join +# Import for Hoster Plugins +chunks = _chunks class Abort(Exception): """ raised when aborted """ diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py index b967a74a1..02ae66295 100644 --- a/module/plugins/crypter/FilesonicComFolder.py +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -4,8 +4,6 @@ import re from module.plugins.Crypter import Crypter class FilesonicComFolder(Crypter): - __name__ = "FilesonicComFolder" - __type__ = "crypter" __pattern__ = r"http://(\w*\.)?(sharingmatrix|filesonic|wupload)\.[^/]*/folder/\w+/?" __version__ = "0.11" __description__ = """Filesonic.com/Wupload.com Folder Plugin""" @@ -15,9 +13,8 @@ class FilesonicComFolder(Crypter): FOLDER_PATTERN = r'<table>\s*<caption>Files Folder</caption>(.*?)</table>' LINK_PATTERN = r'<a href="([^"]+)">' - def decrypt(self, pyfile): - html = self.load(self.pyfile.url) - + def decryptURL(self, url): + html = self.load(url) new_links = [] folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) @@ -26,6 +23,7 @@ class FilesonicComFolder(Crypter): new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1))) if new_links: - self.core.files.addLinks(new_links, self.pyfile.package().id) + return new_links else: - self.fail('Could not extract any links')
\ No newline at end of file + self.fail('Could not extract any links') + diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 6002ab3dc..1284329b5 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -2,9 +2,8 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Hoster import Hoster +from module.plugins.Hoster import Hoster, chunks from module.network.RequestFactory import getURL -from module.plugins.Plugin import chunks def getInfo(urls): result = [] diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index 9c056d899..d36a4df2e 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -2,11 +2,10 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Hoster import Hoster +from module.plugins.Hoster import Hoster, chunks from module.plugins.ReCaptcha import ReCaptcha from module.network.RequestFactory import getURL -from module.plugins.Plugin import chunks def getInfo(urls): api_url_base = "http://api.hotfile.com/" diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index b2bec873d..382328496 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -5,11 +5,9 @@ import re from time import sleep, time +from module.utils import chunks from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL -from module.plugins.Plugin import chunks - - def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 641a9b025..2d1fc8d85 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -7,10 +7,8 @@ import hashlib import random from time import sleep -from module.plugins.Hoster import Hoster +from module.plugins.Hoster import Hoster, chunks from module.network.RequestFactory import getURL -from module.plugins.Plugin import chunks - def getInfo(urls): api_url_base = "http://api.share-online.biz/linkcheck.php" diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 39483cf86..751dcda25 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -2,11 +2,10 @@ import re -from module.utils import html_unescape, parseFileSize +from module.utils import html_unescape, parseFileSize, chunks from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL -from module.plugins.Plugin import chunks from module.plugins.ReCaptcha import ReCaptcha key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') diff --git a/module/threads/BaseThread.py b/module/threads/BaseThread.py index 526913e9b..f6fac46a0 100644 --- a/module/threads/BaseThread.py +++ b/module/threads/BaseThread.py @@ -68,6 +68,7 @@ class BaseThread(Thread): f.close() self.log.info("Debug Report written to %s" % dump_name) + return dump_name def getFileDump(self, pyfile): dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % ( diff --git a/module/utils/__init__.py b/module/utils/__init__.py index b68928f04..bf11fbc69 100644 --- a/module/utils/__init__.py +++ b/module/utils/__init__.py @@ -160,6 +160,13 @@ def accumulate(it, inv_map=None): def to_string(value): return str(value) if not isinstance(value, basestring) else value +def to_int(string): + """ return int from string or 0 """ + try: + return int(string) + except ValueError: + return 0 + def from_string(value, typ=None): """ cast value to given type, unicode for strings """ diff --git a/module/utils/fs.py b/module/utils/fs.py index 03832e368..c1927423a 100644 --- a/module/utils/fs.py +++ b/module/utils/fs.py @@ -35,7 +35,7 @@ def remove(path): def exists(path): return os.path.exists(fs_encode(path)) -def makedirs(path, mode=0660): +def makedirs(path, mode=0777): return os.makedirs(fs_encode(path), mode) def listdir(path): |