From 4cdc03879a8ac9b304cd4e59498ff6646fecefcb Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sat, 8 Aug 2015 21:41:32 +0300 Subject: Update SimpleHoster.py --- module/plugins/internal/SimpleHoster.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 9c310ca27..544e71d1e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -23,7 +23,7 @@ statusMap = dict((v, k) for k, v in _statusMap.items()) class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.80" + __version__ = "1.81" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -209,12 +209,11 @@ class SimpleHoster(Hoster): self.direct_dl = False self.leech_dl = False - if not self.get_config('use_premium', True): + if not self.get_config('use_premium', True) and self.premium: self.restart(nopremium=True) if self.LOGIN_PREMIUM and not self.premium: self.fail(_("Required premium account not found")) - self.LOGIN_ACCOUNT = True if self.LOGIN_ACCOUNT and not self.account: self.fail(_("Required account not found")) -- cgit v1.2.3 From 2d051d0e898745ce862b0621fb992331e14fd8da Mon Sep 17 00:00:00 2001 From: NETHeader Date: Wed, 19 Aug 2015 07:58:22 +0200 Subject: Update SexuriaCom.py Fix to reflect the recent changes of - refactored function names - change of module.plugins.Crypter into module.plugins.internal.Crypter Additionally, some irregular passwords like '-' or 'Kein Passwort' are ignored now. --- module/plugins/crypter/SexuriaCom.py | 63 +++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 7942d5e42..a7448cd4c 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -1,25 +1,23 @@ # -*- coding: utf-8 -*- import re - from module.plugins.internal.Crypter import Crypter - class SexuriaCom(Crypter): __name__ = "SexuriaCom" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder", "bool", "Save package to subfolder" , True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Sexuria.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")] - + #: Constants PATTERN_SUPPORTED_MAIN = r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html' PATTERN_SUPPORTED_CRYPT = r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P\d+)\.html' PATTERN_SUPPORTED_REDIRECT = r'http://(www\.)?sexuria\.com/out\.php\?id=(?P\d+)\&part=\d+\&link=\d+' @@ -27,15 +25,17 @@ class SexuriaCom(Crypter): PATTERN_PASSWORD = r'Passwort: .*?bgcolor="#EFEFEF">(?P.*?)' PATTERN_DL_LINK_PAGE = r'"(dl_links_\d+_\d+\.html)"' PATTERN_REDIRECT_LINKS = r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly' - + LIST_PWDIGNORE = ["Kein Passwort", "-"] def decrypt(self, pyfile): #: Init self.pyfile = pyfile self.package = pyfile.package() - #: Get package links + #: Decrypt and add links package_name, self.links, folder_name, package_pwd = self.decrypt_links(self.pyfile.url) + if package_pwd: + self.pyfile.package().password = package_pwd self.packages = [(package_name, self.links, folder_name)] @@ -61,35 +61,46 @@ class SexuriaCom(Crypter): elif re.match(self.PATTERN_SUPPORTED_CRYPT, url, re.I): #: Extract info from main file id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID') - html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) - - title = re.search(self.PATTERN_TITLE, html, re.I).group('TITLE').strip() - if title: - name = folder = title - self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder)) - - pwd = re.search(self.PATTERN_PASSWORD, html, re.I | re.S).group('PWD') - if pwd and pwd not in ("Kein Passwort", "-"): - password = pwd.strip() - self.log_debug("Password info [%s] found" % password) + html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) #, decode=True + #: Webpage title / Package name + titledata = re.search(self.PATTERN_TITLE, html, re.I) + if not titledata: + self.log_warning("No title data found, has site changed?") + else: + title = titledata.group('TITLE').strip() + if title: + name = folder = title + self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder)) + #: Password + pwddata = re.search(self.PATTERN_PASSWORD, html, re.I | re.S) + if not pwddata: + self.log_warning("No password data found, has site changed?") + else: + pwd = pwddata.group('PWD').strip() + if pwd and not (pwd in self.LIST_PWDIGNORE): + password = pwd + self.log_debug("Package info found, password [%s]" % password) - #: Process link (dl_link) + #: Process links (dl_link) html = self.load(url) links = re.findall(self.PATTERN_REDIRECT_LINKS, html, re.I) - if len(links) == 0: + if not links: self.log_error(_("Broken for link: %s") % link) else: for link in links: link = link.replace("http://sexuria.com/", "http://www.sexuria.com/") finallink = self.load(link, just_header=True)['location'] - if not finallink or "sexuria.com/" in finallink: + if not finallink or ("sexuria.com/" in finallink): self.log_error(_("Broken for link: %s") % link) else: linklist.append(finallink) - #: Debug log - self.log_debug("%d supported links" % len(linklist)) - for i, link in enumerate(linklist): - self.log_debug("Supported link %d, %s" % (i + 1, link)) + #: Log result + if not linklist: + self.fail(_("Unable to extract links (maybe plugin out of date?)")) + else: + for i, link in enumerate(linklist): + self.log_debug("Supported link %d/%d: %s" % (i+1, len(linklist), link)) + #: All done, return to caller return name, linklist, folder, password -- cgit v1.2.3 From 6f474a36eabda3a018aea0baf7f37dda6ddc44ae Mon Sep 17 00:00:00 2001 From: NETHeader Date: Wed, 19 Aug 2015 08:44:08 +0200 Subject: Update SexuriaCom.py Minor whitespace changes --- module/plugins/crypter/SexuriaCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index a7448cd4c..9ec4b4117 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -10,7 +10,7 @@ class SexuriaCom(Crypter): __status__ = "testing" __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder" , True), + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Sexuria.com decrypter plugin""" -- cgit v1.2.3 From 499df96094d5d5b5977bdc581e0497f3e0a75279 Mon Sep 17 00:00:00 2001 From: NETHeader Date: Wed, 19 Aug 2015 18:17:29 +0200 Subject: Update SexuriaCom.py Remove unnecessary comment --- module/plugins/crypter/SexuriaCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 9ec4b4117..24a5060b9 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -61,7 +61,7 @@ class SexuriaCom(Crypter): elif re.match(self.PATTERN_SUPPORTED_CRYPT, url, re.I): #: Extract info from main file id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID') - html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) #, decode=True + html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) #: Webpage title / Package name titledata = re.search(self.PATTERN_TITLE, html, re.I) if not titledata: -- cgit v1.2.3 From 051604eb336b6d0064cd7317e0616e7de540b444 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Thu, 20 Aug 2015 02:11:00 +0300 Subject: Create TransmissionRPC.py --- module/plugins/hooks/TransmissionRPC.py | 73 +++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 module/plugins/hooks/TransmissionRPC.py diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py new file mode 100644 index 000000000..7e2c5250a --- /dev/null +++ b/module/plugins/hooks/TransmissionRPC.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +import re +import random +import pycurl + +from module.common.json_layer import json_loads, json_dumps +from module.network.HTTPRequest import BadHeader +from module.network.RequestFactory import getRequest as get_request +from module.plugins.internal.Addon import Addon + +class TransmissionRPC(Addon): + __name__ = "TransmissionRPC" + __type__ = "hook" + __status__ = "testing" + + __pattern__ = r"https?://.+\.torrent|magnet:\?.+" + __config__ = [("transmissionrpcurl" , "string" , "Transmission RPC URL" , "http://127.0.0.1:9091/transmission/rpc")] + + __version__ = "0.1" + __description__ = """Send torrent and magnet URLs to Transmission Bittorent daemon via RPC""" + __authors__ = [("GammaC0de", None)] + + + def init(self): + self.event_map = {'linksAdded': "links_added"} + + + def links_added(self, links, pid): + for link in links: + m = re.search(self.__pattern__, link) + if m: + self.log_debug("sending link: %s" % link) + self.SendToTransmission(link) + links.remove(link) + + + def SendToTransmission(self, url): + transmission_rpc_url = self.get_config('transmissionrpcurl') + client_request_id = self.__name__ + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4)) + req = get_request() + + try: + response = self.load(transmission_rpc_url, + post=json_dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + except BadHeader, e: + if e.code == 409: + headers = dict(re.findall(r"(?P.*?): (?P.*?)\r\n", req.header)) + session_id = headers['X-Transmission-Session-Id'] + req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) + response = self.load(transmission_rpc_url, + post=json_dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + else: + self.log_error(e) + + except Exception, e: + self.log_error(e) + + try: + res = json_loads(response) + if "result" in res: + self.log_debug("result: %s" % res['result']) + + except Exception, e: + self.log_error(e) -- cgit v1.2.3 From 0e87bb35a0fe1317998153bc8ef9e5072248ab2a Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 21 Aug 2015 01:03:21 +0300 Subject: fix #1765 --- module/plugins/internal/SimpleCrypter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 6a3f91a5b..9597116cc 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -10,7 +10,7 @@ from module.utils import fixup, html_unescape class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.60" + __version__ = "0.61" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -91,6 +91,7 @@ class SimpleCrypter(Crypter, SimpleHoster): def decrypt(self, pyfile): + self.links = [] #@TODO: Recheck in 0.4.10 self.prepare() self.check_info() #@TODO: Remove in 0.4.10 -- cgit v1.2.3 From 8aecbf814cad18d4bac507cf88f8b8782b25e889 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 21 Aug 2015 01:06:18 +0300 Subject: fix #1765 --- module/plugins/crypter/MultiUpOrg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index 23e6dfa4a..fb228c3cd 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -9,10 +9,10 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class MultiUpOrg(SimpleCrypter): __name__ = "MultiUpOrg" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?Pproject|download|miror)/\w+(/\w+)?' + __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?Pproject|download|mirror)/\w+(/\w+)?' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] @@ -34,8 +34,8 @@ class MultiUpOrg(SimpleCrypter): pattern = r'style="width:97%;text-align:left".*\n.*href="(.*)"' if m_type == "download": dl_pattern = r'href="(.*)">.*\n.*
DOWNLOAD
' - miror_page = urlparse.urljoin("http://www.multiup.org/", re.search(dl_pattern, self.html).group(1)) - self.html = self.load(miror_page) + mirror_page = urlparse.urljoin("http://www.multiup.org/", re.search(dl_pattern, self.html).group(1)) + self.html = self.load(mirror_page) return re.findall(pattern, self.html) -- cgit v1.2.3 From 10213910fdb5a1c2e7bde50fdd7cdfb99090bf7e Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sun, 23 Aug 2015 00:45:56 +0300 Subject: Update OneFichierCom.py --- module/plugins/hoster/OneFichierCom.py | 59 +++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index cba67b26c..fcf6842a6 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -2,13 +2,14 @@ import re +from module.network.RequestFactory import getURL as get_url from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.88" + __version__ = "0.89" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:(?P\w+)\.)?(?P1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P\w+))?' @@ -28,6 +29,8 @@ class OneFichierCom(SimpleHoster): COOKIES = [("1fichier.com", "LG", "en")] + DIRECT_LINK = True + NAME_PATTERN = r'>File\s*Name :\s*(?P.+?)<' SIZE_PATTERN = r'>Size :\s*(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'File not found !\s*<' @@ -40,7 +43,61 @@ class OneFichierCom(SimpleHoster): self.resume_download = True + @classmethod + def get_info(cls, url="", html=""): + redirect = url + for i in xrange(10): + try: + headers = dict(re.findall(r"(?P.+?): (?P.+?)\r", get_url(redirect, just_header=True).lower())) + if 'location' in headers and headers['location']: + redirect = headers['location'] + else: + if 'content-type' in headers and headers['content-type'] == "application/octet-stream": + if "filename=" in headers.get('content-disposition'): + name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:]['filename'].strip("\"'") + else: + name = url + + info = {'name' : name, + 'size' : long(headers.get('content-length')), + 'status': 3, + 'url' : url} + + else: + info = super(OneFichierCom, cls).get_info(url, html) + + break + + except Exception, e: + info = {'status' : 8, + 'error' : e.message} + + else: + info = {'status' : 8, + 'error' : _("Too many redirects")} + + return info + + + def handle_direct(self, pyfile): + redirect = pyfile.url + for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")): + + headers = self.load(redirect, just_header=True) + if 'location' in headers and headers['location']: + self.log_debug("Redirect #%d to: %s" % (i, redirect)) + redirect = headers['location'] + else: + if 'content-type' in headers and headers['content-type'] == "application/octet-stream": + self.link = pyfile.url + break + else: + self.fail(_("Too many redirects")) + + def handle_free(self, pyfile): + self.check_errors() + id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id) -- cgit v1.2.3 From d4616c7bf4f3b353523690decdd30a81d7f9ff04 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sun, 23 Aug 2015 22:22:30 +0300 Subject: Update TransmissionRPC.py --- module/plugins/hooks/TransmissionRPC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 7e2c5250a..3d10b90c4 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -49,7 +49,7 @@ class TransmissionRPC(Addon): except BadHeader, e: if e.code == 409: - headers = dict(re.findall(r"(?P.*?): (?P.*?)\r\n", req.header)) + headers = dict(re.findall(r"(?P.+?): (?P.+?)\r?\n", req.header)) session_id = headers['X-Transmission-Session-Id'] req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) response = self.load(transmission_rpc_url, -- cgit v1.2.3 From a2da3c7790b81233a748bd28107e8c6ccdbb0594 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sun, 23 Aug 2015 22:24:27 +0300 Subject: Update OneFichierCom.py --- module/plugins/hoster/OneFichierCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index fcf6842a6..93f056377 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -48,7 +48,7 @@ class OneFichierCom(SimpleHoster): redirect = url for i in xrange(10): try: - headers = dict(re.findall(r"(?P.+?): (?P.+?)\r", get_url(redirect, just_header=True).lower())) + headers = dict(re.findall(r"(?P.+?): (?P.+?)\r?\n", get_url(redirect, just_header=True).lower())) if 'location' in headers and headers['location']: redirect = headers['location'] else: -- cgit v1.2.3 From 45feced4c09605dc5e80c4d96e2a4c5e9ee416d4 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 26 Aug 2015 15:32:53 +0300 Subject: Update Plugin.py --- module/plugins/internal/Plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 7b45c40a8..8bc5d4a65 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -7,6 +7,7 @@ import inspect import os import re import urllib +import sys if os.name != "nt": import grp @@ -146,7 +147,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.32" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -345,7 +346,7 @@ class Plugin(object): #@TODO: Move to network in 0.4.10 if isinstance(decode, basestring): - res = decode(res, decode) + res = sys.modules[__name__].decode(res, decode) #@TODO: See #1787, use utils.decode() in 0.4.10 if self.pyload.debug: frame = inspect.currentframe() -- cgit v1.2.3 From 47ce7cd62c62d476094070e8d833033209c035e1 Mon Sep 17 00:00:00 2001 From: Bambie42 Date: Wed, 26 Aug 2015 14:36:59 +0200 Subject: partly fixes #1756 --- module/plugins/crypter/LinkCryptWs.py | 13 +++++-------- module/plugins/internal/Captcha.py | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index af13f55f6..557a63cbd 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -31,7 +31,6 @@ class LinkCryptWs(Crypter): def setup(self): - self.captcha = False self.links = [] self.sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf'] @@ -60,7 +59,6 @@ class LinkCryptWs(Crypter): self.retry(8, 15, _("Can't handle Key-Captcha")) if self.is_captcha_protected(): - self.captcha = True self.unlock_captcha_protection() self.handle_captcha_errors() @@ -165,12 +163,11 @@ class LinkCryptWs(Crypter): def handle_captcha_errors(self): - if self.captcha: - if "Your choice was wrong!" in self.html: - self.captcha.invalid() - self.retry() - else: - self.captcha.correct() + if "Your choice was wrong!" in self.html: + self.captcha.invalid() + self.retry() + else: + self.captcha.correct() def handle_link_source(self, type): diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index c08050ee8..600fd1d34 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -120,7 +120,7 @@ class Captcha(Plugin): self.log_warning(_("Error removing: %s") % tmp_img.name, e) traceback.print_exc() - self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here? + #self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here? return result -- cgit v1.2.3 From 92dd8f10b58a6fe20d40e08e081f6311eb8c592d Mon Sep 17 00:00:00 2001 From: B1gG Date: Thu, 27 Aug 2015 07:45:21 -0430 Subject: Update to resolve issue #1793 This update resolve the issue raised when you try to share a link from YouTube android app to pyLoad client. Issue was that the parser doesn't detect youtu.be as a valid URL for YoutubeCom.py and always use BasePlugin.py instead of, that is why the "__pattern__" need to be modified. The URL_REPLACEMENTS is not appropriate for this short url and was fixed also, in order to construct and typical youtube.com URL, that this script can handle. --- module/plugins/hoster/YoutubeCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 86cca7cf1..9c7421be1 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -36,7 +36,7 @@ class YoutubeCom(Hoster): __version__ = "0.45" __status__ = "testing" - __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com/watch\?v=|youtu\.be)(?:.*)' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), (".mp4" , "bool" , "Allow .mp4" , True ), @@ -51,7 +51,7 @@ class YoutubeCom(Hoster): ("zoidberg", "zoidberg@mujmail.cz")] - URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] + URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/watch?v=')] #: Invalid characters that must be removed from the file name invalid_chars = u'\u2605:?><"|\\' -- cgit v1.2.3 From dedce876f1f9cb9ad9f8b135ced26bf19fc1dbc7 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sat, 29 Aug 2015 16:28:59 +0300 Subject: [Hoster] fix pyfile.name not updated if disposition --- module/plugins/internal/Hoster.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index b397a92a6..a8b8922bb 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -44,7 +44,7 @@ def create_getInfo(klass): class Hoster(Plugin): __name__ = "Hoster" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -412,7 +412,7 @@ class Hoster(Plugin): if disposition and newname: finalname = urlparse.urlparse(newname).path.split('/')[-1].split(' filename*=')[0] - if finalname != newname != self.pyfile.name: + if finalname != newname try: os.rename(fs_join(location, newname), fs_join(location, finalname)) @@ -421,8 +421,9 @@ class Hoster(Plugin): finalname = newname self.log_info(_("`%s` saved as `%s`") % (self.pyfile.name, finalname)) - self.pyfile.name = finalname - filename = os.path.join(location, finalname) + + self.pyfile.name = finalname + filename = os.path.join(location, finalname) self.set_permissions(fs_encode(filename)) -- cgit v1.2.3 From 2a3405db57862c5644643fd9b8bad0a74b0c1cbe Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sat, 29 Aug 2015 23:02:36 +0300 Subject: Update Hoster.py --- module/plugins/internal/Hoster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index a8b8922bb..924672acf 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -412,7 +412,7 @@ class Hoster(Plugin): if disposition and newname: finalname = urlparse.urlparse(newname).path.split('/')[-1].split(' filename*=')[0] - if finalname != newname + if finalname != newname: try: os.rename(fs_join(location, newname), fs_join(location, finalname)) -- cgit v1.2.3 From f44acc14fc6492f9fefbc707618c774d34ac1aeb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 30 Aug 2015 03:38:54 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1793 --- module/plugins/hoster/YoutubeCom.py | 26 +++----------------------- module/plugins/internal/Plugin.py | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 9c7421be1..5c7c13962 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -6,37 +6,17 @@ import subprocess import urllib from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.Plugin import replace_patterns +from module.plugins.internal.Plugin import replace_patterns, which from module.utils import html_unescape -def which(program): - """ - Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646 - """ - isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) - - fpath, fname = os.path.split(program) - - if fpath: - if isExe(program): - return program - else: - for path in os.environ['PATH'].split(os.pathsep): - path = path.strip('"') - exe_file = os.path.join(path, program) - if isExe(exe_file): - return exe_file - - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" - __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com/watch\?v=|youtu\.be)(?:.*)' + __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+' __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), (".mp4" , "bool" , "Allow .mp4" , True ), diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 7b45c40a8..1e04d388e 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -54,6 +54,26 @@ def fixurl(url): #@TODO: Move to utils in 0.4.10 def timestamp(): return int(time.time() * 1000) + + +#@TODO: Move to utils in 0.4.10 +def which(program): + """ + Works exactly like the unix command which + Courtesy of http://stackoverflow.com/a/377028/675646 + """ + isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) + + fpath, fname = os.path.split(program) + + if fpath: + if isExe(program): + return program + else: + for path in os.environ['PATH'].split(os.pathsep): + exe_file = os.path.join(path.strip('"'), program) + if isExe(exe_file): + return exe_file def seconds_to_midnight(gmt=0): @@ -146,7 +166,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __status__ = "testing" __pattern__ = r'^unmatchable$' -- cgit v1.2.3 From 5c5bf90bdc709a224c20e2d68dd49489cb24a1fe Mon Sep 17 00:00:00 2001 From: estaban Date: Sun, 30 Aug 2015 11:04:22 +0100 Subject: Broken OneFIchierCom plugin Syntax error in commit [https://github.com/pyload/pyload/commit/10213910fdb5a1c2e7bde50fdd7cdfb99090bf7e] which makes importing OneFichierCom break. Please test your code before pull requesting. --- module/plugins/hoster/OneFichierCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 93f056377..70229a6ef 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.89" + __version__ = "0.90" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:(?P\w+)\.)?(?P1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P\w+))?' @@ -54,7 +54,7 @@ class OneFichierCom(SimpleHoster): else: if 'content-type' in headers and headers['content-type'] == "application/octet-stream": if "filename=" in headers.get('content-disposition'): - name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:]['filename'].strip("\"'") + name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:])['filename'].strip("\"'") else: name = url -- cgit v1.2.3 From 7ba2c2414ccc0ac141cea5bfe646d86b7d94a3ad Mon Sep 17 00:00:00 2001 From: Nippey Date: Wed, 2 Sep 2015 17:39:11 +0200 Subject: Update Checksum.py The "is" operator checks for object equality, but in this case we want to compare integers. Reason of change: 02.09.2015 17:32:23 WARNING HOOK Checksum: File abcdefg.rar has incorrect size: 106954752 B (106954752 expected) --- module/plugins/hooks/Checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index da4d35df1..64c5fa3ff 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -38,7 +38,7 @@ def compute_checksum(local_file, algorithm): class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), @@ -114,7 +114,7 @@ class Checksum(Addon): api_size = int(data['size']) file_size = os.path.getsize(local_file) - if api_size is not file_size: + if api_size != file_size: self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.check_failed(pyfile, local_file, "Incorrect file size") -- cgit v1.2.3 From 4cd2b7390dd97dc2016ab71f954f191de12f2f46 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 3 Sep 2015 20:37:17 +0200 Subject: Spare fixes (2) --- module/plugins/accounts/OboomCom.py | 9 ++-- module/plugins/accounts/RapiduNet.py | 2 +- module/plugins/crypter/GoogledriveComFolder.py | 4 +- module/plugins/crypter/LinkCryptWs.py | 2 +- .../plugins/crypter/TNTVillageScambioeticoOrg.py | 4 +- module/plugins/hooks/ExtractArchive.py | 12 ++--- module/plugins/hooks/TransmissionRPC.py | 32 +++++++------ module/plugins/hoster/ShareonlineBiz.py | 4 +- module/plugins/internal/Addon.py | 8 +++- module/plugins/internal/Hoster.py | 53 +++++++++++++--------- module/plugins/internal/Plugin.py | 6 +-- module/plugins/internal/SimpleCrypter.py | 2 +- module/plugins/internal/SimpleHoster.py | 22 +++++---- 13 files changed, 90 insertions(+), 70 deletions(-) diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 380368b70..a792848ea 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -40,7 +40,7 @@ class OboomCom(Account): get={'auth': user, 'pass': pbkdf2})) - if not result[0] == 200: + if result[0] != 200: self.log_warning(_("Failed to log in: %s") % result[1]) self.login_fail() @@ -52,10 +52,7 @@ class OboomCom(Account): userData = account_data['user'] - if userData['premium'] == "null": - premium = False - else: - premium = True + premium = userData['premium'] != "null" if userData['premium_unix'] == "null": validUntil = -1 @@ -65,7 +62,7 @@ class OboomCom(Account): traffic = userData['traffic'] trafficLeft = traffic['current'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 session = account_data['session'] diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 1ec29bd77..2033d377f 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -62,5 +62,5 @@ class RapiduNet(Account): self.log_debug(json) - if not json['message'] == "success": + if json['message'] != "success": self.login_fail() diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py index 88c7ebab2..e7a5bae2c 100644 --- a/module/plugins/crypter/GoogledriveComFolder.py +++ b/module/plugins/crypter/GoogledriveComFolder.py @@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class GoogledriveComFolder(SimpleCrypter): __name__ = "GoogledriveCom" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Drive.google.com folder decrypter plugin""" diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 557a63cbd..095ca0158 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -152,7 +152,7 @@ class LinkCryptWs(Crypter): unrarpw = sitein[indexi:indexe] - if not (unrarpw == "Password" or "Dateipasswort") : + if unrarpw not in ("Password", "Dateipasswort"): self.log_debug("File password set to: [%s]"% unrarpw) self.pyfile.package().password = unrarpw diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py index 6ba1ee19b..e85a8fbb7 100644 --- a/module/plugins/crypter/TNTVillageScambioeticoOrg.py +++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py @@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class TNTVillageScambioeticoOrg(SimpleCrypter): __name__ = "TNTVillageScambioeticoOrg" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """TNTVillage.scambioetico.org decrypter plugin""" diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index eab196160..87cd38ade 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,7 +51,7 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, Expose, threaded -from module.plugins.internal.Plugin import replace_patterns +from module.plugins.internal.Plugin import exists, replace_patterns from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.utils import fs_encode, save_join as fs_join, uniqify @@ -107,7 +107,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.49" + __version__ = "1.50" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , True ), @@ -288,7 +288,7 @@ class ExtractArchive(Addon): if subfolder: out = fs_join(out, pypack.folder) - if not os.path.exists(out): + if not exists(out): os.makedirs(out) matched = False @@ -313,7 +313,7 @@ class ExtractArchive(Addon): for fname, fid, fout in targets: name = os.path.basename(fname) - if not os.path.exists(fname): + if not exists(fname): self.log_debug(name, "File not found") continue @@ -356,7 +356,7 @@ class ExtractArchive(Addon): for filename in new_files: file = fs_encode(fs_join(os.path.dirname(archive.filename), filename)) - if not os.path.exists(file): + if not exists(file): self.log_debug("New file %s does not exists" % filename) continue @@ -476,7 +476,7 @@ class ExtractArchive(Addon): deltotrash = self.get_config('deltotrash') for f in delfiles: file = fs_encode(f) - if not os.path.exists(file): + if not exists(file): continue if not deltotrash: diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 3d10b90c4..9a9ee04b7 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- -import re import random +import re + import pycurl from module.common.json_layer import json_loads, json_dumps @@ -9,17 +10,19 @@ from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Addon import Addon + class TransmissionRPC(Addon): - __name__ = "TransmissionRPC" - __type__ = "hook" + __name__ = "TransmissionRPC" + __type__ = "hook" + __version__ = "0.11" __status__ = "testing" __pattern__ = r"https?://.+\.torrent|magnet:\?.+" - __config__ = [("transmissionrpcurl" , "string" , "Transmission RPC URL" , "http://127.0.0.1:9091/transmission/rpc")] + __config__ = [("rpc_url", "str", "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")] - __version__ = "0.1" __description__ = """Send torrent and magnet URLs to Transmission Bittorent daemon via RPC""" - __authors__ = [("GammaC0de", None)] + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] def init(self): @@ -27,16 +30,17 @@ class TransmissionRPC(Addon): def links_added(self, links, pid): - for link in links: - m = re.search(self.__pattern__, link) - if m: - self.log_debug("sending link: %s" % link) - self.SendToTransmission(link) - links.remove(link) + pattern = re.compile(self.__pattern__) + urls = [link for link in links if pattern.match(link)] + + for url in urls: + self.log_debug("Sending link: %s" % url) + self.SendToTransmission(url) + links.remove(url) def SendToTransmission(self, url): - transmission_rpc_url = self.get_config('transmissionrpcurl') + transmission_rpc_url = self.get_config('rpc_url') client_request_id = self.__name__ + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4)) req = get_request() @@ -67,7 +71,7 @@ class TransmissionRPC(Addon): try: res = json_loads(response) if "result" in res: - self.log_debug("result: %s" % res['result']) + self.log_debug("Result: %s" % res['result']) except Exception, e: self.log_error(e) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index b5af3ea35..dbe7fe401 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -79,7 +79,7 @@ class ShareonlineBiz(SimpleHoster): post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - if not res == "0": + if res != "0": self.captcha.correct() return res else: @@ -136,7 +136,7 @@ class ShareonlineBiz(SimpleHoster): self.log_debug(dlinfo) - if not dlinfo['status'] == "online": + if dlinfo['status'] != "online": self.offline() else: pyfile.name = dlinfo['name'] diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index 45ca98eac..4ccaaba8b 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -25,7 +25,7 @@ def threaded(fn): class Addon(Plugin): __name__ = "Addon" __type__ = "hook" #@TODO: Change to `addon` in 0.4.10 - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __config__ = [] #: [("name", "type", "desc", "default")] @@ -57,6 +57,12 @@ class Addon(Plugin): self.init_events() + #@TODO: Remove in 0.4.10 + def _log(self, level, plugintype, pluginname, messages): + plugintype = "addon" if plugintype is "hook" else plugintype + return super(Addon, self)._log(level, plugintype, pluginname, messages) + + def init_events(self): if self.event_map: for event, funcs in self.event_map.items(): diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 924672acf..e6bd14329 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -44,7 +44,7 @@ def create_getInfo(klass): class Hoster(Plugin): __name__ = "Hoster" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -432,9 +432,35 @@ class Hoster(Plugin): return self.last_download - def check_download(self, rules, delete=False, file_size=0, size_tolerance=1024, read_size=1048576): + def check_filesize(self, file_size, size_tolerance=1024): """ - Checks the content of the last downloaded file, re match is saved to `lastCheck` + Checks the file size of the last downloaded file + + :param file_size: expected file size + :param size_tolerance: size check tolerance + """ + if not self.last_download: + return + + download_size = os.stat(fs_encode(self.last_download)).st_size + + if download_size < 1: + self.fail(_("Empty file")) + + elif file_size > 0: + diff = abs(file_size - download_size) + + if diff > size_tolerance: + self.fail(_("File size mismatch | Expected file size: %s | Downloaded file size: %s") + % (file_size, download_size)) + + elif diff != 0: + self.log_warning(_("File size is not equal to expected size")) + + + def check_download(self, rules, delete=False, read_size=1048576, file_size=0, size_tolerance=1024): + """ + Checks the content of the last downloaded file, re match is saved to `last_check` :param rules: dict with names and rules to match (compiled regexp or strings) :param delete: delete if matched @@ -447,26 +473,11 @@ class Hoster(Plugin): last_download = fs_encode(self.last_download) if not self.last_download or not exists(last_download): - self.last_download = "" + self.last_download = "" #@NOTE: Bad place... self.fail(self.pyfile.error or _("No file downloaded")) try: - download_size = os.stat(last_download).st_size - - if download_size < 1: - do_delete = True - self.fail(_("Empty file")) - - elif file_size > 0: - diff = abs(file_size - download_size) - - if diff > size_tolerance: - do_delete = True - self.fail(_("File size mismatch | Expected file size: %s | Downloaded file size: %s") - % (file_size, download_size)) - - elif diff != 0: - self.log_warning(_("File size is not equal to expected size")) + self.check_filesize(file_size, size_tolerance) with open(last_download, "rb") as f: content = f.read(read_size) @@ -496,8 +507,8 @@ class Hoster(Plugin): traceback.print_exc() else: + self.log_info(_("File deleted: ") + self.last_download) self.last_download = "" - self.log_info(_("File deleted")) def direct_link(self, url, follow_location=None): diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 1e04d388e..b0c0bb66e 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -54,9 +54,9 @@ def fixurl(url): #@TODO: Move to utils in 0.4.10 def timestamp(): return int(time.time() * 1000) - - -#@TODO: Move to utils in 0.4.10 + + +#@TODO: Move to utils in 0.4.10 def which(program): """ Works exactly like the unix command which diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 9597116cc..d348f92e2 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -14,7 +14,7 @@ class SimpleCrypter(Crypter, SimpleHoster): __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Simple decrypter plugin""" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 69f88081a..968a80b63 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -22,12 +22,13 @@ statusMap = dict((v, k) for k, v in _statusMap.items()) class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.81" + __version__ = "1.82" __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("use_premium", "bool", "Use premium account if available" , True), - ("fallback" , "bool", "Fallback to free download if premium fails", True)] + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("premium_fallback", "bool", "Fallback to free download if premium fails", True), + ("chk_filesize" , "bool", "Check file size" , True)] __description__ = """Simple hoster plugin""" __license__ = "GPLv3" @@ -294,7 +295,7 @@ class SimpleHoster(Hoster): self.check_file() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 - if self.get_config('fallback', True) and self.premium: + if self.get_config('premium_fallback', True) and self.premium: self.log_warning(_("Premium download failed"), e) self.restart(nopremium=True) @@ -309,15 +310,16 @@ class SimpleHoster(Hoster): self.captcha.invalid() self.retry(10, reason=_("Wrong captcha")) - # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size - # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, - file_size=self.info['size'] if 'size' in self.info else 0, - size_tolerance=10485760, - delete=False): #@TODO: Make `delete` settable in 0.4.10 + delete=True): self.error(_("Empty file")) else: + if self.get_config('chk_filesize', False) and 'size' in self.info: + # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size + # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB + self.check_filesize(self.info['size'], size_tolerance=10485760) + self.log_debug("Using default check rules...") for r, p in self.FILE_ERRORS: errmsg = self.check_download({r: re.compile(p)}) @@ -340,7 +342,7 @@ class SimpleHoster(Hoster): self.check_errors() self.log_info(_("No errors found")) - self.pyfile.error = "" + self.pyfile.error = "" #@TODO: Recheck in 0.4.10 def check_errors(self): -- cgit v1.2.3 From 353a477e9a92883ba83fad471804eb2fe4ee643c Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 4 Sep 2015 16:21:21 +0300 Subject: Update TransmissionRPC.py --- module/plugins/hooks/TransmissionRPC.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 9a9ee04b7..2ca06a9ad 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -14,7 +14,7 @@ from module.plugins.internal.Addon import Addon class TransmissionRPC(Addon): __name__ = "TransmissionRPC" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r"https?://.+\.torrent|magnet:\?.+" @@ -35,11 +35,11 @@ class TransmissionRPC(Addon): for url in urls: self.log_debug("Sending link: %s" % url) - self.SendToTransmission(url) + self.send_to_transmission(url) links.remove(url) - def SendToTransmission(self, url): + def send_to_transmission(self, url): transmission_rpc_url = self.get_config('rpc_url') client_request_id = self.__name__ + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4)) req = get_request() @@ -56,17 +56,24 @@ class TransmissionRPC(Addon): headers = dict(re.findall(r"(?P.+?): (?P.+?)\r?\n", req.header)) session_id = headers['X-Transmission-Session-Id'] req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) - response = self.load(transmission_rpc_url, - post=json_dumps({'arguments': {'filename': url}, - 'method' : 'torrent-add', - 'tag' : client_request_id}), - req=req) - + try: + response = self.load(transmission_rpc_url, + post=json_dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + except Exception, e: + self.log_error(e) + return + else: self.log_error(e) + return except Exception, e: self.log_error(e) + return try: res = json_loads(response) -- cgit v1.2.3 From ae83396021a839e85c77d498ae726186c1a5e575 Mon Sep 17 00:00:00 2001 From: emkayyyy Date: Sat, 12 Sep 2015 09:20:52 +0200 Subject: Fix IRCInterface and XMPPInterface Following Error came up when I tried setting up either IRCInterface or XMPPInterface. AttributeError: 'IRCInterface' object has no attribute 'set_daemon' With my change now it works. Might have been caused by the removal of chamelCase. --- module/plugins/hooks/IRCInterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 08b1bad0c..5d8928a57 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -18,7 +18,7 @@ from module.utils import formatSize class IRCInterface(Thread, Addon): __name__ = "IRCInterface" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"), @@ -40,7 +40,7 @@ class IRCInterface(Thread, Addon): def __init__(self, core, manager): Thread.__init__(self) Addon.__init__(self, core, manager) - self.set_daemon(True) + self.setDaemon(True) def activate(self): -- cgit v1.2.3 From c5c44335d970195780443d7ac2948e02f0e67ba1 Mon Sep 17 00:00:00 2001 From: Richard Lindner Date: Sat, 12 Sep 2015 13:55:48 +0200 Subject: fixed Go4UpCom plugin and added parameter for preferred hoster --- module/plugins/crypter/Go4UpCom.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) mode change 100644 => 100755 module/plugins/crypter/Go4UpCom.py diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py old mode 100644 new mode 100755 index 026982014..2d423a1a9 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -4,18 +4,20 @@ import re import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +import json class Go4UpCom(SimpleCrypter): __name__ = "Go4UpCom" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True), + ("preferred_hoster" , "int" , "Id of preferred hoster or 0 for all", 0)] __description__ = """Go4Up.com decrypter plugin""" __license__ = "GPLv3" @@ -32,19 +34,20 @@ class Go4UpCom(SimpleCrypter): def get_links(self): links = [] - - m = re.search(r'(/download/gethosts/.+?)"', self.html) - if m: - self.html = self.load(urlparse.urljoin("http://go4up.com/", m.group(1))) - pages = [self.load(url) for url in re.findall(self.LINK_PATTERN, self.html)] - else: - pages = [self.html] - - for html in pages: - try: - links.append(re.search(r' Date: Sun, 13 Sep 2015 00:49:51 +0300 Subject: New Hoster - UserscloudCom --- module/plugins/hoster/UserscloudCom.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 module/plugins/hoster/UserscloudCom.py diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py new file mode 100644 index 000000000..6791a6068 --- /dev/null +++ b/module/plugins/hoster/UserscloudCom.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class UserscloudCom(SimpleHoster): + __name__ = "UserscloudCom" + __type__ = "hoster" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}' + + __description__ = """userscloud.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'

(?P.+?)<' + SIZE_PATTERN = r'
(?P[\d.,]+) (?P[\w^_]+)<' + OFFLINE_PATTERN = r'The file you are trying to download is no longer available' + + + def setup(self): + self.multiDL = True + self.resume_download = False + self.chunk_limit = 1 + + def handle_free(self, pyfile): + post_data=dict(re.findall(r'', self.html)) + + self.download(pyfile.url, post=post_data) + +getInfo = create_getInfo(UserscloudCom) -- cgit v1.2.3 From 08e5142a98f49ae9e96b5d016dbee2dfc67a9685 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sun, 13 Sep 2015 01:11:25 +0300 Subject: Update UserscloudCom.py --- module/plugins/hoster/UserscloudCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py index 6791a6068..00f8e0324 100644 --- a/module/plugins/hoster/UserscloudCom.py +++ b/module/plugins/hoster/UserscloudCom.py @@ -13,7 +13,7 @@ class UserscloudCom(SimpleHoster): __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}' - __description__ = """userscloud.com hoster plugin""" + __description__ = """Userscloud.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("GammaC0de", None)] -- cgit v1.2.3 From fbb98784866ec884fca5f067436e8117a3b1b24b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 13 Sep 2015 03:34:46 +0200 Subject: [UlozTo] Hoster update --- module/plugins/hoster/UlozTo.py | 10 ++++++---- module/plugins/hoster/UserscloudCom.py | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index b402433a4..066d1daf0 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convert_decimal_prefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.13" + __version__ = "1.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P\w+/[^/?]*)' @@ -27,7 +27,7 @@ class UlozTo(SimpleHoster): INFO_PATTERN = r'

File (?P[^<]+) is password protected

' - NAME_PATTERN = r'(?P<N>[^<]+) \| Uloz\.to' + NAME_PATTERN = r'(?P<N>.+?) \|' SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' OFFLINE_PATTERN = r'<title>404 - Page not found|

File (has been deleted|was banned)

' @@ -68,7 +68,9 @@ class UlozTo(SimpleHoster): #: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.log_debug('Using "new" version') - xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) + xapca = self.load("http://www.ulozto.net/reloadXapca.php", + get={'rnd': str(int(time.time()))}) + xapca = xapca.replace('sound":"', 'sound":"http:').replace('image":"', 'image":"http:') self.log_debug("xapca = " + str(xapca)) data = json_loads(xapca) @@ -121,7 +123,7 @@ class UlozTo(SimpleHoster): def check_file(self): check = self.check_download({ - 'wrong_captcha': re.compile(r'