diff options
Diffstat (limited to 'pyload/plugin')
322 files changed, 2009 insertions, 2061 deletions
diff --git a/pyload/plugin/Extractor.py b/pyload/plugin/Extractor.py index 01429570a..80f123a52 100644 --- a/pyload/plugin/Extractor.py +++ b/pyload/plugin/Extractor.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import re from pyload.datatype.File import PyFile from pyload.plugin.Plugin import Base @@ -18,16 +19,15 @@ class PasswordError(Exception): pass -class Extractor(Base): +class Extractor: __name = "Extractor" __type = "extractor" - __version = "0.21" + __version = "0.24" __description = """Base extractor plugin""" __license = "GPLv3" - __authors = [("RaNaN", "ranan@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("Immenz", "immenz@gmx.net")] + __authors = [("Walter Purcaro", "vuolter@gmail.com"), + ("Immenz" , "immenz@gmx.net" )] EXTENSIONS = [] @@ -38,11 +38,11 @@ class Extractor(Base): @classmethod def isArchive(cls, filename): name = os.path.basename(filename).lower() - return any(name.endswith(ext) for ext in cls.EXTENSIONS) and not cls.isMultipart(filename) + return any(name.endswith(ext) for ext in cls.EXTENSIONS) @classmethod - def isMultipart(cls,filename): + def isMultipart(cls, filename): return False @@ -60,7 +60,16 @@ class Extractor(Base): :param files_ids: List of filepathes :return: List of targets, id tuple list """ - return [(fname, id, fout) for fname, id, fout in files_ids if cls.isArchive(fname)] + targets = [] + processed = [] + + for fname, id, fout in files_ids: + if cls.isArchive(fname): + pname = re.sub(cls.re_multipart, '', fname) if cls.isMultipart(fname) else os.path.splitext(fname)[0] + if pname not in processed: + processed.append(pname) + targets.append((fname, id, fout)) + return targets def __init__(self, manager, filename, out, @@ -68,20 +77,20 @@ class Extractor(Base): overwrite=False, excludefiles=[], renice=0, - delete=False, + delete='No', keepbroken=False, fid=None): """ Initialize extractor for specific file """ - self.manager = manager - self.filename = filename - self.out = out - self.fullpath = fullpath - self.overwrite = overwrite - self.excludefiles = excludefiles - self.renice = renice - self.delete = delete - self.keepbroken = keepbroken - self.files = [] #: Store extracted files here + self.manager = manager + self.filename = filename + self.out = out + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here pyfile = self.manager.core.files.getFile(fid) if fid else None self.notifyProgress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None @@ -102,7 +111,7 @@ class Extractor(Base): """ raise NotImplementedError - def test(self): + def verify(self): """Testing with Extractors buildt-in method Raises error if password is needed, integrity is questionable or else. diff --git a/pyload/plugin/account/AlldebridCom.py b/pyload/plugin/account/AlldebridCom.py index 7fc11e343..75ac430f1 100644 --- a/pyload/plugin/account/AlldebridCom.py +++ b/pyload/plugin/account/AlldebridCom.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- import re +import time import xml.dom.minidom as dom -from time import time - from BeautifulSoup import BeautifulSoup from pyload.plugin.Account import Account @@ -33,7 +32,7 @@ class AlldebridCom(Account): p = re.compile('\d+') exp_data = p.findall(time_text) - exp_time = time() + int(exp_data[0]) * 24 * 60 * 60 + int( + exp_time = time.time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 #Get expiration date from API @@ -45,7 +44,7 @@ class AlldebridCom(Account): self.logDebug(html) xml = dom.parseString(html) - exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 + exp_time = time.time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info diff --git a/pyload/plugin/account/BitshareCom.py b/pyload/plugin/account/BitshareCom.py index 4774b9062..7d7b18ff4 100644 --- a/pyload/plugin/account/BitshareCom.py +++ b/pyload/plugin/account/BitshareCom.py @@ -28,7 +28,6 @@ class BitshareCom(Account): def login(self, user, data, req): html = req.load("http://bitshare.com/login.html", post={"user": user, "password": data['password'], "submit": "Login"}, - cookies=True, decode=True) if "login" in req.lastEffectiveURL: diff --git a/pyload/plugin/account/CatShareNet.py b/pyload/plugin/account/CatShareNet.py index a604ebff1..0dcd4a7ad 100644 --- a/pyload/plugin/account/CatShareNet.py +++ b/pyload/plugin/account/CatShareNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -36,7 +35,7 @@ class CatShareNet(Account): expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) self.logDebug("Expire date: " + expiredate) - validuntil = mktime(strptime(expiredate, "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) except Exception: pass diff --git a/pyload/plugin/account/CzshareCom.py b/pyload/plugin/account/CzshareCom.py index dfe78c21c..c57e8195b 100644 --- a/pyload/plugin/account/CzshareCom.py +++ b/pyload/plugin/account/CzshareCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime import re +import time from pyload.plugin.Account import Account @@ -30,7 +30,7 @@ class CzshareCom(Account): try: m = re.search(self.CREDIT_LEFT_PATTERN, html) trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2) - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) + validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M')) except Exception, e: self.logError(e) diff --git a/pyload/plugin/account/DebridItaliaCom.py b/pyload/plugin/account/DebridItaliaCom.py index de97f6e64..563a7c531 100644 --- a/pyload/plugin/account/DebridItaliaCom.py +++ b/pyload/plugin/account/DebridItaliaCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -28,7 +27,7 @@ class DebridItaliaCom(Account): if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: - validuntil = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d/%m/%Y %H:%M")) info = {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: self.logError(_("Unable to retrieve account information")) diff --git a/pyload/plugin/account/DepositfilesCom.py b/pyload/plugin/account/DepositfilesCom.py index b3e896d31..28d2178c4 100644 --- a/pyload/plugin/account/DepositfilesCom.py +++ b/pyload/plugin/account/DepositfilesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime +import time from pyload.plugin.Account import Account @@ -23,7 +22,7 @@ class DepositfilesCom(Account): html = req.load("https://dfiles.eu/de/gold/") validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) - validuntil = mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(validuntil, "%Y-%m-%d %H:%M:%S")) return {"validuntil": validuntil, "trafficleft": -1} diff --git a/pyload/plugin/account/DropboxCom.py b/pyload/plugin/account/DropboxCom.py index 862b7a8df..d18504926 100644 --- a/pyload/plugin/account/DropboxCom.py +++ b/pyload/plugin/account/DropboxCom.py @@ -11,6 +11,7 @@ class DropboxCom(SimpleHoster): __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dropbox.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/account/EuroshareEu.py b/pyload/plugin/account/EuroshareEu.py index b37fc68fa..6fa9f35b0 100644 --- a/pyload/plugin/account/EuroshareEu.py +++ b/pyload/plugin/account/EuroshareEu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime import re +import time from pyload.plugin.Account import Account @@ -25,7 +25,7 @@ class EuroshareEu(Account): premium, validuntil = False, -1 else: premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y %H:%M")) return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} diff --git a/pyload/plugin/account/FastshareCz.py b/pyload/plugin/account/FastshareCz.py index 8fe98438b..ce79e26ad 100644 --- a/pyload/plugin/account/FastshareCz.py +++ b/pyload/plugin/account/FastshareCz.py @@ -9,7 +9,7 @@ from pyload.utils import parseFileSize class FastshareCz(Account): __name__ = "FastshareCz" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Fastshare.cz account plugin""" __license__ = "GPLv3" @@ -17,13 +17,13 @@ class FastshareCz(Account): ("stickell", "l.stickell@yahoo.it")] - CREDIT_PATTERN = r'My account\s*\((.+?)\)' + CREDIT_PATTERN = r'Credit\s*:\s*</td>\s*<td>(.+?)\s*<' def loadAccountInfo(self, user, req): - validuntil = None + validuntil = -1 trafficleft = None - premium = None + premium = False html = req.load("http://www.fastshare.cz/user", decode=True) @@ -31,13 +31,11 @@ class FastshareCz(Account): if m: trafficleft = self.parseTraffic(m.group(1)) - if trafficleft: - premium = True - validuntil = -1 - else: - premium = False + premium = bool(trafficleft) - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): diff --git a/pyload/plugin/account/FilefactoryCom.py b/pyload/plugin/account/FilefactoryCom.py index 3395b3f90..36720595f 100644 --- a/pyload/plugin/account/FilefactoryCom.py +++ b/pyload/plugin/account/FilefactoryCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from pycurl import REFERER @@ -29,7 +29,7 @@ class FilefactoryCom(Account): if m: premium = True validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<D> \g<M> \g<Y>', m.group(0)) - validuntil = mktime(strptime(validuntil, "%d %b %Y")) + validuntil = time.mktime(time.strptime(validuntil, "%d %b %Y")) else: premium = False validuntil = -1 diff --git a/pyload/plugin/account/FilejungleCom.py b/pyload/plugin/account/FilejungleCom.py index 2c476bffb..dfa7edddb 100644 --- a/pyload/plugin/account/FilejungleCom.py +++ b/pyload/plugin/account/FilejungleCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -28,7 +28,7 @@ class FilejungleCom(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: premium = True - validuntil = mktime(strptime(m.group(1), "%d %b %Y")) + validuntil = time.mktime(time.strptime(m.group(1), "%d %b %Y")) else: premium = False validuntil = -1 diff --git a/pyload/plugin/account/FilesMailRu.py b/pyload/plugin/account/FilesMailRu.py index e6afd0168..5989b5f1a 100644 --- a/pyload/plugin/account/FilesMailRu.py +++ b/pyload/plugin/account/FilesMailRu.py @@ -25,7 +25,6 @@ class FilesMailRu(Account): "Login": user, "Password": data['password'], "Page": "http://files.mail.ru/"}, - cookies=True, decode=True) if "ÐевеÑМПе ÐžÐŒÑ Ð¿ÐŸÐ»ÑзПваÑÐµÐ»Ñ ÐžÐ»Ðž паÑПлÑ" in html: diff --git a/pyload/plugin/account/FileserveCom.py b/pyload/plugin/account/FileserveCom.py index 9aab88d2b..08dfe24c7 100644 --- a/pyload/plugin/account/FileserveCom.py +++ b/pyload/plugin/account/FileserveCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from pyload.plugin.Account import Account from pyload.utils import json_loads @@ -24,7 +24,7 @@ class FileserveCom(Account): res = json_loads(html) if res['type'] == "premium": - validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) return {"trafficleft": res['traffic'], "validuntil": validuntil} else: return {"premium": False, "trafficleft": None, "validuntil": None} diff --git a/pyload/plugin/account/FreakshareCom.py b/pyload/plugin/account/FreakshareCom.py index 9c61ac513..5aef6f86c 100644 --- a/pyload/plugin/account/FreakshareCom.py +++ b/pyload/plugin/account/FreakshareCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime +import time from pyload.plugin.Account import Account @@ -26,7 +25,7 @@ class FreakshareCom(Account): try: m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M) - validuntil = mktime(strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M")) except Exception: pass @@ -46,7 +45,6 @@ class FreakshareCom(Account): html = req.load("http://freakshare.com/login.html", post={"submit": "Login", "user": user, "pass": data['password']}, - cookies=True, decode=True) if ">Wrong Username or Password" in html: diff --git a/pyload/plugin/account/FshareVn.py b/pyload/plugin/account/FshareVn.py index 282a17751..539a739df 100644 --- a/pyload/plugin/account/FshareVn.py +++ b/pyload/plugin/account/FshareVn.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -35,7 +34,7 @@ class FshareVn(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: premium = True - validuntil = mktime(strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) + validuntil = time.mktime(time.strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) trafficleft = self.getTrafficLeft() else: premium = False diff --git a/pyload/plugin/account/MegaRapidCz.py b/pyload/plugin/account/MegaRapidCz.py index 5596fd623..cdb5c732b 100644 --- a/pyload/plugin/account/MegaRapidCz.py +++ b/pyload/plugin/account/MegaRapidCz.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import mktime, strptime from pyload.plugin.Account import Account @@ -34,7 +34,7 @@ class MegaRapidCz(Account): m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M")) return {"premium": True, "trafficleft": -1, "validuntil": validuntil} m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) diff --git a/pyload/plugin/account/MegasharesCom.py b/pyload/plugin/account/MegasharesCom.py index 53b854f65..7c5d0d357 100644 --- a/pyload/plugin/account/MegasharesCom.py +++ b/pyload/plugin/account/MegasharesCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -29,7 +29,7 @@ class MegasharesCom(Account): try: timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) self.logDebug(timestr) - validuntil = mktime(strptime(timestr, "%b %d, %Y")) + validuntil = time.mktime(time.strptime(timestr, "%b %d, %Y")) except Exception, e: self.logError(e) diff --git a/pyload/plugin/account/MyfastfileCom.py b/pyload/plugin/account/MyfastfileCom.py index 838a1eefd..350d77c57 100644 --- a/pyload/plugin/account/MyfastfileCom.py +++ b/pyload/plugin/account/MyfastfileCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import time +import time from pyload.plugin.Account import Account from pyload.utils import json_loads @@ -18,7 +18,7 @@ class MyfastfileCom(Account): def loadAccountInfo(self, user, req): if 'days_left' in self.json_data: - validuntil = time() + self.json_data['days_left'] * 24 * 60 * 60 + validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60 return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: self.logError(_("Unable to get account information")) diff --git a/pyload/plugin/account/NetloadIn.py b/pyload/plugin/account/NetloadIn.py index 68982e828..bec4690a8 100644 --- a/pyload/plugin/account/NetloadIn.py +++ b/pyload/plugin/account/NetloadIn.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import time +import time from pyload.plugin.Account import Account @@ -9,36 +9,55 @@ from pyload.plugin.Account import Account class NetloadIn(Account): __name__ = "NetloadIn" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Netload.in account plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("CryNickSystems", "webmaster@pcProfil.de")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def api_response(self, id, password, req): + return req.load("http://api.netload.in/user_info.php", + get={'auth' : "BVm96BWDSoB4WkfbEhn42HgnjIe1ilMt", + 'user_id' : id, + 'user_password': password}).strip() def loadAccountInfo(self, user, req): - html = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) - left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' - left = re.search(left, html) - if left: - validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 - trafficleft = -1 + validuntil = None + trafficleft = -1 + premium = False + + html = self.api_response(user, self.getAccountData(user)['password'], req) + + if html == "-1": premium = True + + elif html == "0": + validuntil = -1 + else: - validuntil = None - premium = False - trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + try: + validuntil = time.mktime(time.strptime(html, "%Y-%m-%d %H:%M")) + + except Exception, e: + self.logError(e) + + else: + self.logDebug("Valid until: %s" % validuntil) + + if validuntil > time.mktime(time.gmtime()): + premium = True + else: + validuntil = -1 + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): - html = req.load("http://netload.in/index.php", - post={"txtuser" : user, - "txtpass" : data['password'], - "txtcheck": "login", - "txtlogin": "Login"}, - cookies=True, - decode=True) - if "password or it might be invalid!" in html: + html = self.api_response(user, data['password'], req) + + if not html or re.search(r'disallowed_agent|unknown_auth|login_failed', html): self.wrongPassword() diff --git a/pyload/plugin/account/NoPremiumPl.py b/pyload/plugin/account/NoPremiumPl.py index 929e8f7d9..49f20b1f2 100644 --- a/pyload/plugin/account/NoPremiumPl.py +++ b/pyload/plugin/account/NoPremiumPl.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import datetime import hashlib - -from datetime import datetime -from time import mktime +import time from pyload.plugin.Account import Account from pyload.utils import json_loads @@ -45,7 +44,7 @@ class NoPremiumPl(Account): if "expire" in result.keys() and result["expire"]: premium = True - valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] * 1024 return ({ diff --git a/pyload/plugin/account/NowVideoSx.py b/pyload/plugin/account/NowVideoSx.py index 8359e0410..3c63149ae 100644 --- a/pyload/plugin/account/NowVideoSx.py +++ b/pyload/plugin/account/NowVideoSx.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import gmtime, mktime, strptime +import time from pyload.plugin.Account import Account @@ -33,13 +32,13 @@ class NowVideoSx(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + validuntil = time.mktime(time.strptime(expiredate, "%Y-%b-%d")) except Exception, e: self.logError(e) else: - if validuntil > mktime(gmtime()): + if validuntil > time.mktime(time.gmtime()): premium = True else: premium = False diff --git a/pyload/plugin/account/OneFichierCom.py b/pyload/plugin/account/OneFichierCom.py index 65ec841c4..0c37654ca 100644 --- a/pyload/plugin/account/OneFichierCom.py +++ b/pyload/plugin/account/OneFichierCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime +import time from pycurl import REFERER @@ -36,7 +35,7 @@ class OneFichierCom(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) + validuntil = time.mktime(time.strptime(expiredate, "%d/%m/%Y")) except Exception, e: self.logError(e) else: diff --git a/pyload/plugin/account/OverLoadMe.py b/pyload/plugin/account/OverLoadMe.py index d945dd7bd..8677ecf47 100644 --- a/pyload/plugin/account/OverLoadMe.py +++ b/pyload/plugin/account/OverLoadMe.py @@ -15,7 +15,7 @@ class OverLoadMe(Account): def loadAccountInfo(self, user, req): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" data = self.getAccountData(user) html = req.load(https + "://api.over-load.me/account.php", get={'user': user, @@ -32,7 +32,7 @@ class OverLoadMe(Account): def login(self, user, data, req): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" jsondata = req.load(https + "://api.over-load.me/account.php", get={'user': user, 'auth': data['password']}).strip() diff --git a/pyload/plugin/account/RapideoPl.py b/pyload/plugin/account/RapideoPl.py index b4b74fab5..f14e222c3 100644 --- a/pyload/plugin/account/RapideoPl.py +++ b/pyload/plugin/account/RapideoPl.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import datetime import hashlib - -from datetime import datetime -from time import mktime +import time from pyload.plugin.Account import Account from pyload.utils import json_loads @@ -44,7 +43,7 @@ class RapideoPl(Account): valid_untill = -1 if "expire" in result.keys() and result["expire"]: premium = True - valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] diff --git a/pyload/plugin/account/RapiduNet.py b/pyload/plugin/account/RapiduNet.py index 5c165f486..b03bde6e0 100644 --- a/pyload/plugin/account/RapiduNet.py +++ b/pyload/plugin/account/RapiduNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from pyload.plugin.Account import Account from pyload.utils import json_loads @@ -38,7 +37,7 @@ class RapiduNet(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - validuntil = time() + (86400 * int(m.group(1))) + validuntil = time.time() + (86400 * int(m.group(1))) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: diff --git a/pyload/plugin/account/SimplydebridCom.py b/pyload/plugin/account/SimplydebridCom.py index a826e44c7..1d5ba201c 100644 --- a/pyload/plugin/account/SimplydebridCom.py +++ b/pyload/plugin/account/SimplydebridCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -22,7 +22,7 @@ class SimplydebridCom(Account): if str(data[0]) != "1": return {"premium": False} else: - return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} + return {"trafficleft": -1, "validuntil": time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} def login(self, user, data, req): diff --git a/pyload/plugin/account/SmoozedCom.py b/pyload/plugin/account/SmoozedCom.py index 27249c7c2..686903553 100644 --- a/pyload/plugin/account/SmoozedCom.py +++ b/pyload/plugin/account/SmoozedCom.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import hashlib +import time from beaker.crypto.pbkdf2 import PBKDF2 -from time import time from pyload.utils import json_loads from pyload.plugin.Account import Account @@ -36,7 +36,7 @@ class SmoozedCom(Account): 'session' : status["data"]["session_key"], 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} - if info['validuntil'] < time(): + if info['validuntil'] < time.time(): info['premium'] = False else: info['premium'] = True diff --git a/pyload/plugin/account/TurbobitNet.py b/pyload/plugin/account/TurbobitNet.py index e3c07da2a..d00f4c0e4 100644 --- a/pyload/plugin/account/TurbobitNet.py +++ b/pyload/plugin/account/TurbobitNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -22,7 +22,7 @@ class TurbobitNet(Account): m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) if m: premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) + validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y")) else: premium = False validuntil = -1 diff --git a/pyload/plugin/account/TusfilesNet.py b/pyload/plugin/account/TusfilesNet.py index 84e9ef9c6..48f70b4f3 100644 --- a/pyload/plugin/account/TusfilesNet.py +++ b/pyload/plugin/account/TusfilesNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import mktime, strptime, gmtime +import time from pyload.plugin.internal.XFSAccount import XFSAccount diff --git a/pyload/plugin/account/UploadedTo.py b/pyload/plugin/account/UploadedTo.py index 3b0d957a5..37900c7d3 100644 --- a/pyload/plugin/account/UploadedTo.py +++ b/pyload/plugin/account/UploadedTo.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import time +import time from pyload.plugin.Account import Account @@ -39,7 +39,7 @@ class UploadedTo(Account): else: m = re.findall(r'(\d+) (week|day|hour)', expiredate) if m: - validuntil = time() + validuntil = time.time() for n, u in m: validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u] diff --git a/pyload/plugin/account/UploadingCom.py b/pyload/plugin/account/UploadingCom.py index 6d54469e8..e1f0d07f7 100644 --- a/pyload/plugin/account/UploadingCom.py +++ b/pyload/plugin/account/UploadingCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time, strptime, mktime +import time from pyload.plugin.Account import Account from pyload.plugin.internal.SimpleHoster import set_cookies @@ -11,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Uploading.com account plugin""" __license__ = "GPLv3" @@ -37,27 +36,30 @@ class UploadingCom(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%b %d, %Y")) + validuntil = time.mktime(time.strptime(expiredate, "%b %d, %Y")) except Exception, e: self.logError(e) else: - if validuntil > mktime(gmtime()): - premium = True + if validuntil > time.mktime(time.gmtime()): + premium = True else: - premium = False + premium = False validuntil = None - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): - set_cookies([("uploading.com", "lang", "1"), - ("uploading.com", "language", "1"), - ("uploading.com", "setlang", "en"), - ("uploading.com", "_lang", "en")] + set_cookies(req.cj, + [("uploading.com", "lang" , "1" ), + ("uploading.com", "language", "1" ), + ("uploading.com", "setlang" , "en"), + ("uploading.com", "_lang" , "en")]) req.load("http://uploading.com/") - req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), + req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000), post={'email': user, 'password': data['password'], 'remember': "on"}) diff --git a/pyload/plugin/account/WebshareCz.py b/pyload/plugin/account/WebshareCz.py index efa2a0045..5384134ad 100644 --- a/pyload/plugin/account/WebshareCz.py +++ b/pyload/plugin/account/WebshareCz.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import re +import time from hashlib import md5, sha1 from passlib.hash import md5_crypt -from time import mktime, strptime, time from pyload.plugin.Account import Account @@ -34,9 +34,9 @@ class WebshareCz(Account): expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) self.logDebug("Expire date: " + expiredate) - validuntil = mktime(strptime(expiredate, "%Y-%m-%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) - premium = validuntil > time() + premium = validuntil > time.time() return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} diff --git a/pyload/plugin/account/ZeveraCom.py b/pyload/plugin/account/ZeveraCom.py index db23170f3..0e6d50a9b 100644 --- a/pyload/plugin/account/ZeveraCom.py +++ b/pyload/plugin/account/ZeveraCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime +import time from pyload.plugin.Account import Account @@ -40,7 +40,7 @@ class ZeveraCom(Account): api = self.api_response(req) if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!": - validuntil = mktime(strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) + validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) trafficleft = float(api['availabletodaytraffic']) * 1024 if api['orondaytrafficlimit'] != '0' else -1 premium = True diff --git a/pyload/plugin/addon/AndroidPhoneNotify.py b/pyload/plugin/addon/AndroidPhoneNotify.py index 2b4f8fcca..53af8aa1c 100644 --- a/pyload/plugin/addon/AndroidPhoneNotify.py +++ b/pyload/plugin/addon/AndroidPhoneNotify.py @@ -1,55 +1,74 @@ # -*- coding: utf-8 -*- -from time import time +import time from pyload.network.RequestFactory import getURL -from pyload.plugin.Addon import Addon +from pyload.plugin.Addon import Addon, Expose class AndroidPhoneNotify(Addon): __name__ = "AndroidPhoneNotify" __type__ = "addon" - __version__ = "0.05" + __version__ = "0.07" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify processed packages status" , True ), - ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), - ("force" , "bool", "Send notifications if client is connected", False)] - - __description__ = """Send push notifications to your Android Phone using notifymyandroid.com""" + ("notifyprocessed", "bool", "Notify packages processed" , True ), + ("notifyupdate" , "bool", "Notify plugin updates" , True ), + ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), + ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), + ("sendpermin" , "int" , "Max notifications per minute" , 12 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + + __description__ = """Send push notifications to your Android Phone (using notifymyandroid.com)""" __license__ = "GPLv3" - __authors__ = [("Steven Kosyra", "steven.kosyra@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Steven Kosyra" , "steven.kosyra@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com" )] - event_list = ["allDownloadsProcessed"] + event_list = ["allDownloadsProcessed", "plugin_updated"] + interval = 0 #@TODO: Remove in 0.4.10 def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - self.last_notify = 0 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 + self.notifications = 0 - def newCaptchaTask(self, task): - if not self.getConfig("notifycaptcha"): - return False + def plugin_updated(self, type_plugins): + if not self.getConfig('notifyupdate'): + return + + self.notify(_("Plugins updated"), str(type_plugins)) + + + def coreExiting(self): + if not self.getConfig('notifyexit'): + return + + if self.core.do_restart: + self.notify(_("Restarting pyLoad")) + else: + self.notify(_("Exiting pyLoad")) - if time() - self.last_notify < self.getConf("timeout"): - return False + + def newCaptchaTask(self, task): + if not self.getConfig('notifycaptcha'): + return self.notify(_("Captcha"), _("New request waiting user input")) def packageFinished(self, pypack): - if self.getConfig("notifypackage"): + if self.getConfig('notifypackage'): self.notify(_("Package finished"), pypack.name) def allDownloadsProcessed(self): - if not self.getConfig("notifyprocessed"): - return False + if not self.getConfig('notifyprocessed'): + return if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): self.notify(_("Package failed"), _("One or more packages was not completed successfully")) @@ -57,19 +76,35 @@ class AndroidPhoneNotify(Addon): self.notify(_("All packages finished")) - def notify(self, event, msg=""): - apikey = self.getConfig("apikey") + @Expose + def notify(self, + event, + msg="", + key=self.getConfig('apikey')): + + if not key: + return + + if self.core.isClientConnected() and not self.getConfig('ignoreclient'): + return + + elapsed_time = time.time() - self.last_notify + + if elapsed_time < self.getConf("sendtimewait"): + return + + if elapsed_time > 60: + self.notifications = 0 - if not apikey: - return False + elif self.notifications >= self.getConf("sendpermin"): + return - if self.core.isClientConnected() and not self.getConfig("force"): - return False getURL("http://www.notifymyandroid.com/publicapi/notify", - get={'apikey' : apikey, + get={'apikey' : key, 'application': "pyLoad", 'event' : event, 'description': msg}) - self.last_notify = time() + self.last_notify = time.time() + self.notifications += 1 diff --git a/pyload/plugin/addon/Checksum.py b/pyload/plugin/addon/Checksum.py index a45e21812..7ba5d7ab6 100644 --- a/pyload/plugin/addon/Checksum.py +++ b/pyload/plugin/addon/Checksum.py @@ -51,29 +51,33 @@ class Checksum(Addon): __description__ = """Verify downloaded file size and checksum""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("stickell" , "l.stickell@yahoo.it")] - methods = {'sfv' : 'crc32', - 'crc' : 'crc32', - 'hash': 'md5'} - regexps = {'sfv' : r'^(?P<NAME>[^;].+)\s+(?P<HASH>[0-9A-Fa-f]{8})$', - 'md5' : r'^(?P<NAME>[0-9A-Fa-f]{32}) (?P<FILE>.+)$', - 'crc' : r'filename=(?P<NAME>.+)\nsize=(?P<SIZE>\d+)\ncrc32=(?P<HASH>[0-9A-Fa-f]{8})$', - 'default': r'^(?P<HASH>[0-9A-Fa-f]+)\s+\*?(?P<NAME>.+)$'} + interval = 0 #@TODO: Remove in 0.4.10 + methods = {'sfv' : 'crc32', + 'crc' : 'crc32', + 'hash': 'md5'} + regexps = {'sfv' : r'^(?P<NAME>[^;].+)\s+(?P<HASH>[0-9A-Fa-f]{8})$', + 'md5' : r'^(?P<NAME>[0-9A-Fa-f]{32}) (?P<FILE>.+)$', + 'crc' : r'filename=(?P<NAME>.+)\nsize=(?P<SIZE>\d+)\ncrc32=(?P<HASH>[0-9A-Fa-f]{8})$', + 'default': r'^(?P<HASH>[0-9A-Fa-f]+)\s+\*?(?P<NAME>.+)$'} def activate(self): - if not self.getConfig("check_checksum"): + if not self.getConfig('check_checksum'): self.logInfo(_("Checksum validation is disabled in plugin configuration")) def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 self.algorithms = sorted( getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True) + self.algorithms.extend(["crc32", "adler32"]) + self.formats = self.algorithms + ["sfv", "crc", "hash"] @@ -121,7 +125,7 @@ class Checksum(Addon): data.pop('size', None) # validate checksum - if data and self.getConfig("check_checksum"): + if data and self.getConfig('check_checksum'): if not 'md5' in data: for type in ("checksum", "hashsum", "hash"): @@ -148,14 +152,14 @@ class Checksum(Addon): def checkFailed(self, pyfile, local_file, msg): - check_action = self.getConfig("check_action") + check_action = self.getConfig('check_action') if check_action == "retry": - max_tries = self.getConfig("max_tries") - retry_action = self.getConfig("retry_action") + max_tries = self.getConfig('max_tries') + retry_action = self.getConfig('retry_action') if pyfile.plugin.retries < max_tries: if local_file: remove(local_file) - pyfile.plugin.retry(max_tries, self.getConfig("wait_time"), msg) + pyfile.plugin.retry(max_tries, self.getConfig('wait_time'), msg) elif retry_action == "nothing": return elif check_action == "nothing": diff --git a/pyload/plugin/addon/ClickAndLoad.py b/pyload/plugin/addon/ClickAndLoad.py index 728580cac..63647e30a 100644 --- a/pyload/plugin/addon/ClickAndLoad.py +++ b/pyload/plugin/addon/ClickAndLoad.py @@ -17,30 +17,34 @@ def forward(source, destination): bufdata = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) + # destination.close() #@TODO: IPv6 support class ClickAndLoad(Addon): __name__ = "ClickAndLoad" __type__ = "addon" - __version__ = "0.37" + __version__ = "0.41" __config__ = [("activated", "bool", "Activated" , True), - ("port" , "int" , "Port" , 9666), - ("extern" , "bool", "Listen on the public network interface", True)] + ("port" , "int" , "Port" , 9666), + ("extern" , "bool", "Listen on the public network interface", True)] - __description__ = """Click'N'Load addon plugin""" + __description__ = """Click'n'Load hook plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.de"), + __authors__ = [("RaNaN" , "RaNaN@pyload.de" ), ("Walter Purcaro", "vuolter@gmail.com")] + interval = 0 #@TODO: Remove in 0.4.10 + + def activate(self): if not self.config['webinterface']['activated']: return - ip = "" if self.getConfig("extern") else "127.0.0.1" - webport = int(self.config['webinterface']['port']) + ip = "" if self.getConfig('extern') else "127.0.0.1" + webport = self.config['webinterface']['port'] cnlport = self.getConfig('port') self.proxy(ip, webport, cnlport) @@ -48,40 +52,39 @@ class ClickAndLoad(Addon): @threaded def proxy(self, ip, webport, cnlport): - self.logInfo(_("Proxy listening on %s:%s") % (ip, cnlport)) - self.manager.startThread(self._server, ip, webport, cnlport) + time.sleep(10) #@TODO: Remove in 0.4.10 (implement addon delay on startup) + + self.logInfo(_("Proxy listening on %s:%s") % (ip or "0.0.0.0", cnlport)) + + self._server(ip, webport, cnlport) + lock = Lock() lock.acquire() lock.acquire() - def _server(self, ip, webport, cnlport, thread): + @threaded + def _server(self, ip, webport, cnlport): try: - try: - server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - server_socket.bind((ip, cnlport)) - server_socket.listen(5) + dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + dock_socket.bind((ip, cnlport)) + dock_socket.listen(5) - while True: - client_socket = server_socket.accept()[0] - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + while True: + client_socket, client_addr = dock_socket.accept() + self.logDebug("Connection from %s:%s" % client_addr) - dock_socket.connect(("127.0.0.1", webport)) - - self.manager.startThread(forward, dock_socket, client_socket) - self.manager.startThread(forward, client_socket, dock_socket) + server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server_socket.connect(("127.0.0.1", webport)) - except socket.timeout: - self.logDebug("Connection timed out, retrying...") - return self._server(ip, webport, cnlport, thread) + self.manager.startThread(forward, client_socket, server_socket) + self.manager.startThread(forward, server_socket, client_socket) - finally: - server_socket.close() - client_socket.close() - dock_socket.close() + except socket.timeout: + self.logDebug("Connection timed out, retrying...") + return self._server(ip, webport, cnlport) except socket.error, e: self.logError(e) - time.sleep(120) - self._server(ip, webport, cnlport, thread) + time.sleep(240) + return self._server(ip, webport, cnlport) diff --git a/pyload/plugin/addon/DeleteFinished.py b/pyload/plugin/addon/DeleteFinished.py index 59f2e3321..aad05891e 100644 --- a/pyload/plugin/addon/DeleteFinished.py +++ b/pyload/plugin/addon/DeleteFinished.py @@ -7,10 +7,11 @@ from pyload.plugin.Addon import Addon class DeleteFinished(Addon): __name__ = "DeleteFinished" __type__ = "addon" - __version__ = "1.11" + __version__ = "1.12" - __config__ = [('interval' , 'int' , 'Delete every (hours)' , '72' ), - ('deloffline', 'bool', 'Delete packages with offline links', 'False')] + __config__ = [("activated" , "bool", "Activated" , "False"), + ("interval" , "int" , "Delete every (hours)" , "72" ), + ("deloffline", "bool", "Delete packages with offline links", "False")] __description__ = """Automatically delete all finished packages from queue""" __license__ = "GPLv3" @@ -19,8 +20,15 @@ class DeleteFinished(Addon): # event_list = ["pluginConfigChanged"] + MIN_CHECK_INTERVAL = 1 * 60 * 60 #: 1 hour + ## overwritten methods ## + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + self.interval = self.MIN_CHECK_INTERVAL + + def periodical(self): if not self.info['sleep']: deloffline = self.getConfig('deloffline') @@ -32,20 +40,21 @@ class DeleteFinished(Addon): self.addEvent('packageFinished', self.wakeup) - def pluginConfigChanged(self, plugin, name, value): - if name == "interval" and value != self.interval: - self.interval = value * 3600 - self.initPeriodical() + # def pluginConfigChanged(self, plugin, name, value): + # if name == "interval" and value != self.interval: + # self.interval = value * 3600 + # self.initPeriodical() def deactivate(self): - self.removeEvent('packageFinished', self.wakeup) + self.manager.removeEvent('packageFinished', self.wakeup) def activate(self): - self.info = {'sleep': True} - interval = self.getConfig('interval') - self.pluginConfigChanged(self.__name__, 'interval', interval) + self.info['sleep'] = True + # interval = self.getConfig('interval') + # self.pluginConfigChanged(self.__name__, 'interval', interval) + self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60 * 60) self.addEvent('packageFinished', self.wakeup) @@ -57,23 +66,17 @@ class DeleteFinished(Addon): def wakeup(self, pypack): - self.removeEvent('packageFinished', self.wakeup) + self.manager.removeEvent('packageFinished', self.wakeup) self.info['sleep'] = False ## event managing ## def addEvent(self, event, func): """Adds an event listener for event name""" - if event in self.m.events: - if func in self.m.events[event]: + if event in self.manager.events: + if func in self.manager.events[event]: self.logDebug("Function already registered", func) else: - self.m.events[event].append(func) + self.manager.events[event].append(func) else: - self.m.events[event] = [func] - - - def setup(self): - self.interval = 0 - self.m = self.manager - self.removeEvent = self.m.removeEvent + self.manager.events[event] = [func] diff --git a/pyload/plugin/addon/DownloadScheduler.py b/pyload/plugin/addon/DownloadScheduler.py index e5e25e389..ff65a478d 100644 --- a/pyload/plugin/addon/DownloadScheduler.py +++ b/pyload/plugin/addon/DownloadScheduler.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import localtime +import time from pyload.plugin.Addon import Addon @@ -21,8 +20,12 @@ class DownloadScheduler(Addon): ("stickell", "l.stickell@yahoo.it")] + interval = 0 #@TODO: Remove in 0.4.10 + + def setup(self): - self.cb = None #: callback to scheduler job; will be by removed AddonManager when addon unloaded + self.info = {} #@TODO: Remove in 0.4.10 + self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded def activate(self): @@ -31,7 +34,7 @@ class DownloadScheduler(Addon): def updateSchedule(self, schedule=None): if schedule is None: - schedule = self.getConfig("timetable") + schedule = self.getConfig('timetable') schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)", schedule.lower().replace("full", "-1").replace("none", "0")) @@ -39,7 +42,7 @@ class DownloadScheduler(Addon): self.logError(_("Invalid schedule")) return - t0 = localtime() + t0 = time.localtime() now = (t0.tm_hour, t0.tm_min, t0.tm_sec, "X") schedule = sorted([(int(x[0]), int(x[1]), 0, int(x[2])) for x in schedule] + [now]) @@ -59,7 +62,7 @@ class DownloadScheduler(Addon): def setDownloadSpeed(self, speed): if speed == 0: - abort = self.getConfig("abort") + abort = self.getConfig('abort') self.logInfo(_("Stopping download server. (Running downloads will %sbe aborted.)") % '' if abort else _('not ')) self.core.api.pauseServer() if abort: diff --git a/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py index 3d490a1f5..139be1299 100644 --- a/pyload/plugin/addon/ExternalScripts.py +++ b/pyload/plugin/addon/ExternalScripts.py @@ -3,148 +3,215 @@ import os import subprocess -from itertools import chain - from pyload.plugin.Addon import Addon -from pyload.utils import fs_join +from pyload.utils import fs_encode, fs_join class ExternalScripts(Addon): __name__ = "ExternalScripts" __type__ = "addon" - __version__ = "0.29" + __version__ = "0.37" __config__ = [("activated", "bool", "Activated" , True ), - ("wait" , "bool", "Wait script ending", False)] + ("waitend" , "bool", "Wait script ending", False)] __description__ = """Run external scripts""" __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "ranan@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("mkaay" , "mkaay@mkaay.de" ), + ("RaNaN" , "ranan@pyload.org" ), + ("spoob" , "spoob@pyload.org" ), + ("Walter Purcaro", "vuolter@gmail.com")] - event_map = {'archive-extracted' : "archive_extracted", - 'package-extracted' : "package_extracted", - 'all_archives-extracted' : "all_archives_extracted", - 'all_archives-processed' : "all_archives_processed", - 'all_downloads-finished' : "allDownloadsFinished", - 'all_downloads-processed': "allDownloadsProcessed"} + event_list = ["archive_extract_failed", "archive_extracted" , + "package_extract_failed", "package_extracted" , + "all_archives_extracted", "all_archives_processed", + "allDownloadsFinished" , "allDownloadsProcessed" , + "packageDeleted"] + interval = 0 #@TODO: Remove in 0.4.10 def setup(self): + self.info = {'oldip': None} self.scripts = {} - folders = ["download_preparing", "download_finished", "all_downloads_finished", "all_downloads_processed", + folders = ["pyload_start", "pyload_restart", "pyload_stop", "before_reconnect", "after_reconnect", - "package_finished", "package_extracted", - "archive_extracted", "all_archives_extracted", "all_archives_processed", - # deprecated folders - "unrar_finished", "all_dls_finished", "all_dls_processed"] + "download_preparing", "download_failed", "download_finished", + "archive_extract_failed", "archive_extracted", + "package_finished", "package_deleted", "package_extract_failed", "package_extracted", + "all_downloads_processed", "all_downloads_finished", #@TODO: Invert `all_downloads_processed`, `all_downloads_finished` order in 0.4.10 + "all_archives_extracted", "all_archives_processed"] for folder in folders: self.scripts[folder] = [] - - self.initPluginType(folder, os.path.join(pypath, 'scripts', folder)) - self.initPluginType(folder, os.path.join('scripts', folder)) + for dir in (pypath, ''): + self.initPluginType(folder, os.path.join(dir, 'scripts', folder)) for script_type, names in self.scripts.iteritems(): if names: - self.logInfo(_("Installed scripts for"), script_type, ", ".join(map(os.path.basename, names))) + self.logInfo(_("Installed scripts for: ") + script_type, ", ".join(map(os.path.basename, names))) + self.pyload_start() - def initPluginType(self, folder, path): - if not os.path.exists(path): + + def initPluginType(self, name, dir): + if not os.path.isdir(dir): try: - os.makedirs(path) + os.makedirs(dir) - except Exception: - self.logDebug("Script folder %s not created" % folder) + except OSError, e: + self.logDebug(e) return - for f in os.listdir(path): - if f.startswith("#") or f.startswith(".") or f.startswith("_") or f.endswith("~") or f.endswith(".swp"): + for filename in os.listdir(dir): + file = save_join(dir, filename) + + if not os.path.isfile(file): + continue + + if filename[0] in ("#", "_") or filename.endswith("~") or filename.endswith(".swp"): continue - if not os.access(os.path.join(path, f), os.X_OK): - self.logWarning(_("Script not executable:") + " %s/%s" % (folder, f)) + if not os.access(file, os.X_OK): + self.logWarning(_("Script not executable:") + " %s/%s" % (name, filename)) - self.scripts[folder].append(os.path.join(path, f)) + self.scripts[name].append(file) def callScript(self, script, *args): try: - cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] + cmd_args = [fs_encode(str(x) if not isinstance(x, basestring) else x) for x in args] + cmd = [script] + cmd_args - self.logDebug("Executing", os.path.abspath(script), " ".join(cmd)) + self.logDebug("Executing: %s" % os.path.abspath(script), "Args: " + ' '.join(cmd_args)) p = subprocess.Popen(cmd, bufsize=-1) #@NOTE: output goes to pyload - if self.getConfig('wait'): + if self.getConfig('waitend'): p.communicate() except Exception, e: - self.logError(_("Error in %(script)s: %(error)s") % {"script": os.path.basename(script), "error": e}) + try: + self.logError(_("Runtime error: %s") % os.path.abspath(script), e) + except Exception: + self.logError(_("Runtime error: %s") % os.path.abspath(script), _("Unknown error")) + + + def pyload_start(self): + for script in self.scripts['pyload_start']: + self.callScript(script) + + + def coreExiting(self): + for script in self.scripts['pyload_restart' if self.core.do_restart else 'pyload_stop']: + self.callScript(script) + + + def beforeReconnecting(self, ip): + for script in self.scripts['before_reconnect']: + self.callScript(script, ip) + self.info['oldip'] = ip + + + def afterReconnecting(self, ip): + for script in self.scripts['after_reconnect']: + self.callScript(script, ip, self.info['oldip']) #@TODO: Use built-in oldip in 0.4.10 def downloadPreparing(self, pyfile): for script in self.scripts['download_preparing']: - self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id) + self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, None) + + + def downloadFailed(self, pyfile): + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pyfile.package().folder) + else: + download_folder = self.config['general']['download_folder'] + + for script in self.scripts['download_failed']: + file = save_join(download_folder, pyfile.name) + self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, file) def downloadFinished(self, pyfile): - download_folder = self.config['general']['download_folder'] + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pyfile.package().folder) + else: + download_folder = self.config['general']['download_folder'] + for script in self.scripts['download_finished']: - filename = fs_join(download_folder, pyfile.package().folder, pyfile.name) - self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, filename, pyfile.id) + file = save_join(download_folder, pyfile.name) + self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, file) + + + def archive_extract_failed(self, pyfile, archive): + for script in self.scripts['archive_extract_failed']: + self.callScript(script, pyfile.id, pyfile.name, archive.out, archive.filename, archive.files) + + + def archive_extracted(self, pyfile, archive): + for script in self.scripts['archive_extracted']: + self.callScript(script, pyfile.id, pyfile.name, archive.out, archive.filename, archive.files) def packageFinished(self, pypack): - download_folder = self.config['general']['download_folder'] + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + else: + download_folder = self.config['general']['download_folder'] + for script in self.scripts['package_finished']: - folder = fs_join(download_folder, pypack.folder) - self.callScript(script, pypack.name, folder, pypack.password, pypack.id) + self.callScript(script, pypack.id, pypack.name, download_folder) - def beforeReconnecting(self, ip): - for script in self.scripts['before_reconnect']: - self.callScript(script, ip) + def packageDeleted(self, pid): + pack = self.core.api.getPackageInfo(pid) + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pack.folder) + else: + download_folder = self.config['general']['download_folder'] - def afterReconnecting(self, ip): - for script in self.scripts['after_reconnect']: - self.callScript(script, ip) + for script in self.scripts['package_deleted']: + self.callScript(script, pack.id, pack.name, download_folder) - def archive_extracted(self, pyfile, folder, filename, files): - for script in self.scripts['archive_extracted']: - self.callScript(script, folder, filename, files) - for script in self.scripts['unrar_finished']: #: deprecated - self.callScript(script, folder, filename) + def package_extract_failed(self, pypack): + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + else: + download_folder = self.config['general']['download_folder'] + + for script in self.scripts['package_extract_failed']: + self.callScript(script, pypack.id, pypack.name, download_folder) def package_extracted(self, pypack): - download_folder = self.config['general']['download_folder'] + if self.config['general']['folder_per_package']: + download_folder = save_join(self.config['general']['download_folder'], pypack.folder) + else: + download_folder = self.config['general']['download_folder'] + for script in self.scripts['package_extracted']: - folder = fs_join(download_folder, pypack.folder) - self.callScript(script, pypack.name, folder, pypack.password, pypack.id) + self.callScript(script, pypack.id, pypack.name, download_folder) - def all_archives_extracted(self): - for script in self.scripts['all_archives_extracted']: + def allDownloadsFinished(self): + for script in self.scripts['all_downloads_finished']: self.callScript(script) - def all_archives_processed(self): - for script in self.scripts['all_archives_processed']: + def allDownloadsProcessed(self): + for script in self.scripts['all_downloads_processed']: self.callScript(script) - def allDownloadsFinished(self): - for script in chain(self.scripts['all_downloads_finished'], self.scripts['all_dls_finished']): + def all_archives_extracted(self): + for script in self.scripts['all_archives_extracted']: self.callScript(script) - def allDownloadsProcessed(self): - for script in chain(self.scripts['all_downloads_processed'], self.scripts['all_dls_processed']): + def all_archives_processed(self): + for script in self.scripts['all_archives_processed']: self.callScript(script) diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 337b3ea30..3c71e7e1a 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -12,8 +12,7 @@ from traceback import print_exc # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": import errno - - from subprocess import Popen + import subprocess def _eintr_retry_call(func, *args): while True: @@ -33,6 +32,7 @@ if sys.version_info < (2, 7) and os.name != "nt": if self.returncode is None: try: pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0) + except OSError, e: if e.errno != errno.ECHILD: raise @@ -43,7 +43,7 @@ if sys.version_info < (2, 7) and os.name != "nt": self._handle_exitstatus(sts) return self.returncode - Popen.wait = wait + subprocess.Popen.wait = wait if os.name != "nt": from grp import getgrnam @@ -93,35 +93,37 @@ class ArchiveQueue(object): queue = self.get() try: queue.remove(item) + except ValueError: pass + if queue == []: return self.delete() - return self.set(queue) + return self.set(queue) class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "addon" - __version__ = "1.30" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract with full paths" , True ), - ("overwrite" , "bool" , "Overwrite files" , False ), - ("keepbroken" , "bool" , "Try to extract broken archives" , False ), - ("repair" , "bool" , "Repair broken archives (rar required)" , False ), - ("test" , "bool" , "Test archive before extracting" , False ), - ("usepasswordfile" , "bool" , "Use password file" , True ), - ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), - ("delete" , "bool" , "Delete archive when successfully extracted", False ), - ("subfolder" , "bool" , "Create subfolder for each package" , False ), - ("destination" , "folder", "Extract files to folder" , "" ), - ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), - ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), - ("recursive" , "bool" , "Extract archives in archives" , True ), - ("waitall" , "bool" , "Wait for all downloads to be finished" , False ), - ("renice" , "int" , "CPU priority" , 0 )] + __version__ = "1.38" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("fullpath" , "bool" , "Extract with full paths" , True ), + ("overwrite" , "bool" , "Overwrite files" , False ), + ("keepbroken" , "bool" , "Try to extract broken archives" , False ), + ("repair" , "bool" , "Repair broken archives (RAR required)" , False ), + ("test" , "bool" , "Test archive before extracting" , False ), + ("usepasswordfile", "bool" , "Use password file" , True ), + ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), + ("delete" , "No;Permanent;Trash", "Delete archive after extraction" , "No" ), + ("subfolder" , "bool" , "Create subfolder for each package" , False ), + ("destination" , "folder" , "Extract files to folder" , "" ), + ("extensions" , "str" , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), + ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), + ("recursive" , "bool" , "Extract archives in archives" , True ), + ("waitall" , "bool" , "Run after all downloads was processed" , False ), + ("renice" , "int" , "CPU priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" @@ -135,6 +137,8 @@ class ExtractArchive(Addon): def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") @@ -144,6 +148,7 @@ class ExtractArchive(Addon): self.extractors = [] self.passwords = [] self.repair = False + self.trash = False def activate(self): @@ -154,7 +159,7 @@ class ExtractArchive(Addon): if klass.isUsable(): self.extractors.append(klass) if klass.REPAIR: - self.repair = self.getConfig("repair") + self.repair = self.getConfig('repair') except OSError, e: if e.errno == 2: @@ -175,11 +180,12 @@ class ExtractArchive(Addon): else: self.logInfo(_("No Extract plugins activated")) + @threaded - def extractQueued(self,thread): + def extractQueued(self, thread): packages = self.queue.get() while packages: - if self.lastPackage: # called from allDownloadsProcessed + if self.lastPackage: #: called from allDownloadsProcessed self.lastPackage = False if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") @@ -188,7 +194,7 @@ class ExtractArchive(Addon): if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now pass - packages = self.queue.get() # check for packages added during extraction + packages = self.queue.get() #: check for packages added during extraction @Expose @@ -196,7 +202,7 @@ class ExtractArchive(Addon): """ Extract packages with given id""" for id in ids: self.queue.add(id) - if not self.getConfig("waitall") and not self.extracting: + if not self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -206,7 +212,7 @@ class ExtractArchive(Addon): def packageFinished(self, pypack): self.queue.add(pypack.id) - if not self.getConfig("waitall") and not self.extracting: + if not self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -216,7 +222,8 @@ class ExtractArchive(Addon): self.extractQueued() - def extract(self, ids, thread=None): + @Expose + def extract(self, ids, thread=None): #@TODO: Use pypack, not pid to improve method usability if not ids: return False @@ -228,17 +235,17 @@ class ExtractArchive(Addon): toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') - destination = self.getConfig("destination") - subfolder = self.getConfig("subfolder") - fullpath = self.getConfig("fullpath") - overwrite = self.getConfig("overwrite") - renice = self.getConfig("renice") - recursive = self.getConfig("recursive") - delete = self.getConfig("delete") - keepbroken = self.getConfig("keepbroken") + destination = self.getConfig('destination') + subfolder = self.getConfig('subfolder') + fullpath = self.getConfig('fullpath') + overwrite = self.getConfig('overwrite') + renice = self.getConfig('renice') + recursive = self.getConfig('recursive') + delete = self.getConfig('delete') + keepbroken = self.getConfig('keepbroken') - extensions = [x.lstrip('.').lower() for x in toList(self.getConfig("extensions"))] - excludefiles = toList(self.getConfig("excludefiles")) + extensions = [x.lstrip('.').lower() for x in toList(self.getConfig('extensions'))] + excludefiles = toList(self.getConfig('excludefiles')) if extensions: self.logDebug("Use for extensions: %s" % "|.".join(extensions)) @@ -246,20 +253,20 @@ class ExtractArchive(Addon): # reload from txt file self.reloadPasswords() - # dl folder - dl = self.config['general']['download_folder'] + download_folder = self.config['general']['download_folder'] - #iterate packages -> extractors -> targets + # iterate packages -> extractors -> targets for pid in ids: pypack = self.core.files.getPackage(pid) if not pypack: + self.queue.remove(pid) continue self.logInfo(_("Check package: %s") % pypack.name) # determine output folder - out = fs_join(dl, pypack.folder, destination, "") #: force trailing slash + out = fs_join(download_folder, pypack.folder, destination, "") #: force trailing slash if subfolder: out = fs_join(out, pypack.folder) @@ -269,7 +276,8 @@ class ExtractArchive(Addon): matched = False success = True - files_ids = [(fs_join(dl, pypack.folder, pylink['name']), pylink['id'], out) for pylink in pypack.getChildren().itervalues()] + files_ids = dict((pylink['name'],((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ + in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: remove duplicates # check as long there are unseen files while files_ids: @@ -294,6 +302,7 @@ class ExtractArchive(Addon): self.logInfo(name, _("Extract to: %s") % fout) try: + pyfile = self.core.files.getFile(fid) archive = Extractor(self, fname, fout, @@ -304,16 +313,24 @@ class ExtractArchive(Addon): delete, keepbroken, fid) + + thread.addActive(pyfile) archive.init() - new_files = self._extract(archive, fid, pypack.password, thread) + try: + new_files = self._extract(pyfile, archive, pypack.password) + + finally: + thread.finishFile(pyfile) except Exception, e: self.logError(name, e) success = False continue - files_ids.remove((fname, fid, fout)) # don't let other extractors spam log + # remove processed file and related multiparts from list + files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ + if fname not in archive.getDeleteFiles()] self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) @@ -324,12 +341,11 @@ class ExtractArchive(Addon): continue if recursive and os.path.isfile(file): - new_files_ids.append((filename, fid, os.path.dirname(filename))) # append as new target + new_files_ids.append((filename, fid, os.path.dirname(filename))) #: append as new target - pyfile = self.core.files.getFile(fid) - self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.filename, new_files) + self.manager.dispatchEvent("archive_extracted", pyfile, archive) - files_ids = new_files_ids # also check extracted files + files_ids = new_files_ids #: also check extracted files if matched: if success: @@ -357,25 +373,23 @@ class ExtractArchive(Addon): return True if not failed else False - def _extract(self, archive, fid, password, thread): - pyfile = self.core.files.getFile(fid) + def _extract(self, pyfile, archive, password): name = os.path.basename(archive.filename) - thread.addActive(pyfile) pyfile.setStatus("processing") encrypted = False try: self.logDebug("Password: %s" % (password or "None provided")) - passwords = uniqify([password] + self.getPasswords(False)) if self.getConfig("usepasswordfile") else [password] + passwords = uniqify([password] + self.getPasswords(False)) if self.getConfig('usepasswordfile') else [password] for pw in passwords: try: - if self.getConfig("test") or self.repair: - pyfile.setCustomStatus(_("testing")) + if self.getConfig('test') or self.repair: + pyfile.setCustomStatus(_("archive testing")) if pw: self.logDebug("Testing with password: %s" % pw) pyfile.setProgress(0) - archive.test(pw) + archive.verify(pw) pyfile.setProgress(100) else: archive.check(pw) @@ -395,12 +409,12 @@ class ExtractArchive(Addon): if self.repair: self.logWarning(name, _("Repairing...")) - pyfile.setCustomStatus(_("repairing")) + pyfile.setCustomStatus(_("archive repairing")) pyfile.setProgress(0) repaired = archive.repair() pyfile.setProgress(100) - if not repaired and not self.getConfig("keepbroken"): + if not repaired and not self.getConfig('keepbroken'): raise CRCError("Archive damaged") self.addPassword(pw) @@ -414,7 +428,7 @@ class ExtractArchive(Addon): pyfile.setCustomStatus(_("extracting")) pyfile.setProgress(0) - if not encrypted or not self.getConfig("usepasswordfile"): + if not encrypted or not self.getConfig('usepasswordfile'): self.logDebug("Extracting using password: %s" % (password or "None")) archive.extract(password) else: @@ -432,17 +446,31 @@ class ExtractArchive(Addon): raise PasswordError pyfile.setProgress(100) - pyfile.setCustomStatus(_("finalizing")) + pyfile.setStatus("processing") + delfiles = archive.getDeleteFiles() if self.core.debug: - self.logDebug("Would delete: %s" % ", ".join(archive.getDeleteFiles())) + self.logDebug("Would delete: %s" % ", ".join(delfiles)) - if self.getConfig("delete"): - files = archive.getDeleteFiles() - self.logInfo(_("Deleting %s files") % len(files)) - for f in files: + if self.getConfig('delete') != 'No': + try: + from send2trash import send2trash + if self.getConfig('delete') == "Trash": + self.trash = True + self.logInfo(_("Sending %s files to trash") % len(delfiles)) + except ImportError: + self.logError(name, _("Send2Trash not installed, no files deleted")) + self.trash = False + + if self.getConfig('delete') == "Permanent": + self.trash = False + self.logInfo(_("Deleting %s files") % len(delfiles)) + + for f in delfiles: file = fs_encode(f) - if os.path.exists(file): + if os.path.exists(file) and self.trash: + send2trash(file) + elif os.path.exists(file): os.remove(file) else: self.logDebug("%s does not exists" % f) @@ -466,10 +494,7 @@ class ExtractArchive(Addon): if self.core.debug: print_exc() - finally: - pyfile.finishIfDone() - - self.manager.dispatchEvent("archive_extract_failed", pyfile) + self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) raise Exception(_("Extract failed")) @@ -487,7 +512,7 @@ class ExtractArchive(Addon): try: passwords = [] - file = fs_encode(self.getConfig("passwordfile")) + file = fs_encode(self.getConfig('passwordfile')) with open(file) as f: for pw in f.read().splitlines(): passwords.append(pw) @@ -505,7 +530,7 @@ class ExtractArchive(Addon): try: self.passwords = uniqify([password] + self.passwords) - file = fs_encode(self.getConfig("passwordfile")) + file = fs_encode(self.getConfig('passwordfile')) with open(file, "wb") as f: for pw in self.passwords: f.write(pw + '\n') diff --git a/pyload/plugin/addon/HotFolder.py b/pyload/plugin/addon/HotFolder.py index 1b1235f09..0137514a8 100644 --- a/pyload/plugin/addon/HotFolder.py +++ b/pyload/plugin/addon/HotFolder.py @@ -14,7 +14,7 @@ from pyload.utils import fs_encode, fs_join class HotFolder(Addon): __name__ = "HotFolder" __type__ = "addon" - __version__ = "0.13" + __version__ = "0.14" __config__ = [("folder" , "str" , "Folder to observe" , "container"), ("watch_file", "bool", "Observe link file" , False ), @@ -35,14 +35,14 @@ class HotFolder(Addon): def periodical(self): - folder = fs_encode(self.getConfig("folder")) - file = fs_encode(self.getConfig("file")) + folder = fs_encode(self.getConfig('folder')) + file = fs_encode(self.getConfig('file')) try: if not os.path.isdir(os.path.join(folder, "finished")): os.makedirs(os.path.join(folder, "finished")) - if self.getConfig("watch_file"): + if self.getConfig('watch_file'): with open(file, "a+") as f: f.seek(0) content = f.read().strip() @@ -64,11 +64,11 @@ class HotFolder(Addon): if not os.path.isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."): continue - newpath = os.path.join(folder, "finished", f if self.getConfig("keep") else "tmp_" + f) + newpath = os.path.join(folder, "finished", f if self.getConfig('keep') else "tmp_" + f) move(path, newpath) self.logInfo(_("Added %s from HotFolder") % f) self.core.api.addPackage(f, [newpath], 1) - except IOError, e: + except (IOError, OSError), e: self.logError(e) diff --git a/pyload/plugin/addon/IRCInterface.py b/pyload/plugin/addon/IRCInterface.py index 86d9ea688..9038ce993 100644 --- a/pyload/plugin/addon/IRCInterface.py +++ b/pyload/plugin/addon/IRCInterface.py @@ -8,7 +8,6 @@ import time from pycurl import FORM_FILE from select import select from threading import Thread -from time import sleep from traceback import print_exc from pyload.api import PackageDoesNotExists, FileDoesNotExists @@ -38,6 +37,9 @@ class IRCInterface(Thread, Addon): __authors__ = [("Jeix", "Jeix@hasnomail.com")] + interval = 0 #@TODO: Remove in 0.4.10 + + def __init__(self, core, manager): Thread.__init__(self) Addon.__init__(self, core, manager) @@ -54,7 +56,7 @@ class IRCInterface(Thread, Addon): def packageFinished(self, pypack): try: - if self.getConfig("info_pack"): + if self.getConfig('info_pack'): self.response(_("Package finished: %s") % pypack.name) except Exception: pass @@ -62,7 +64,7 @@ class IRCInterface(Thread, Addon): def downloadFinished(self, pyfile): try: - if self.getConfig("info_file"): + if self.getConfig('info_file'): self.response( _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname}) except Exception: @@ -70,7 +72,7 @@ class IRCInterface(Thread, Addon): def captchaTask(self, task): - if self.getConfig("captcha") and task.isTextual(): + if self.getConfig('captcha') and task.isTextual(): task.handler.append(self) task.setWaiting(60) @@ -85,16 +87,16 @@ class IRCInterface(Thread, Addon): def run(self): # connect to IRC etc. self.sock = socket.socket() - host = self.getConfig("host") - self.sock.connect((host, self.getConfig("port"))) + host = self.getConfig('host') + self.sock.connect((host, self.getConfig('port'))) - if self.getConfig("ssl"): - self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support custom certificate + if self.getConfig('ssl'): + self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support certificate - nick = self.getConfig("nick") + nick = self.getConfig('nick') self.sock.send("NICK %s\r\n" % nick) self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick)) - for t in self.getConfig("owner").split(): + for t in self.getConfig('owner').split(): if t.strip().startswith("#"): self.sock.send("JOIN %s\r\n" % t.strip()) self.logInfo(_("Connected to"), host) @@ -111,7 +113,7 @@ class IRCInterface(Thread, Addon): def main_loop(self): readbuffer = "" while True: - sleep(1) + time.sleep(1) fdset = select([self.sock], [], [], 0) if self.sock not in fdset[0]: continue @@ -148,10 +150,10 @@ class IRCInterface(Thread, Addon): def handle_events(self, msg): - if not msg['origin'].split("!", 1)[0] in self.getConfig("owner").split(): + if not msg['origin'].split("!", 1)[0] in self.getConfig('owner').split(): return - if msg['target'].split("!", 1)[0] != self.getConfig("nick"): + if msg['target'].split("!", 1)[0] != self.getConfig('nick'): return if msg['action'] != "PRIVMSG": @@ -192,7 +194,7 @@ class IRCInterface(Thread, Addon): def response(self, msg, origin=""): if origin == "": - for t in self.getConfig("owner").split(): + for t in self.getConfig('owner').split(): self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg)) else: self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg)) diff --git a/pyload/plugin/addon/JustPremium.py b/pyload/plugin/addon/JustPremium.py index d3c4d8eff..e69bc24f6 100644 --- a/pyload/plugin/addon/JustPremium.py +++ b/pyload/plugin/addon/JustPremium.py @@ -8,18 +8,24 @@ from pyload.plugin.Addon import Addon class JustPremium(Addon): __name__ = "JustPremium" __type__ = "addon" - __version__ = "0.21" + __version__ = "0.22" - __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] + __config__ = [("excluded", "str", "Exclude hosters (comma separated)", ""), + ("included", "str", "Include hosters (comma separated)", "")] - __description__ = """Remove all not premium links from urls added""" + __description__ = """Remove not-premium links from added urls""" __license__ = "GPLv3" - __authors__ = [("mazleu", "mazleica@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("immenz", "immenz@gmx.net")] + __authors__ = [("mazleu" , "mazleica@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("immenz" , "immenz@gmx.net" )] event_list = ["linksAdded"] + interval = 0 #@TODO: Remove in 0.4.10 + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 def linksAdded(self, links, pid): @@ -32,14 +38,18 @@ class JustPremium(Addon): if 'new_name' in hosterdict[hoster] \ and hosterdict[hoster]['new_name'] in premiumplugins) - #: Found at least one hoster with account or multihoster - if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihosters): - return - excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + included = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), + self.getConfig('included').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + + hosterlist = (premiumplugins | multihosters).union(excluded).difference(included) + + #: Found at least one hoster with account or multihoster + if not any( True for pluginname in linkdict if pluginname in hosterlist ): + return - for pluginname in set(linkdict.keys()) - (premiumplugins | multihosters).union(excluded): + for pluginname in set(linkdict.keys()) - hosterlist: self.logInfo(_("Remove links of plugin: %s") % pluginname) for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py index d4cecf05d..374604d82 100644 --- a/pyload/plugin/addon/MergeFiles.py +++ b/pyload/plugin/addon/MergeFiles.py @@ -23,11 +23,13 @@ class MergeFiles(Addon): __authors__ = [("and9000", "me@has-no-mail.com")] + interval = 0 #@TODO: Remove in 0.4.10 + BUFFER_SIZE = 4096 def setup(self): - pass + self.info = {} #@TODO: Remove in 0.4.10 @threaded diff --git a/pyload/plugin/addon/MultiHome.py b/pyload/plugin/addon/MultiHome.py index 521749fc8..0cebf35b8 100644 --- a/pyload/plugin/addon/MultiHome.py +++ b/pyload/plugin/addon/MultiHome.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from time import time +import time from pyload.plugin.Addon import Addon @@ -17,10 +17,16 @@ class MultiHome(Addon): __authors__ = [("mkaay", "mkaay@mkaay.de")] + interval = 0 #@TODO: Remove in 0.4.10 + + def setup(self): - self.register = {} + self.info = {} #@TODO: Remove in 0.4.10 + self.register = {} self.interfaces = [] - self.parseInterfaces(self.getConfig("interfaces").split(";")) + + self.parseInterfaces(self.getConfig('interfaces').split(";")) + if not self.interfaces: self.parseInterfaces([self.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) @@ -74,7 +80,7 @@ class Interface(object): def useFor(self, pluginName, account): - self.history[(pluginName, account)] = time() + self.history[(pluginName, account)] = time.time() def __repr__(self): diff --git a/pyload/plugin/addon/RestartFailed.py b/pyload/plugin/addon/RestartFailed.py index 2fe5f13bf..e34424a8c 100644 --- a/pyload/plugin/addon/RestartFailed.py +++ b/pyload/plugin/addon/RestartFailed.py @@ -6,30 +6,30 @@ from pyload.plugin.Addon import Addon class RestartFailed(Addon): __name__ = "RestartFailed" __type__ = "addon" - __version__ = "1.57" + __version__ = "1.58" __config__ = [("activated", "bool", "Activated" , True), ("interval" , "int" , "Check interval in minutes", 90 )] - __description__ = """Periodically restart all failed downloads in queue""" + __description__ = """Restart all the failed downloads in queue""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] # event_list = ["pluginConfigChanged"] - MIN_INTERVAL = 15 * 60 #: 15m minimum check interval (value is in seconds) + MIN_CHECK_INTERVAL = 15 * 60 #: 15 minutes - def pluginConfigChanged(self, plugin, name, value): - if name == "interval": - interval = value * 60 - if self.MIN_INTERVAL <= interval != self.interval: - self.core.scheduler.removeJob(self.cb) - self.interval = interval - self.initPeriodical() - else: - self.logDebug("Invalid interval value, kept current") + # def pluginConfigChanged(self, plugin, name, value): + # if name == "interval": + # interval = value * 60 + # if self.MIN_CHECK_INTERVAL <= interval != self.interval: + # self.core.scheduler.removeJob(self.cb) + # self.interval = interval + # self.initPeriodical() + # else: + # self.logDebug("Invalid interval value, kept current") def periodical(self): @@ -37,9 +37,6 @@ class RestartFailed(Addon): self.core.api.restartFailed() - def setup(self): - self.interval = 0 - - def activate(self): - self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) + # self.pluginConfigChanged(self.__name__, "interval", self.getConfig('interval')) + self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60) diff --git a/pyload/plugin/addon/RestartSlow.py b/pyload/plugin/addon/RestartSlow.py index 332047da7..cd503518d 100644 --- a/pyload/plugin/addon/RestartSlow.py +++ b/pyload/plugin/addon/RestartSlow.py @@ -21,18 +21,17 @@ class RestartSlow(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_map = {'download-start': "downloadStarts"} + event_list = ["downloadStarts"] + interval = 0 #@TODO: Remove in 0.4.10 def setup(self): self.info = {'chunk': {}} - - def periodical(self): if not self.pyfile.plugin.req.dl: return - if self.getConfig("safe_mode") and not self.pyfile.plugin.resumeDownload: + if self.getConfig('safe_mode') and not self.pyfile.plugin.resumeDownload: time = 30 limit = 5 else: @@ -51,7 +50,7 @@ class RestartSlow(Addon): def downloadStarts(self, pyfile, url, filename): - if self.cb or (self.getConfig("safe_mode") and not pyfile.plugin.resumeDownload): + if self.cb or (self.getConfig('safe_mode') and not pyfile.plugin.resumeDownload): return self.pyfile = pyfile self.initPeriodical() diff --git a/pyload/plugin/addon/SkipRev.py b/pyload/plugin/addon/SkipRev.py index efc96cb7b..157b55bbd 100644 --- a/pyload/plugin/addon/SkipRev.py +++ b/pyload/plugin/addon/SkipRev.py @@ -1,35 +1,46 @@ # -*- coding: utf-8 -*- +import re + from types import MethodType from urllib import unquote from urlparse import urlparse -from pyload.datatype.File import PyFile -from pyload.plugin.Addon import Addon -from pyload.plugin.Plugin import SkipDownload - - -def _setup(self): - self.pyfile.plugin._setup() - if self.pyfile.hasStatus("skipped"): - raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname) +from module.PyFile import PyFile +from module.plugins.Hook import Hook +from module.plugins.Plugin import SkipDownload -class SkipRev(Addon): +class SkipRev(Hook): __name__ = "SkipRev" - __type__ = "addon" - __version__ = "0.25" + __type__ = "hook" + __version__ = "0.29" - __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] + __config__ = [("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"), + ("revtokeep", "int" , "Number of recovery archives to keep for package", 0 )] - __description__ = """Skip files ending with extension rev""" + __description__ = """Skip recovery archives (.rev)""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def _pyname(self, pyfile): - if hasattr(pyfile.pluginmodule, "getInfo"): - return getattr(pyfile.pluginmodule, "getInfo")([pyfile.url]).next()[0] + interval = 0 #@TODO: Remove in 0.4.10 + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + + + @staticmethod + def _setup(self): + self.pyfile.plugin._setup() + if self.pyfile.hasStatus("skipped"): + raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname) + + + def _name(self, pyfile): + if hasattr(pyfile.pluginmodule, "getInfo"): #@NOTE: getInfo is deprecated in 0.4.10 + return pyfile.pluginmodule.getInfo([pyfile.url]).next()[0] else: self.logWarning("Unable to grab file name") return urlparse(unquote(pyfile.url)).path.split('/')[-1] @@ -49,44 +60,52 @@ class SkipRev(Addon): def downloadPreparing(self, pyfile): - if pyfile.statusname is "unskipped" or not self._pyname(pyfile).endswith(".rev"): + name = self._name(pyfile) + + if pyfile.statusname is _("unskipped") or not name.endswith(".rev") or not ".part" in name: return - tokeep = self.getConfig("tokeep") + revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep') - if tokeep: - status_list = (1, 4, 8, 9, 14) if tokeep < 0 else (1, 3, 4, 8, 9, 14) + if revtokeep: + status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14) + pyname = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.')) queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ - if link.name.endswith(".rev") and link.status not in status_list].count(True) + if link.status not in status_list and pyname.match(link.name)].count(True) - if not queued or queued < tokeep: #: keep one rev at least in auto mode + if not queued or queued < revtokeep: #: keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") - pyfile.plugin._setup = pyfile.plugin.setup - pyfile.plugin.setup = MethodType(_setup, pyfile.plugin) #: work-around: inject status checker inside the preprocessing routine of the plugin + + if not hasattr(pyfile.plugin, "_setup"): + # Work-around: inject status checker inside the preprocessing routine of the plugin + pyfile.plugin._setup = pyfile.plugin.setup + pyfile.plugin.setup = MethodType(self._setup, pyfile.plugin) def downloadFailed(self, pyfile): #: Check if pyfile is still "failed", # maybe might has been restarted in meantime - if pyfile.status != 8: + if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): return - tokeep = self.getConfig("tokeep") + revtokeep = -1 if self.getConfig('mode') == "Auto" else self.getConfig('revtokeep') - if not tokeep: + if not revtokeep: return + pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) + for link in self.core.api.getPackageData(pyfile.package().id).links: - if link.status is 4 and link.name.endswith(".rev"): + if link.status is 4 and pyname.match(link.name): pylink = self._pyfile(link) - if tokeep > -1 or pyfile.name.endswith(".rev"): + if revtokeep > -1 or pyfile.name.endswith(".rev"): pylink.setStatus("queued") else: - pylink.setCustomStatus("unskipped", "queued") + pylink.setCustomStatus(_("unskipped"), "queued") self.core.files.save() pylink.release() diff --git a/pyload/plugin/addon/UnSkipOnFail.py b/pyload/plugin/addon/UnSkipOnFail.py index 7d787d1ed..55de85082 100644 --- a/pyload/plugin/addon/UnSkipOnFail.py +++ b/pyload/plugin/addon/UnSkipOnFail.py @@ -11,11 +11,14 @@ class UnSkipOnFail(Addon): __config__ = [("activated", "bool", "Activated", True)] - __description__ = """Queue skipped duplicates when download fails""" + __description__ = """Restart skipped duplicates when download fails""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + interval = 0 #@TODO: Remove in 0.4.10 + + def downloadFailed(self, pyfile): #: Check if pyfile is still "failed", # maybe might has been restarted in meantime @@ -38,7 +41,7 @@ class UnSkipOnFail(Addon): # the core.files-manager to save its data. pylink = _pyfile(link) - pylink.setCustomStatus("UnSkipOnFail", "queued") + pylink.setCustomStatus(_("unskipped"), "queued") self.core.files.save() pylink.release() diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py index 5fdd6011a..643b5c2d1 100644 --- a/pyload/plugin/addon/UpdateManager.py +++ b/pyload/plugin/addon/UpdateManager.py @@ -2,88 +2,91 @@ from __future__ import with_statement +import os import re import sys +import time from operator import itemgetter -from os import path, remove, stat -from pyload.network.RequestFactory import getURL -from pyload.plugin.Addon import Expose, Addon, threaded -from pyload.utils import fs_join +from module.network.RequestFactory import getURL +from module.plugins.Hook import Expose, Hook, threaded +from module.utils import save_join -class UpdateManager(Addon): - __name__ = "UpdateManager" - __type__ = "addon" - __version__ = "0.43" +# Case-sensitive os.path.exists +def exists(path): + if os.path.exists(path): + if os.name == 'nt': + dir, name = os.path.split(path) + return name in os.listdir(dir) + else: + return True + else: + return False - __config__ = [("activated" , "bool" , "Activated" , True ), - ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), - ("interval" , "int" , "Check interval in hours" , 8 ), - ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), - ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), - ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , False )] - __description__ = """Check for updates""" +class UpdateManager(Hook): + __name__ = "UpdateManager" + __type__ = "hook" + __version__ = "0.50" + + __config__ = [("activated" , "bool", "Activated" , True ), + ("checkinterval", "int" , "Check interval in hours" , 8 ), + ("autorestart" , "bool", "Auto-restart pyLoad when required" , True ), + ("checkonstart" , "bool", "Check for updates on startup" , True ), + ("checkperiod" , "bool", "Check for updates periodically" , True ), + ("reloadplugins", "bool", "Monitor plugin code changes in debug mode", True ), + ("nodebugupdate", "bool", "Don't update plugins in debug mode" , False)] + + __description__ = """ Check for updates """ __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - # event_list = ["pluginConfigChanged"] - - SERVER_URL = "http://updatemanager.pyload.org" - VERSION = re.compile(r'__version__.*=.*("|\')([\d.]+)') - MIN_INTERVAL = 3 * 60 * 60 #: 3h minimum check interval (value is in seconds) - - - def pluginConfigChanged(self, plugin, name, value): - if name == "interval": - interval = value * 60 * 60 - if self.MIN_INTERVAL <= interval != self.interval: - self.core.scheduler.removeJob(self.cb) - self.interval = interval - self.initPeriodical() - else: - self.logDebug("Invalid interval value, kept current") - - elif name == "reloadplugins": - if self.cb2: - self.core.scheduler.removeJob(self.cb2) - if value is True and self.core.debug: - self.periodical2() + interval = 0 + SERVER_URL = "http://updatemanager.pyload.org" + MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours - def activate(self): - self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) - x = lambda: self.pluginConfigChanged(self.__name__, "reloadplugins", self.getConfig("reloadplugins")) - self.core.scheduler.addJob(10, x, threaded=False) + def coreReady(self): + if self.checkonstart: + self.update() - def deactivate(self): - self.pluginConfigChanged(self.__name__, "reloadplugins", False) + self.initPeriodical() def setup(self): - self.cb2 = None - self.interval = 0 - self.updating = False - self.info = {'pyload': False, 'version': None, 'plugins': False} + self.interval = 10 + self.info = {'pyload': False, 'version': None, 'plugins': False, 'last_check': time.time()} self.mtimes = {} #: store modification time for each plugin + if self.getConfig('checkonstart'): + self.core.api.pauseServer() + self.checkonstart = True + else: + self.checkonstart = False + - def periodical2(self): - if not self.updating: - self.autoreloadPlugins() + def periodical(self): + if self.core.debug: + if self.getConfig('reloadplugins'): + self.autoreloadPlugins() + + if self.getConfig('nodebugupdate'): + return - self.cb2 = self.core.scheduler.addJob(4, self.periodical2, threaded=False) + if self.getConfig('checkperiod') \ + and time.time() - max(self.MIN_CHECK_INTERVAL, self.getConfig('checkinterval') * 60 * 60) > self.info['last_check']: + self.update() @Expose def autoreloadPlugins(self): """ reload and reindex all modified plugins """ modules = filter( - lambda m: m and (m.__name__.startswith("pyload.plugin.") or + lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith("userplugins.")) and m.__name__.count(".") >= 2, sys.modules.itervalues() ) @@ -95,10 +98,10 @@ class UpdateManager(Addon): id = (type, name) if type in self.core.pluginManager.plugins: f = m.__file__.replace(".pyc", ".py") - if not path.isfile(f): + if not os.path.isfile(f): continue - mtime = stat(f).st_mtime + mtime = os.stat(f).st_mtime if id not in self.mtimes: self.mtimes[id] = mtime @@ -109,109 +112,102 @@ class UpdateManager(Addon): return True if self.core.pluginManager.reloadPlugins(reloads) else False - def periodical(self): - if self.info['pyload'] or self.getConfig("nodebugupdate") and self.core.debug: - return - - self.updateThread() - - - def server_request(self): + def server_response(self): try: return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() + except Exception: self.logWarning(_("Unable to contact server to get updates")) + @Expose @threaded - def updateThread(self): - self.updating = True + def update(self): + """ check for updates """ - status = self.update(onlyplugin=self.getConfig("mode") == "plugins only") + self.core.api.pauseServer() - if status is 2 and self.getConfig("autorestart"): + if self._update() is 2 and self.getConfig('autorestart'): self.core.api.restart() else: - self.updating = False + self.core.api.unpauseServer() - @Expose - def updatePlugins(self): - """ simple wrapper for calling plugin update quickly """ - return self.update(onlyplugin=True) + def _update(self): + data = self.server_response() - - @Expose - def update(self, onlyplugin=False): - """ check for updates """ - data = self.server_request() + self.info['last_check'] = time.time() if not data: exitcode = 0 elif data[0] == "None": self.logInfo(_("No new pyLoad version available")) - updates = data[1:] - exitcode = self._updatePlugins(updates) + exitcode = self._updatePlugins(data[1:]) elif onlyplugin: exitcode = 0 else: - newversion = data[0] - self.logInfo(_("*** New pyLoad Version %s available ***") % newversion) + self.logInfo(_("*** New pyLoad Version %s available ***") % data[0]) self.logInfo(_("*** Get it here: https://github.com/pyload/pyload/releases ***")) + self.info['pyload'] = True + self.info['version'] = data[0] exitcode = 3 - self.info['pyload'] = True - self.info['version'] = newversion - return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required; 3 = No plugins updated, new pyLoad version available + # Exit codes: + # -1 = No plugin updated, new pyLoad version available + # 0 = No plugin updated + # 1 = Plugins updated + # 2 = Plugins updated, but restart required + return exitcode - def _updatePlugins(self, updates): + def _updatePlugins(self, data): """ check for plugin updates """ - if self.info['plugins']: - return False #: plugins were already updated - exitcode = 0 updated = [] - url = updates[0] - schema = updates[1].split('|') + url = data[0] + schema = data[1].split('|') - if "BLACKLIST" in updates: - blacklist = updates[updates.index('BLACKLIST') + 1:] - updates = updates[2:updates.index('BLACKLIST')] + VERSION = re.compile(r'__version__.*=.*("|\')([\d.]+)') + + if "BLACKLIST" in data: + blacklist = data[data.index('BLACKLIST') + 1:] + updatelist = data[2:data.index('BLACKLIST')] else: - blacklist = None - updates = updates[2:] + blacklist = [] + updatelist = data[2:] - upgradable = [dict(zip(schema, x.split('|'))) for x in updates] - blacklisted = [(x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]) for x in blacklist] if blacklist else [] + updatelist = [dict(zip(schema, x.split('|'))) for x in updatelist] + blacklist = [dict(zip(schema, x.split('|'))) for x in blacklist] if blacklist: + type_plugins = [(plugin['type'], plugin['name'].rsplit('.', 1)[0]) for plugin in blacklist] + # Protect UpdateManager from self-removing try: - blacklisted.remove(("addon", "UpdateManager")) - except Exception: + type_plugins.remove(("hook", "UpdateManager")) + except ValueError: pass - for t, n in blacklisted: - for idx, plugin in enumerate(upgradable): + for t, n in type_plugins: + for idx, plugin in enumerate(updatelist): if n == plugin['name'] and t == plugin['type']: - upgradable.pop(idx) + updatelist.pop(idx) break - for t, n in self.removePlugins(sorted(blacklisted)): - self.logInfo(_("Removed blacklisted plugin [%(type)s] %(name)s") % { + for t, n in self.removePlugins(sorted(type_plugins)): + self.logInfo(_("Removed blacklisted plugin: [%(type)s] %(name)s") % { 'type': t, 'name': n, }) - for plugin in sorted(upgradable, key=itemgetter("type", "name")): + for plugin in sorted(updatelist, key=itemgetter("type", "name")): filename = plugin['name'] - type = plugin['type'] + prefix = plugin['type'] version = plugin['version'] if filename.endswith(".pyc"): @@ -219,9 +215,15 @@ class UpdateManager(Addon): else: name = filename.replace(".py", "") + #@TODO: Remove in 0.4.10 + if prefix.endswith("s"): + type = prefix[:-1] + else: + type = prefix + plugins = getattr(self.core.pluginManager, "%sPlugins" % type) - oldver = float(plugins[name]['version']) if name in plugins else None + oldver = float(plugins[name]['v']) if name in plugins else None newver = float(version) if not oldver: @@ -237,10 +239,10 @@ class UpdateManager(Addon): 'newver': newver}) try: content = getURL(url % plugin) - m = self.VERSION.search(content) + m = VERSION.search(content) if m and m.group(2) == version: - with open(fs_join("userplugins", prefix, filename), "wb") as f: + with open(save_join("userplugins", prefix, filename), "wb") as f: f.write(content) updated.append((prefix, name)) @@ -248,21 +250,27 @@ class UpdateManager(Addon): raise Exception, _("Version mismatch") except Exception, e: - self.logError(_("Error updating plugin: %s") % filename, str(e)) + self.logError(_("Error updating plugin: %s") % filename, e) if updated: - reloaded = self.core.pluginManager.reloadPlugins(updated) - if reloaded: - self.logInfo(_("Plugins updated and reloaded")) + self.logInfo(_("*** Plugins updated ***")) + + if self.core.pluginManager.reloadPlugins(updated): exitcode = 1 else: - self.logInfo(_("*** Plugins have been updated, but need a pyLoad restart to be reloaded ***")) + self.logWarning(_("pyLoad restart required to reload the updated plugins")) self.info['plugins'] = True exitcode = 2 + + self.manager.dispatchEvent("plugin_updated", updated) else: self.logInfo(_("No plugin updates available")) - return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required + # Exit codes: + # 0 = No plugin updated + # 1 = Plugins updated + # 2 = Plugins updated, but restart required + return exitcode @Expose @@ -272,35 +280,36 @@ class UpdateManager(Addon): if not type_plugins: return - self.logDebug("Requested deletion of plugins: %s" % type_plugins) + removed = set() - removed = [] + self.logDebug("Requested deletion of plugins: %s" % type_plugins) for type, name in type_plugins: - err = False - file = name + ".py" + rootplugins = os.path.join(pypath, "module", "plugins") - for root in ("userplugins", path.join(pypath, "pyload", "plugins")): + for dir in ("userplugins", rootplugins): + py_filename = save_join(dir, type, name + ".py") + pyc_filename = py_filename + "c" - filename = fs_join(root, type, file) - try: - remove(filename) - except Exception, e: - self.logDebug("Error deleting: %s" % path.basename(filename), e) - err = True - - filename += "c" - if path.isfile(filename): + if type == "hook": try: - if type == "addon": - self.manager.deactivateAddon(name) - remove(filename) + self.manager.deactivateHook(name) + except Exception, e: - self.logDebug("Error deleting: %s" % path.basename(filename), e) - err = True + self.logDebug(e) + + for filename in (py_filename, pyc_filename): + if not exists(filename): + continue + + try: + os.remove(filename) + + except OSError, e: + self.logError(_("Error removing: %s") % filename, e) - if not err: - id = (type, name) - removed.append(id) + else: + id = (type, name) + removed.add(id) - return removed #: return a list of the plugins successfully removed + return list(removed) #: return a list of the plugins successfully removed diff --git a/pyload/plugin/addon/WindowsPhoneNotify.py b/pyload/plugin/addon/WindowsPhoneNotify.py index b9710c2f0..e61057f9f 100644 --- a/pyload/plugin/addon/WindowsPhoneNotify.py +++ b/pyload/plugin/addon/WindowsPhoneNotify.py @@ -1,57 +1,75 @@ # -*- coding: utf-8 -*- import httplib +import time -from time import time +from module.plugins.Hook import Hook, Expose -from pyload.plugin.Addon import Addon - -class WindowsPhoneNotify(Addon): +class WindowsPhoneNotify(Hook): __name__ = "WindowsPhoneNotify" - __type__ = "addon" - __version__ = "0.07" + __type__ = "hook" + __version__ = "0.09" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify processed packages status" , True ), - ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), - ("force" , "bool", "Send notifications if client is connected", False)] + ("notifyprocessed", "bool", "Notify packages processed" , True ), + ("notifyupdate" , "bool", "Notify plugin updates" , True ), + ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), + ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), + ("sendpermin" , "int" , "Max notifications per minute" , 12 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", False)] __description__ = """Send push notifications to Windows Phone""" __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "phone-support@hotmail.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Andy Voigt" , "phone-support@hotmail.de"), + ("Walter Purcaro", "vuolter@gmail.com" )] - event_list = ["allDownloadsProcessed"] + event_list = ["allDownloadsProcessed", "plugin_updated"] + interval = 0 #@TODO: Remove in 0.4.10 def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - self.last_notify = 0 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 + self.notifications = 0 - def newCaptchaTask(self, task): - if not self.getConfig("notifycaptcha"): - return False + def plugin_updated(self, type_plugins): + if not self.getConfig('notifyupdate'): + return + + self.notify(_("Plugins updated"), str(type_plugins)) + - if time() - self.last_notify < self.getConf("timeout"): - return False + def coreExiting(self): + if not self.getConfig('notifyexit'): + return + + if self.core.do_restart: + self.notify(_("Restarting pyLoad")) + else: + self.notify(_("Exiting pyLoad")) + + + def newCaptchaTask(self, task): + if not self.getConfig('notifycaptcha'): + return self.notify(_("Captcha"), _("New request waiting user input")) def packageFinished(self, pypack): - if self.getConfig("notifypackage"): + if self.getConfig('notifypackage'): self.notify(_("Package finished"), pypack.name) def allDownloadsProcessed(self): - if not self.getConfig("notifyprocessed"): - return False + if not self.getConfig('notifyprocessed'): + return if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): self.notify(_("Package failed"), _("One or more packages was not completed successfully")) @@ -65,15 +83,31 @@ class WindowsPhoneNotify(Addon): "</wp:Toast> </wp:Notification>" % msg) - def notify(self, event, msg=""): - id = self.getConfig("id") - url = self.getConfig("url") + @Expose + def notify(self, + event, + msg="", + key=(self.getConfig('id'), self.getConfig('url'))): + + id, url = key if not id or not url: - return False + return + + if self.core.isClientConnected() and not self.getConfig('ignoreclient'): + return + + elapsed_time = time.time() - self.last_notify + + if elapsed_time < self.getConf("sendtimewait"): + return + + if elapsed_time > 60: + self.notifications = 0 + + elif self.notifications >= self.getConf("sendpermin"): + return - if self.core.isClientConnected() and not self.getConfig("force"): - return False request = self.getXmlData("%s: %s" % (event, msg) if msg else event) webservice = httplib.HTTP(url) @@ -88,4 +122,5 @@ class WindowsPhoneNotify(Addon): webservice.send(request) webservice.close() - self.last_notify = time() + self.last_notify = time.time() + self.notifications += 1 diff --git a/pyload/plugin/addon/XMPPInterface.py b/pyload/plugin/addon/XMPPInterface.py index 77a49af6f..c0c31c738 100644 --- a/pyload/plugin/addon/XMPPInterface.py +++ b/pyload/plugin/addon/XMPPInterface.py @@ -33,14 +33,14 @@ class XMPPInterface(IRCInterface, JabberClient): def __init__(self, core, manager): IRCInterface.__init__(self, core, manager) - self.jid = JID(self.getConfig("jid")) - password = self.getConfig("pw") + self.jid = JID(self.getConfig('jid')) + password = self.getConfig('pw') # if bare JID is provided add a resource -- it is required if not self.jid.resource: self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") - if self.getConfig("tls"): + if self.getConfig('tls'): tls_settings = streamtls.TLSSettings(require=True, verify_peer=False) auth = ("sasl:PLAIN", "sasl:DIGEST-MD5") else: @@ -67,7 +67,7 @@ class XMPPInterface(IRCInterface, JabberClient): def packageFinished(self, pypack): try: - if self.getConfig("info_pack"): + if self.getConfig('info_pack'): self.announce(_("Package finished: %s") % pypack.name) except Exception: pass @@ -75,7 +75,7 @@ class XMPPInterface(IRCInterface, JabberClient): def downloadFinished(self, pyfile): try: - if self.getConfig("info_file"): + if self.getConfig('info_file'): self.announce( _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname}) except Exception: @@ -139,7 +139,7 @@ class XMPPInterface(IRCInterface, JabberClient): to_name = to_jid.as_utf8() from_name = from_jid.as_utf8() - names = self.getConfig("owners").split(";") + names = self.getConfig('owners').split(";") if to_name in names or to_jid.node + "@" + to_jid.domain in names: messages = [] @@ -182,7 +182,7 @@ class XMPPInterface(IRCInterface, JabberClient): def announce(self, message): """ send message to all owners""" - for user in self.getConfig("owners").split(";"): + for user in self.getConfig('owners').split(";"): self.logDebug("Send message to", user) to_jid = JID(user) diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py index f39318208..65f96033a 100644 --- a/pyload/plugin/container/CCF.py +++ b/pyload/plugin/container/CCF.py @@ -26,13 +26,13 @@ class CCF(Container): def decrypt(self, pyfile): - file = fs_encode(pyfile.url.strip()) - opener = build_opener(MultipartPostHandler) + fs_filename = fs_encode(pyfile.url.strip()) + opener = build_opener(MultipartPostHandler) dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', {'src' : "ccf", 'filename': "test.ccf", - 'upload' : open(file, "rb")}).read() + 'upload' : open(fs_filename, "rb")}).read() download_folder = self.config['general']['download_folder'] dlc_file = fs_join(download_folder, "tmp_%s.dlc" % pyfile.name) diff --git a/pyload/plugin/container/DLC.py b/pyload/plugin/container/DLC.py index 8b8a0199b..04dabb6b2 100644 --- a/pyload/plugin/container/DLC.py +++ b/pyload/plugin/container/DLC.py @@ -33,8 +33,8 @@ class DLC(Container): def decrypt(self, pyfile): - file = fs_encode(pyfile.url.strip()) - with open(file) as dlc: + fs_filename = fs_encode(pyfile.url.strip()) + with open(fs_filename) as dlc: data = dlc.read().strip() data += '=' * (-len(data) % 4) @@ -49,11 +49,11 @@ class DLC(Container): except AttributeError: self.fail(_("Container is corrupted")) - cipher = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) + key = iv = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) - self.data = AES.new(cipher, AES.MODE_CBC, cipher).decrypt(dlc_data).decode('base64') - self.packages = [(entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name) \ - for entry in self.getPackages()] + self.data = AES.new(key, AES.MODE_CBC, iv).decrypt(dlc_data).decode('base64') + self.packages = [(name or pyfile.name, links, name or pyfile.name) \ + for name, links in self.getPackages()] def getPackages(self): diff --git a/pyload/plugin/container/RSDF.py b/pyload/plugin/container/RSDF.py index c4b743d14..e43eb4c2b 100644 --- a/pyload/plugin/container/RSDF.py +++ b/pyload/plugin/container/RSDF.py @@ -14,7 +14,7 @@ from pyload.utils import fs_encode class RSDF(Container): __name__ = "RSDF" __type__ = "container" - __version__ = "0.27" + __version__ = "0.29" __pattern__ = r'.+\.rsdf$' @@ -31,22 +31,31 @@ class RSDF(Container): def decrypt(self, pyfile): KEY = binascii.unhexlify(self.KEY) - IV = AES.new(Key, AES.MODE_ECB).encrypt(binascii.unhexlify(self.IV)) + IV = binascii.unhexlify(self.IV) - cipher = AES.new(KEY, AES.MODE_CFB, IV) + iv = AES.new(KEY, AES.MODE_ECB).encrypt(IV) + cipher = AES.new(KEY, AES.MODE_CFB, iv) try: - file = fs_encode(pyfile.url.strip()) - with open(file, 'r') as rsdf: + fs_filename = fs_encode(pyfile.url.strip()) + with open(fs_filename, 'r') as rsdf: data = rsdf.read() except IOError, e: self.fail(e) if re.search(r"<title>404 - Not Found</title>", data): - return + pyfile.setStatus("offline") - for link in binascii.unhexlify(''.join(data.split())).splitlines(): - if link: + else: + try: + raw_links = binascii.unhexlify(''.join(data.split())).splitlines() + + except TypeError: + self.fail(_("Container is corrupted")) + + for link in raw_links: + if not link: + continue link = cipher.decrypt(link.decode('base64')).replace('CCF: ', '') self.urls.append(link) diff --git a/pyload/plugin/container/TXT.py b/pyload/plugin/container/TXT.py index 9a3df8bf1..75940f55d 100644 --- a/pyload/plugin/container/TXT.py +++ b/pyload/plugin/container/TXT.py @@ -23,15 +23,15 @@ class TXT(Container): def decrypt(self, pyfile): try: - encoding = codecs.lookup(self.getConfig("encoding")).name + encoding = codecs.lookup(self.getConfig('encoding')).name except Exception: encoding = "utf-8" - file = fs_encode(pyfile.url.strip()) - txt = codecs.open(file, 'r', encoding) - curPack = "Parsed links from %s" % pyfile.name - packages = {curPack:[],} + fs_filename = fs_encode(pyfile.url.strip()) + txt = codecs.open(fs_filename, 'r', encoding) + curPack = "Parsed links from %s" % pyfile.name + packages = {curPack:[],} for link in txt.readlines(): link = link.strip() @@ -57,9 +57,9 @@ class TXT(Container): if not value: packages.pop(key, None) - if self.getConfig("flush"): + if self.getConfig('flush'): try: - txt = open(file, 'wb') + txt = open(fs_filename, 'wb') txt.close() except IOError: diff --git a/pyload/plugin/crypter/BitshareCom.py b/pyload/plugin/crypter/BitshareCom.py index 524307127..8458fac3e 100644 --- a/pyload/plugin/crypter/BitshareCom.py +++ b/pyload/plugin/crypter/BitshareCom.py @@ -9,8 +9,9 @@ class BitshareCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Bitshare.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/ChipDe.py b/pyload/plugin/crypter/ChipDe.py index 2f47236e8..b9f9a6c4d 100644 --- a/pyload/plugin/crypter/ChipDe.py +++ b/pyload/plugin/crypter/ChipDe.py @@ -10,8 +10,8 @@ class ChipDe(Crypter): __version__ = "0.10" __pattern__ = r'http://(?:www\.)?chip\.de/video/.+\.html' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Chip.de decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/CrockoCom.py b/pyload/plugin/crypter/CrockoCom.py index c93f4afab..f1472a004 100644 --- a/pyload/plugin/crypter/CrockoCom.py +++ b/pyload/plugin/crypter/CrockoCom.py @@ -9,8 +9,9 @@ class CrockoCom(SimpleCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?crocko\.com/f/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Crocko.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/CzshareCom.py b/pyload/plugin/crypter/CzshareCom.py index e527d683f..230a038c5 100644 --- a/pyload/plugin/crypter/CzshareCom.py +++ b/pyload/plugin/crypter/CzshareCom.py @@ -10,8 +10,8 @@ class CzshareCom(Crypter): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/folders/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Czshare.com folder decrypter plugin, now Sdilej.cz""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/DDLMusicOrg.py b/pyload/plugin/crypter/DDLMusicOrg.py deleted file mode 100644 index 2b6738799..000000000 --- a/pyload/plugin/crypter/DDLMusicOrg.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import sleep - -from pyload.plugin.Crypter import Crypter - - -class DDLMusicOrg(Crypter): - __name__ = "DDLMusicOrg" - __type__ = "crypter" - __version__ = "0.30" - - __pattern__ = r'http://(?:www\.)?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Ddl-music.org decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - def setup(self): - self.multiDL = False - - - def decrypt(self, pyfile): - html = self.load(pyfile.url, cookies=True) - - if re.search(r"Wer dies nicht rechnen kann", html) is not None: - self.offline() - - math = re.search(r"(\d+) ([+-]) (\d+) =\s+<inp", self.html) - id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1) - linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1) - - solve = "" - if math.group(2) == "+": - solve = int(math.group(1)) + int(math.group(3)) - else: - solve = int(math.group(1)) - int(math.group(3)) - sleep(3) - htmlwithlink = self.load(pyfile.url, cookies=True, - post={"calc%s" % linknr: solve, "send%s" % linknr: "Send", "id": id, - "linknr": linknr}) - m = re.search(r"<form id=\"ff\" action=\"(.*?)\" method=\"post\">", htmlwithlink) - if m: - self.urls = [m.group(1)] - else: - self.retry() diff --git a/pyload/plugin/crypter/DailymotionBatch.py b/pyload/plugin/crypter/DailymotionBatch.py deleted file mode 100644 index f8af4f3d8..000000000 --- a/pyload/plugin/crypter/DailymotionBatch.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urljoin - -from pyload.utils import json_loads -from pyload.plugin.Crypter import Crypter -from pyload.utils import fs_join - - -class DailymotionBatch(Crypter): - __name__ = "DailymotionBatch" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\w^_]+)(?(TYPE)|#)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Dailymotion.com channel & playlist decrypter""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - def api_response(self, ref, req=None): - url = urljoin("https://api.dailymotion.com/", ref) - html = self.load(url, get=req) - return json_loads(html) - - - def getPlaylistInfo(self, id): - ref = "playlist/" + id - req = {"fields": "name,owner.screenname"} - playlist = self.api_response(ref, req) - - if "error" in playlist: - return - - name = playlist['name'] - owner = playlist['owner.screenname'] - return name, owner - - - def _getPlaylists(self, user_id, page=1): - ref = "user/%s/playlists" % user_id - req = {"fields": "id", "page": page, "limit": 100} - user = self.api_response(ref, req) - - if "error" in user: - return - - for playlist in user['list']: - yield playlist['id'] - - if user['has_more']: - for item in self._getPlaylists(user_id, page + 1): - yield item - - - def getPlaylists(self, user_id): - return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] - - - def _getVideos(self, id, page=1): - ref = "playlist/%s/videos" % id - req = {"fields": "url", "page": page, "limit": 100} - playlist = self.api_response(ref, req) - - if "error" in playlist: - return - - for video in playlist['list']: - yield video['url'] - - if playlist['has_more']: - for item in self._getVideos(id, page + 1): - yield item - - - def getVideos(self, playlist_id): - return list(self._getVideos(playlist_id))[::-1] - - - def decrypt(self, pyfile): - m = re.match(self.__pattern__, pyfile.url) - m_id = m.group('ID') - m_type = m.group('TYPE') - - if m_type == "playlist": - self.logDebug("Url recognized as Playlist") - p_info = self.getPlaylistInfo(m_id) - playlists = [(m_id,) + p_info] if p_info else None - else: - self.logDebug("Url recognized as Channel") - playlists = self.getPlaylists(m_id) - self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) - - if not playlists: - self.fail(_("No playlist available")) - - for p_id, p_name, p_owner in playlists: - p_videos = self.getVideos(p_id) - p_folder = fs_join(self.config['general']['download_folder'], p_owner, p_name) - self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) - self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/pyload/plugin/crypter/DataHu.py b/pyload/plugin/crypter/DataHu.py index f69d6ee3e..a2e5d4721 100644 --- a/pyload/plugin/crypter/DataHu.py +++ b/pyload/plugin/crypter/DataHu.py @@ -11,8 +11,9 @@ class DataHu(SimpleCrypter): __version__ = "0.06" __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Data.hu folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/DepositfilesCom.py b/pyload/plugin/crypter/DepositfilesCom.py index 24fa9134a..a66136ab3 100644 --- a/pyload/plugin/crypter/DepositfilesCom.py +++ b/pyload/plugin/crypter/DepositfilesCom.py @@ -9,8 +9,9 @@ class DepositfilesCom(SimpleCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?depositfiles\.com/folders/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Depositfiles.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/Dereferer.py b/pyload/plugin/crypter/Dereferer.py index 138282d02..50e1257cc 100644 --- a/pyload/plugin/crypter/Dereferer.py +++ b/pyload/plugin/crypter/Dereferer.py @@ -9,8 +9,8 @@ class Dereferer(SimpleDereferer): __version__ = "0.11" __pattern__ = r'https?://([^/]+)/.*?(?P<LINK>(ht|f)tps?(://|%3A%2F%2F).+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Crypter for dereferers""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/DevhostSt.py b/pyload/plugin/crypter/DevhostSt.py index 4d1a2ae09..f06c8da30 100644 --- a/pyload/plugin/crypter/DevhostSt.py +++ b/pyload/plugin/crypter/DevhostSt.py @@ -13,11 +13,12 @@ from pyload.plugin.internal.SimpleCrypter import SimpleCrypter class DevhostSt(SimpleCrypter): __name__ = "DevhostSt" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """d-h.st folder decrypter plugin""" __license__ = "GPLv3" @@ -25,17 +26,18 @@ class DevhostSt(SimpleCrypter): ("Walter Purcaro", "vuolter@gmail.com")] - LINK_PATTERN = r'(?:/> |;">)<a href="(.+?)"(?!>Back to \w+<)' + LINK_PATTERN = r'(?:/> |;">)<a href="(.+?)"(?!>Back to \w+<)' OFFLINE_PATTERN = r'"/cHP">test\.png<' - def getFileInfo(self): - if re.search(self.OFFLINE_PATTERN, self.html): - self.offline() + def checkNameSize(self, getinfo=True): + if not self.info or getinfo: + self.logDebug("File info (BEFORE): %s" % self.info) + self.info.update(self.getInfo(self.pyfile.url, self.html)) + self.logDebug("File info (AFTER): %s" % self.info) try: - id = re.match(self.__pattern__, self.pyfile.url).group('ID') - if id == "0": + if self.info['pattern']['ID'] == "0": raise p = r'href="(.+?)">Back to \w+<' @@ -43,12 +45,18 @@ class DevhostSt(SimpleCrypter): html = self.load(urljoin("http://d-h.st", m.group(1)), cookies=False) - p = '\?fld_id=%s.*?">(.+?)<' % id + p = '\?fld_id=%s.*?">(.+?)<' % self.info['pattern']['ID'] m = re.search(p, html) - name = folder = m.group(1) + self.pyfile.name = m.group(1) except Exception, e: self.logDebug(e) - name = folder = re.match(self.__pattern__, self.pyfile.url).group('USER') + self.pyfile.name = self.info['pattern']['USER'] - return {'name': name, 'folder': folder} + try: + folder = self.info['folder'] = self.pyfile.name + + except Exception: + pass + self.logDebug("File name: %s" % self.pyfile.name, + "File folder: %s" % self.pyfile.name)
\ No newline at end of file diff --git a/pyload/plugin/crypter/DlProtectCom.py b/pyload/plugin/crypter/DlProtectCom.py index a5e104f70..081db7067 100644 --- a/pyload/plugin/crypter/DlProtectCom.py +++ b/pyload/plugin/crypter/DlProtectCom.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import re +import time from base64 import urlsafe_b64encode -from time import time from pyload.plugin.internal.SimpleCrypter import SimpleCrypter @@ -14,8 +14,9 @@ class DlProtectCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?dl-protect\.com/((en|fr)/)?\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Dl-protect.com decrypter plugin""" __license__ = "GPLv3" @@ -40,7 +41,7 @@ class DlProtectCom(SimpleCrypter): self.wait(2) else: - mstime = int(round(time() * 1000)) + mstime = int(round(time.time() * 1000)) b64time = "_" + urlsafe_b64encode(str(mstime)).replace("=", "%3D") post_req.update({'i' : b64time, diff --git a/pyload/plugin/crypter/DontKnowMe.py b/pyload/plugin/crypter/DontKnowMe.py index 1e83ab853..b0684ae8a 100644 --- a/pyload/plugin/crypter/DontKnowMe.py +++ b/pyload/plugin/crypter/DontKnowMe.py @@ -9,8 +9,8 @@ class DontKnowMe(SimpleDereferer): __version__ = "0.11" __pattern__ = r'http://(?:www\.)?dontknow\.me/at/\?(?P<LINK>.+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """DontKnow.me decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/DuckCryptInfo.py b/pyload/plugin/crypter/DuckCryptInfo.py index 55681fd5e..04a7d3ea2 100644 --- a/pyload/plugin/crypter/DuckCryptInfo.py +++ b/pyload/plugin/crypter/DuckCryptInfo.py @@ -13,8 +13,8 @@ class DuckCryptInfo(Crypter): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """DuckCrypt.info decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/EasybytezCom.py b/pyload/plugin/crypter/EasybytezCom.py index c5c7b0193..74fd5ad6a 100644 --- a/pyload/plugin/crypter/EasybytezCom.py +++ b/pyload/plugin/crypter/EasybytezCom.py @@ -9,8 +9,8 @@ class EasybytezCom(XFSCrypter): __version__ = "0.10" __pattern__ = r'http://(?:www\.)?easybytez\.com/users/\d+/\d+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Easybytez.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/EmbeduploadCom.py b/pyload/plugin/crypter/EmbeduploadCom.py index c94e7e106..06d71e21b 100644 --- a/pyload/plugin/crypter/EmbeduploadCom.py +++ b/pyload/plugin/crypter/EmbeduploadCom.py @@ -11,10 +11,10 @@ class EmbeduploadCom(Crypter): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("preferedHoster", "str", "Prefered hoster list (bar-separated)", "embedupload"), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True ), + ("subfolder_per_pack", "bool", "Create a subfolder for each package" , True ), + ("preferedHoster" , "str" , "Prefered hoster list (bar-separated)", "embedupload"), + ("ignoredHoster" , "str" , "Ignored hoster list (bar-separated)" , "" )] __description__ = """EmbedUpload.com decrypter plugin""" __license__ = "GPLv3" @@ -30,7 +30,7 @@ class EmbeduploadCom(Crypter): m = re.findall(self.LINK_PATTERN, self.html) if m: - prefered_set = set(self.getConfig("preferedHoster").split('|')) + prefered_set = set(self.getConfig('preferedHoster').split('|')) prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) self.logDebug("PF: %s" % prefered_set) @@ -39,7 +39,7 @@ class EmbeduploadCom(Crypter): self.urls = self.getLocation(tmp_links) if not self.urls: - ignored_set = set(self.getConfig("ignoredHoster").split('|')) + ignored_set = set(self.getConfig('ignoredHoster').split('|')) ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) self.logDebug("IG: %s" % ignored_set) diff --git a/pyload/plugin/crypter/FilecloudIo.py b/pyload/plugin/crypter/FilecloudIo.py index f4c967a07..1518fe813 100644 --- a/pyload/plugin/crypter/FilecloudIo.py +++ b/pyload/plugin/crypter/FilecloudIo.py @@ -9,8 +9,9 @@ class FilecloudIo(SimpleCrypter): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Filecloud.io folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FilecryptCc.py b/pyload/plugin/crypter/FilecryptCc.py index 816a2d365..c052573e1 100644 --- a/pyload/plugin/crypter/FilecryptCc.py +++ b/pyload/plugin/crypter/FilecryptCc.py @@ -41,7 +41,7 @@ class FilecryptCc(Crypter): def decrypt(self, pyfile): - self.html = self.load(pyfile.url, cookies=True) + self.html = self.load(pyfile.url) if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo self.offline() @@ -66,7 +66,7 @@ class FilecryptCc(Crypter): self.logInfo(_("Found %d mirrors") % len(mirror)) for i in mirror[1:]: - self.siteWithLinks = self.siteWithLinks + self.load(i, cookies=True).decode("utf-8", "replace") + self.siteWithLinks = self.siteWithLinks + self.load(i).decode("utf-8", "replace") def handlePasswordProtection(self): @@ -80,7 +80,7 @@ class FilecryptCc(Crypter): if not password: self.fail(_("Please enter the password in package section and try again")) - self.html = self.load(self.pyfile.url, post={"password": password}, cookies=True) + self.html = self.load(self.pyfile.url, post={"password": password}) def handleCaptcha(self): @@ -96,7 +96,6 @@ class FilecryptCc(Crypter): self.siteWithLinks = self.load(self.pyfile.url, post={'recaptcha_response_field': captcha_code}, - cookies=True, decode=True) elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) @@ -108,7 +107,6 @@ class FilecryptCc(Crypter): self.siteWithLinks = self.load(self.pyfile.url, post={'button.x': captcha_code[0], 'button.y': captcha_code[1]}, - cookies=True, decode=True) else: @@ -144,9 +142,9 @@ class FilecryptCc(Crypter): weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) for link in weblinks: - res = self.load("http://filecrypt.cc/Link/%s.html" % link, cookies=True) + res = self.load("http://filecrypt.cc/Link/%s.html" % link) link2 = re.search('<iframe noresize src="(.*)"></iframe>', res) - res2 = self.load(link2.group(1), just_header=True, cookies=True) + res2 = self.load(link2.group(1), just_header=True) self.links.append(res2['location']) except Exception, e: diff --git a/pyload/plugin/crypter/FilefactoryCom.py b/pyload/plugin/crypter/FilefactoryCom.py index 40f4c1475..05d631ffe 100644 --- a/pyload/plugin/crypter/FilefactoryCom.py +++ b/pyload/plugin/crypter/FilefactoryCom.py @@ -9,8 +9,9 @@ class FilefactoryCom(SimpleCrypter): __version__ = "0.32" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Filefactory.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FilerNet.py b/pyload/plugin/crypter/FilerNet.py index 45d0dd2ab..ea6eb9e49 100644 --- a/pyload/plugin/crypter/FilerNet.py +++ b/pyload/plugin/crypter/FilerNet.py @@ -9,8 +9,9 @@ class FilerNet(SimpleCrypter): __version__ = "0.42" __pattern__ = r'https?://filer\.net/folder/\w{16}' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Filer.net decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FileserveCom.py b/pyload/plugin/crypter/FileserveCom.py index ab0665fbd..f68f8e98c 100644 --- a/pyload/plugin/crypter/FileserveCom.py +++ b/pyload/plugin/crypter/FileserveCom.py @@ -11,8 +11,8 @@ class FileserveCom(Crypter): __version__ = "0.11" __pattern__ = r'http://(?:www\.)?fileserve\.com/list/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """FileServe.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FilesonicCom.py b/pyload/plugin/crypter/FilesonicCom.py index 1ffaa9c01..60a6bc8be 100644 --- a/pyload/plugin/crypter/FilesonicCom.py +++ b/pyload/plugin/crypter/FilesonicCom.py @@ -9,6 +9,7 @@ class FilesonicCom(DeadCrypter): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?filesonic\.com/folder/\w+' + __config__ = [] __description__ = """Filesonic.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FilestubeCom.py b/pyload/plugin/crypter/FilestubeCom.py index 36e4a4caf..7774d248e 100644 --- a/pyload/plugin/crypter/FilestubeCom.py +++ b/pyload/plugin/crypter/FilestubeCom.py @@ -9,8 +9,9 @@ class FilestubeCom(SimpleCrypter): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?filestube\.(?:com|to)/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Filestube.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FiletramCom.py b/pyload/plugin/crypter/FiletramCom.py index 700050a4b..47c8a7f54 100644 --- a/pyload/plugin/crypter/FiletramCom.py +++ b/pyload/plugin/crypter/FiletramCom.py @@ -9,8 +9,9 @@ class FiletramCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filetram\.com/[^/]+/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Filetram.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FourChanOrg.py b/pyload/plugin/crypter/FourChanOrg.py index 62fb9d3fe..68d1e4a31 100644 --- a/pyload/plugin/crypter/FourChanOrg.py +++ b/pyload/plugin/crypter/FourChanOrg.py @@ -13,8 +13,8 @@ class FourChanOrg(Crypter): __version__ = "0.31" __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """4chan.org folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FreakhareCom.py b/pyload/plugin/crypter/FreakhareCom.py index cb766361c..700c85f07 100644 --- a/pyload/plugin/crypter/FreakhareCom.py +++ b/pyload/plugin/crypter/FreakhareCom.py @@ -11,8 +11,9 @@ class FreakhareCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?freakshare\.com/folder/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Freakhare.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FreetexthostCom.py b/pyload/plugin/crypter/FreetexthostCom.py index 3b082ef7d..b6f8998b9 100644 --- a/pyload/plugin/crypter/FreetexthostCom.py +++ b/pyload/plugin/crypter/FreetexthostCom.py @@ -11,8 +11,9 @@ class FreetexthostCom(SimpleCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?freetexthost\.com/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Freetexthost.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/FshareVn.py b/pyload/plugin/crypter/FshareVn.py index 700f87ba4..31523d78f 100644 --- a/pyload/plugin/crypter/FshareVn.py +++ b/pyload/plugin/crypter/FshareVn.py @@ -9,8 +9,9 @@ class FshareVn(SimpleCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?fshare\.vn/folder/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Fshare.vn folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/Go4UpCom.py b/pyload/plugin/crypter/Go4UpCom.py index 5bae6e93a..0aa252ae3 100644 --- a/pyload/plugin/crypter/Go4UpCom.py +++ b/pyload/plugin/crypter/Go4UpCom.py @@ -13,6 +13,9 @@ class Go4UpCom(SimpleCrypter): __version__ = "0.11" __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)] __description__ = """Go4Up.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/GooGl.py b/pyload/plugin/crypter/GooGl.py index 13ffce505..ed01f047f 100644 --- a/pyload/plugin/crypter/GooGl.py +++ b/pyload/plugin/crypter/GooGl.py @@ -10,8 +10,8 @@ class GooGl(Crypter): __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?goo\.gl/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Goo.gl decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/HoerbuchIn.py b/pyload/plugin/crypter/HoerbuchIn.py index a12d7c02a..6f5aa842f 100644 --- a/pyload/plugin/crypter/HoerbuchIn.py +++ b/pyload/plugin/crypter/HoerbuchIn.py @@ -13,8 +13,8 @@ class HoerbuchIn(Crypter): __version__ = "0.60" __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Hoerbuch.in decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/ImgurComAlbum.py b/pyload/plugin/crypter/ImgurComAlbum.py index d2ca38d40..89606716b 100644 --- a/pyload/plugin/crypter/ImgurComAlbum.py +++ b/pyload/plugin/crypter/ImgurComAlbum.py @@ -10,8 +10,9 @@ class ImgurComAlbum(SimpleCrypter): __version__ = "0.51" __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Imgur.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/LetitbitNet.py b/pyload/plugin/crypter/LetitbitNet.py index 24bc196b3..5d19cca8e 100644 --- a/pyload/plugin/crypter/LetitbitNet.py +++ b/pyload/plugin/crypter/LetitbitNet.py @@ -10,8 +10,8 @@ class LetitbitNet(Crypter): __version__ = "0.10" __pattern__ = r'http://(?:www\.)?letitbit\.net/folder/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Letitbit.net folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/LinkSaveIn.py b/pyload/plugin/crypter/LinkSaveIn.py index b303303a0..752eee390 100644 --- a/pyload/plugin/crypter/LinkSaveIn.py +++ b/pyload/plugin/crypter/LinkSaveIn.py @@ -9,8 +9,8 @@ class LinkSaveIn(SimpleDereferer): __version__ = "2.03" __pattern__ = r'https?://(?:www\.)?linksave\.in/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """LinkSave.in decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/LinkdecrypterCom.py b/pyload/plugin/crypter/LinkdecrypterCom.py index facec37d5..09863989f 100644 --- a/pyload/plugin/crypter/LinkdecrypterCom.py +++ b/pyload/plugin/crypter/LinkdecrypterCom.py @@ -10,8 +10,8 @@ class LinkdecrypterCom(Crypter): __version__ = "0.29" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Linkdecrypter.com decrypter plugin""" __license__ = "GPLv3" @@ -34,10 +34,10 @@ class LinkdecrypterCom(Crypter): retries = 5 post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} - self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) + self.html = self.load('http://linkdecrypter.com/', post=post_dict, decode=True) while retries: - m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S) + m = re.search(self.TEXTAREA_PATTERN, self.html, re.S) if m: self.urls = [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] @@ -65,4 +65,4 @@ class LinkdecrypterCom(Crypter): else: retries -= 1 - self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True) + self.html = self.load('http://linkdecrypter.com/', decode=True) diff --git a/pyload/plugin/crypter/LixIn.py b/pyload/plugin/crypter/LixIn.py index 4b978723f..95d7c34c5 100644 --- a/pyload/plugin/crypter/LixIn.py +++ b/pyload/plugin/crypter/LixIn.py @@ -11,8 +11,8 @@ class LixIn(Crypter): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?lix\.in/(?P<ID>.+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Lix.in decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MediafireCom.py b/pyload/plugin/crypter/MediafireCom.py index a7360a6db..f9f7a43bd 100644 --- a/pyload/plugin/crypter/MediafireCom.py +++ b/pyload/plugin/crypter/MediafireCom.py @@ -12,8 +12,8 @@ class MediafireCom(Crypter): __version__ = "0.14" __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Mediafire.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MegaCoNz.py b/pyload/plugin/crypter/MegaCoNz.py index 3f1d10a5a..10c1031de 100644 --- a/pyload/plugin/crypter/MegaCoNz.py +++ b/pyload/plugin/crypter/MegaCoNz.py @@ -11,8 +11,8 @@ class MegaCoNz(Crypter): __version__ = "0.04" __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Mega.co.nz folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MegaRapidCz.py b/pyload/plugin/crypter/MegaRapidCz.py index 79900c08a..5a14b6f85 100644 --- a/pyload/plugin/crypter/MegaRapidCz.py +++ b/pyload/plugin/crypter/MegaRapidCz.py @@ -9,8 +9,9 @@ class MegaRapidCz(SimpleCrypter): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/slozka/\d+/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Share-Rapid.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MegauploadCom.py b/pyload/plugin/crypter/MegauploadCom.py index 72e0268dd..b9c675a7e 100644 --- a/pyload/plugin/crypter/MegauploadCom.py +++ b/pyload/plugin/crypter/MegauploadCom.py @@ -9,6 +9,7 @@ class MegauploadCom(DeadCrypter): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?megaupload\.com/(\?f|xml/folderfiles\.php\?.*&?folderid)=\w+' + __config__ = [] __description__ = """Megaupload.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MultiUpOrg.py b/pyload/plugin/crypter/MultiUpOrg.py index 1585ac1c8..eabc5d219 100644 --- a/pyload/plugin/crypter/MultiUpOrg.py +++ b/pyload/plugin/crypter/MultiUpOrg.py @@ -12,8 +12,9 @@ class MultiUpOrg(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """MultiUp.org decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/MultiloadCz.py b/pyload/plugin/crypter/MultiloadCz.py index 856a94a25..0bcf94016 100644 --- a/pyload/plugin/crypter/MultiloadCz.py +++ b/pyload/plugin/crypter/MultiloadCz.py @@ -10,10 +10,10 @@ class MultiloadCz(Crypter): __version__ = "0.40" __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("usedHoster", "str", "Prefered hoster list (bar-separated)", ""), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package" , True), + ("usedHoster" , "str" , "Prefered hoster list (bar-separated)", "" ), + ("ignoredHoster" , "str" , "Ignored hoster list (bar-separated)" , "" )] __description__ = """Multiload.cz decrypter plugin""" __license__ = "GPLv3" @@ -34,9 +34,9 @@ class MultiloadCz(Crypter): else: m = re.findall(self.LINK_PATTERN, self.html) if m: - prefered_set = set(self.getConfig("usedHoster").split('|')) + prefered_set = set(self.getConfig('usedHoster').split('|')) self.urls.extend(x[1] for x in m if x[0] in prefered_set) if not self.urls: - ignored_set = set(self.getConfig("ignoredHoster").split('|')) + ignored_set = set(self.getConfig('ignoredHoster').split('|')) self.urls.extend(x[1] for x in m if x[0] not in ignored_set) diff --git a/pyload/plugin/crypter/NCryptIn.py b/pyload/plugin/crypter/NCryptIn.py index 29b45b11a..a7ac286cd 100644 --- a/pyload/plugin/crypter/NCryptIn.py +++ b/pyload/plugin/crypter/NCryptIn.py @@ -15,8 +15,8 @@ class NCryptIn(Crypter): __version__ = "1.34" __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<TYPE>folder|link|frame)-([^/\?]+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """NCrypt.in decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/NetfolderIn.py b/pyload/plugin/crypter/NetfolderIn.py index a24a5270f..9672ff581 100644 --- a/pyload/plugin/crypter/NetfolderIn.py +++ b/pyload/plugin/crypter/NetfolderIn.py @@ -11,8 +11,9 @@ class NetfolderIn(SimpleCrypter): __version__ = "0.72" __pattern__ = r'http://(?:www\.)?netfolder\.in/(folder\.php\?folder_id=)?(?P<ID>\w+)(?(1)|/\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """NetFolder.in decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/NosvideoCom.py b/pyload/plugin/crypter/NosvideoCom.py index d048ec956..f2d7bfe04 100644 --- a/pyload/plugin/crypter/NosvideoCom.py +++ b/pyload/plugin/crypter/NosvideoCom.py @@ -9,8 +9,9 @@ class NosvideoCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?nosvideo\.com/\?v=\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Nosvideo.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/OneKhDe.py b/pyload/plugin/crypter/OneKhDe.py index 323214df8..6f5400f03 100644 --- a/pyload/plugin/crypter/OneKhDe.py +++ b/pyload/plugin/crypter/OneKhDe.py @@ -13,8 +13,8 @@ class OneKhDe(Crypter): __version__ = "0.11" __pattern__ = r'http://(?:www\.)?1kh\.de/f/' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """1kh.de decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/PastebinCom.py b/pyload/plugin/crypter/PastebinCom.py index 43a818cf1..d0e34abaf 100644 --- a/pyload/plugin/crypter/PastebinCom.py +++ b/pyload/plugin/crypter/PastebinCom.py @@ -9,8 +9,9 @@ class PastebinCom(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?pastebin\.com/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Pastebin.com decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/QuickshareCz.py b/pyload/plugin/crypter/QuickshareCz.py index 8cd4b9c02..8635c797d 100644 --- a/pyload/plugin/crypter/QuickshareCz.py +++ b/pyload/plugin/crypter/QuickshareCz.py @@ -10,8 +10,8 @@ class QuickshareCz(Crypter): __version__ = "0.10" __pattern__ = r'http://(?:www\.)?quickshare\.cz/slozka-\d+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Quickshare.cz folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/RelinkUs.py b/pyload/plugin/crypter/RelinkUs.py index 0feace907..448854325 100644 --- a/pyload/plugin/crypter/RelinkUs.py +++ b/pyload/plugin/crypter/RelinkUs.py @@ -17,8 +17,8 @@ class RelinkUs(Crypter): __version__ = "3.12" __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<ID>.+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Relink.us decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/SafelinkingNet.py b/pyload/plugin/crypter/SafelinkingNet.py index 2d5d273ed..dffce9ade 100644 --- a/pyload/plugin/crypter/SafelinkingNet.py +++ b/pyload/plugin/crypter/SafelinkingNet.py @@ -15,8 +15,8 @@ class SafelinkingNet(Crypter): __version__ = "0.14" __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Safelinking.net decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/SexuriaCom.py b/pyload/plugin/crypter/SexuriaCom.py index 10101cd7a..39c3a8515 100644 --- a/pyload/plugin/crypter/SexuriaCom.py +++ b/pyload/plugin/crypter/SexuriaCom.py @@ -11,21 +11,21 @@ class SexuriaCom(Crypter): __version__ = "0.01" __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_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Sexuria.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")] - PATTERN_SUPPORTED_MAIN = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html', flags=re.I) - PATTERN_SUPPORTED_CRYPT = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html', flags=re.I) - PATTERN_SUPPORTED_REDIRECT = re.compile(r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+', flags=re.I) - PATTERN_TITLE = re.compile(r'<title> - (?P<TITLE>.*) Sexuria - Kostenlose Pornos - Rapidshare XXX Porn</title>', flags=re.I) - PATTERN_PASSWORD = re.compile(r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>', flags=re.I | re.S) - PATTERN_DL_LINK_PAGE = re.compile(r'"(dl_links_\d+_\d+\.html)"', flags=re.I) - PATTERN_REDIRECT_LINKS = re.compile(r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly', flags=re.I) + PATTERN_SUPPORTED_MAIN = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html', re.I) + PATTERN_SUPPORTED_CRYPT = re.compile(r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html', re.I) + PATTERN_SUPPORTED_REDIRECT = re.compile(r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+', re.I) + PATTERN_TITLE = re.compile(r'<title> - (?P<TITLE>.*) Sexuria - Kostenlose Pornos - Rapidshare XXX Porn</title>', re.I) + PATTERN_PASSWORD = re.compile(r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>', re.I | re.S) + PATTERN_DL_LINK_PAGE = re.compile(r'"(dl_links_\d+_\d+\.html)"', re.I) + PATTERN_REDIRECT_LINKS = re.compile(r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly', re.I) def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/ShareLinksBiz.py b/pyload/plugin/crypter/ShareLinksBiz.py index 1328e86aa..5cc796475 100644 --- a/pyload/plugin/crypter/ShareLinksBiz.py +++ b/pyload/plugin/crypter/ShareLinksBiz.py @@ -13,8 +13,8 @@ class ShareLinksBiz(Crypter): __version__ = "1.14" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Share-Links.biz decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/SharingmatrixCom.py b/pyload/plugin/crypter/SharingmatrixCom.py index 7db09b246..bd0a7a85a 100644 --- a/pyload/plugin/crypter/SharingmatrixCom.py +++ b/pyload/plugin/crypter/SharingmatrixCom.py @@ -9,6 +9,7 @@ class SharingmatrixCom(DeadCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/folder/\w+' + __config__ = [] __description__ = """Sharingmatrix.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/TnyCz.py b/pyload/plugin/crypter/TnyCz.py index d73f6de63..f04127479 100644 --- a/pyload/plugin/crypter/TnyCz.py +++ b/pyload/plugin/crypter/TnyCz.py @@ -11,8 +11,9 @@ class TnyCz(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?tny\.cz/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Tny.cz decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/TurbobitNet.py b/pyload/plugin/crypter/TurbobitNet.py index d6b6d7b38..8493af9da 100644 --- a/pyload/plugin/crypter/TurbobitNet.py +++ b/pyload/plugin/crypter/TurbobitNet.py @@ -12,8 +12,9 @@ class TurbobitNet(SimpleCrypter): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?turbobit\.net/download/folder/(?P<ID>\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Turbobit.net folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/TusfilesNet.py b/pyload/plugin/crypter/TusfilesNet.py index 39d5dee9d..a04723c47 100644 --- a/pyload/plugin/crypter/TusfilesNet.py +++ b/pyload/plugin/crypter/TusfilesNet.py @@ -13,8 +13,8 @@ class TusfilesNet(XFSCrypter): __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Tusfiles.net folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/UlozTo.py b/pyload/plugin/crypter/UlozTo.py index 81fbee172..5909958bd 100644 --- a/pyload/plugin/crypter/UlozTo.py +++ b/pyload/plugin/crypter/UlozTo.py @@ -10,8 +10,8 @@ class UlozTo(Crypter): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(m|soubory)/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Uloz.to folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/UploadableCh.py b/pyload/plugin/crypter/UploadableCh.py index f5fb0c3bc..1f1a5cf8b 100644 --- a/pyload/plugin/crypter/UploadableCh.py +++ b/pyload/plugin/crypter/UploadableCh.py @@ -9,8 +9,9 @@ class UploadableCh(SimpleCrypter): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?uploadable\.ch/list/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """Uploadable.ch folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/UploadedTo.py b/pyload/plugin/crypter/UploadedTo.py index 282f82be7..9286fb7a5 100644 --- a/pyload/plugin/crypter/UploadedTo.py +++ b/pyload/plugin/crypter/UploadedTo.py @@ -13,8 +13,9 @@ class UploadedTo(SimpleCrypter): __version__ = "0.42" __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<ID>\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __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)] __description__ = """UploadedTo decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/WuploadCom.py b/pyload/plugin/crypter/WuploadCom.py index fb00cb136..ed8d21565 100644 --- a/pyload/plugin/crypter/WuploadCom.py +++ b/pyload/plugin/crypter/WuploadCom.py @@ -9,6 +9,7 @@ class WuploadCom(DeadCrypter): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?wupload\.com/folder/\w+' + __config__ = [] __description__ = """Wupload.com folder decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/XFileSharingPro.py b/pyload/plugin/crypter/XFileSharingPro.py index 3dc2e8f70..1ae40c6c5 100644 --- a/pyload/plugin/crypter/XFileSharingPro.py +++ b/pyload/plugin/crypter/XFileSharingPro.py @@ -8,11 +8,11 @@ from pyload.plugin.internal.XFSCrypter import XFSCrypter class XFileSharingPro(XFSCrypter): __name__ = "XFileSharingPro" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """XFileSharingPro dummy folder decrypter plugin for hook""" __license__ = "GPLv3" @@ -33,9 +33,6 @@ class XFileSharingPro(XFSCrypter): self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') - if self.HOSTER_NAME[0].isdigit(): - self.HOSTER_NAME = 'X' + self.HOSTER_NAME - account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): diff --git a/pyload/plugin/crypter/XupPl.py b/pyload/plugin/crypter/XupPl.py index 9d4d27b61..b62e37db6 100644 --- a/pyload/plugin/crypter/XupPl.py +++ b/pyload/plugin/crypter/XupPl.py @@ -9,8 +9,8 @@ class XupPl(Crypter): __version__ = "0.10" __pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Xup.pl decrypter plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/crypter/YoutubeBatch.py b/pyload/plugin/crypter/YoutubeBatch.py deleted file mode 100644 index e090fa1f0..000000000 --- a/pyload/plugin/crypter/YoutubeBatch.py +++ /dev/null @@ -1,148 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urljoin - -from pyload.utils import json_loads -from pyload.plugin.Crypter import Crypter -from pyload.utils import fs_join - - -class YoutubeBatch(Crypter): - __name__ = "YoutubeBatch" - __type__ = "crypter" - __version__ = "1.01" - - __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("likes", "bool", "Grab user (channel) liked videos", False), - ("favorites", "bool", "Grab user (channel) favorite videos", False), - ("uploads", "bool", "Grab channel unplaylisted videos", True)] - - __description__ = """Youtube.com channel & playlist decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - API_KEY = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0" - - - def api_response(self, ref, req): - req.update({"key": self.API_KEY}) - url = urljoin("https://www.googleapis.com/youtube/v3/", ref) - html = self.load(url, get=req) - return json_loads(html) - - - def getChannel(self, user): - channels = self.api_response("channels", {"part": "id,snippet,contentDetails", "forUsername": user, "maxResults": "50"}) - if channels['items']: - channel = channels['items'][0] - return {"id": channel['id'], - "title": channel['snippet']['title'], - "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], - "user": user} # One lone channel for user? - - - def getPlaylist(self, p_id): - playlists = self.api_response("playlists", {"part": "snippet", "id": p_id}) - if playlists['items']: - playlist = playlists['items'][0] - return {"id": p_id, - "title": playlist['snippet']['title'], - "channelId": playlist['snippet']['channelId'], - "channelTitle": playlist['snippet']['channelTitle']} - - - def _getPlaylists(self, id, token=None): - req = {"part": "id", "maxResults": "50", "channelId": id} - if token: - req.update({"pageToken": token}) - - playlists = self.api_response("playlists", req) - - for playlist in playlists['items']: - yield playlist['id'] - - if "nextPageToken" in playlists: - for item in self._getPlaylists(id, playlists['nextPageToken']): - yield item - - - def getPlaylists(self, ch_id): - return map(self.getPlaylist, self._getPlaylists(ch_id)) - - - def _getVideosId(self, id, token=None): - req = {"part": "contentDetails", "maxResults": "50", "playlistId": id} - if token: - req.update({"pageToken": token}) - - playlist = self.api_response("playlistItems", req) - - for item in playlist['items']: - yield item['contentDetails']['videoId'] - - if "nextPageToken" in playlist: - for item in self._getVideosId(id, playlist['nextPageToken']): - yield item - - - def getVideosId(self, p_id): - return list(self._getVideosId(p_id)) - - - def decrypt(self, pyfile): - m = re.match(self.__pattern__, pyfile.url) - m_id = m.group('ID') - m_type = m.group('TYPE') - - if m_type == "user": - self.logDebug("Url recognized as Channel") - user = m_id - channel = self.getChannel(user) - - if channel: - playlists = self.getPlaylists(channel['id']) - self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title'])) - - relatedplaylist = {p_name: self.getPlaylist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()} - self.logDebug("Channel's related playlists found = %s" % relatedplaylist.keys()) - - relatedplaylist['uploads']['title'] = "Unplaylisted videos" - relatedplaylist['uploads']['checkDups'] = True #: checkDups flag - - for p_name, p_data in relatedplaylist.iteritems(): - if self.getConfig(p_name): - p_data['title'] += " of " + user - playlists.append(p_data) - else: - playlists = [] - else: - self.logDebug("Url recognized as Playlist") - playlists = [self.getPlaylist(m_id)] - - if not playlists: - self.fail(_("No playlist available")) - - addedvideos = [] - urlize = lambda x: "https://www.youtube.com/watch?v=" + x - for p in playlists: - p_name = p['title'] - p_videos = self.getVideosId(p['id']) - p_folder = fs_join(self.config['general']['download_folder'], p['channelTitle'], p_name) - self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) - - if not p_videos: - continue - elif "checkDups" in p: - p_urls = [urlize(v_id) for v_id in p_videos if v_id not in addedvideos] - self.logDebug("%s video\s available on playlist \"%s\" after duplicates cleanup" % (len(p_urls), p_name)) - else: - p_urls = map(urlize, p_videos) - - self.packages.append((p_name, p_urls, p_folder)) #: folder is NOT recognized by pyload 0.4.9! - - addedvideos.extend(p_videos) diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py index c1e8f82f4..cf397114f 100644 --- a/pyload/plugin/extractor/SevenZip.py +++ b/pyload/plugin/extractor/SevenZip.py @@ -2,8 +2,7 @@ import os import re - -from subprocess import Popen, PIPE +import subprocess from pyload.plugin.extractor.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice from pyload.utils import fs_encode, fs_join @@ -12,11 +11,11 @@ from pyload.utils import fs_encode, fs_join class SevenZip(UnRar): __name__ = "SevenZip" __type__ = "extractor" - __version__ = "0.09" + __version__ = "0.11" __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" - __authors__ = [("Michael Nowak", ""), + __authors__ = [("Michael Nowak" , "" ), ("Walter Purcaro", "vuolter@gmail.com")] @@ -42,22 +41,21 @@ class SevenZip(UnRar): def isUsable(cls): if os.name == "nt": cls.CMD = os.path.join(pypath, "7z.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) - out,err = p.communicate() + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() else: - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - cls.VERSION = cls.re_version.search(out).group(1) + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' return True - def test(self, password): - file = fs_encode(self.filename) - + def verify(self, password): # 7z can't distinguish crc and pw error in test - p = self.call_cmd("l", "-slt", file) + p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() if self.re_wrongpwd.search(out): @@ -72,9 +70,7 @@ class SevenZip(UnRar): def check(self, password): - file = fs_encode(self.filename) - - p = self.call_cmd("l", "-slt", file) + p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() # check if output or error macthes the 'wrong password'-Regexp @@ -154,5 +150,5 @@ class SevenZip(UnRar): self.manager.logDebug(" ".join(call)) - p = Popen(call, stdout=PIPE, stderr=PIPE) + p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p diff --git a/pyload/plugin/extractor/UnRar.py b/pyload/plugin/extractor/UnRar.py index fc452cf34..5b9052bff 100644 --- a/pyload/plugin/extractor/UnRar.py +++ b/pyload/plugin/extractor/UnRar.py @@ -2,19 +2,19 @@ import os import re +import subprocess from glob import glob from string import digits -from subprocess import Popen, PIPE from pyload.plugin.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from pyload.utils import decode, fs_encode, fs_join +from pyload.utils import fs_decode, fs_encode, fs_join def renice(pid, value): if value and os.name != "nt": try: - Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1) + subprocess.Popen(["renice", str(value), str(pid)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1) except Exception: pass @@ -23,13 +23,13 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" __type__ = "extractor" - __version__ = "1.14" + __version__ = "1.20" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com"), - ("Immenz", "immenz@gmx.net"),] + ("Immenz" , "immenz@gmx.net" )] CMD = "unrar" @@ -53,40 +53,38 @@ class UnRar(Extractor): if os.name == "nt": try: cls.CMD = os.path.join(pypath, "RAR.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True + except OSError: cls.CMD = os.path.join(pypath, "UnRAR.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() else: try: - p = Popen(["rar"], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True + except OSError: #: fallback to unrar - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - cls.VERSION = cls.re_version.search(out).group(1) + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' return True @classmethod - def isMultipart(cls,filename): - multipart = cls.re_multipart.search(filename) - if multipart: - # First Multipart file (part1.rar for *.part1-9.rar format or *.rar for .r1-9 format) handled as normal Archive - return False if (multipart.group(1) == "part" and int(multipart.group(2)) == 1 and not multipart.group(3)) else True - - return False + def isMultipart(cls, filename): + return True if cls.re_multipart.search(filename) else False - def test(self, password): + def verify(self, password): p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password) self._progress(p) err = p.stderr.read().strip() @@ -199,14 +197,14 @@ class UnRar(Extractor): result = set() if not self.fullpath and self.VERSION.startswith('5'): # NOTE: Unrar 5 always list full path - for f in decode(out).splitlines(): - f = fs_join(self.out, os.path.basename(f.strip())) + for f in fs_decode(out).splitlines(): + f = save_join(self.out, os.path.basename(f.strip())) if os.path.isfile(f): - result.add(fs_join(self.out, os.path.basename(f))) + result.add(save_join(self.out, os.path.basename(f))) else: - for f in decode(out).splitlines(): + for f in fs_decode(out).splitlines(): f = f.strip() - result.add(fs_join(self.out, f)) + result.add(save_join(self.out, f)) return list(result) @@ -219,7 +217,7 @@ class UnRar(Extractor): args.append("-o+") else: args.append("-o-") - if self.delete: + if self.delete != 'No': args.append("-or") for word in self.excludefiles: @@ -242,5 +240,5 @@ class UnRar(Extractor): self.manager.logDebug(" ".join(call)) - p = Popen(call, stdout=PIPE, stderr=PIPE) + p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p diff --git a/pyload/plugin/extractor/UnZip.py b/pyload/plugin/extractor/UnZip.py index 3c5f5ec8f..799af3926 100644 --- a/pyload/plugin/extractor/UnZip.py +++ b/pyload/plugin/extractor/UnZip.py @@ -13,7 +13,7 @@ from pyload.utils import fs_encode class UnZip(Extractor): __name__ = "UnZip" __type__ = "extractor" - __version__ = "1.11" + __version__ = "1.12" __description__ = """Zip extractor plugin""" __license__ = "GPLv3" @@ -39,7 +39,7 @@ class UnZip(Extractor): pass - def test(self): + def verify(self): with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: badfile = z.testzip() diff --git a/pyload/plugin/hook/AlldebridCom.py b/pyload/plugin/hook/AlldebridCom.py index 6d3e5db48..3d05fb761 100644 --- a/pyload/plugin/hook/AlldebridCom.py +++ b/pyload/plugin/hook/AlldebridCom.py @@ -11,8 +11,6 @@ class AlldebridCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 ), ("ssl" , "bool" , "Use HTTPS" , True )] @@ -23,7 +21,7 @@ class AlldebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" html = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() return [x.strip() for x in html.split(",") if x.strip()] diff --git a/pyload/plugin/hook/BypassCaptcha.py b/pyload/plugin/hook/BypassCaptcha.py index 7b7e156bb..786f5dff3 100644 --- a/pyload/plugin/hook/BypassCaptcha.py +++ b/pyload/plugin/hook/BypassCaptcha.py @@ -35,11 +35,13 @@ class BypassCaptcha(Hook): __description__ = """Send captchas to BypassCaptcha.com""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("Godofdream", "soilfcition@gmail.com"), - ("zoidberg", "zoidberg@mujmail.cz")] + ("zoidberg" , "zoidberg@mujmail.cz" )] + interval = 0 #@TODO: Remove in 0.4.10 + PYLOAD_KEY = "4f771155b640970d5607f919a615bdefc67e7d32" SUBMIT_URL = "http://bypasscaptcha.com/upload.php" @@ -48,7 +50,7 @@ class BypassCaptcha(Hook): def getCredits(self): - res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig('passkey')}) data = dict(x.split(' ', 1) for x in res.splitlines()) return int(data['Left']) @@ -63,7 +65,7 @@ class BypassCaptcha(Hook): try: res = req.load(self.SUBMIT_URL, post={'vendor_key': self.PYLOAD_KEY, - 'key': self.getConfig("passkey"), + 'key': self.getConfig('passkey'), 'gen_task_id': "1", 'file': (FORM_FILE, captcha)}, multipart=True) @@ -83,7 +85,7 @@ class BypassCaptcha(Hook): def respond(self, ticket, success): try: - res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), + res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig('passkey'), "cv": 1 if success else 0}) except BadHeader, e: self.logError(_("Could not send response"), e) @@ -96,10 +98,10 @@ class BypassCaptcha(Hook): if not task.isTextual(): return False - if not self.getConfig("passkey"): + if not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return False if self.getCredits() > 0: diff --git a/pyload/plugin/hook/Captcha9Kw.py b/pyload/plugin/hook/Captcha9Kw.py index dd3fb1ba1..38cbb5a21 100644 --- a/pyload/plugin/hook/Captcha9Kw.py +++ b/pyload/plugin/hook/Captcha9Kw.py @@ -3,9 +3,9 @@ from __future__ import with_statement import re +import time from base64 import b64encode -from time import sleep from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL @@ -32,21 +32,23 @@ class Captcha9kw(Hook): __description__ = """Send captchas to 9kw.eu""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com")] + interval = 0 #@TODO: Remove in 0.4.10 + API_URL = "http://www.9kw.eu/index.cgi" def activate(self): - if self.getConfig("ssl"): + if self.getConfig('ssl'): self.API_URL = self.API_URL.replace("http://", "https://") def getCredits(self): res = getURL(self.API_URL, - get={'apikey': self.getConfig("passkey"), + get={'apikey': self.getConfig('passkey'), 'pyload': "1", 'source': "pyload", 'action': "usercaptchaguthaben"}) @@ -77,14 +79,14 @@ class Captcha9kw(Hook): 'numeric' : 0, 'case_sensitive': 0, 'math' : 0, - 'prio' : min(max(self.getConfig("prio"), 0), 10), - 'confirm' : self.getConfig("confirm"), - 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), - 'selfsolve' : self.getConfig("selfsolve"), - 'cph' : self.getConfig("captchaperhour"), - 'cpm' : self.getConfig("captchapermin")} + 'prio' : min(max(self.getConfig('prio'), 0), 10), + 'confirm' : self.getConfig('confirm'), + 'timeout' : min(max(self.getConfig('timeout'), 300), 3999), + 'selfsolve' : self.getConfig('selfsolve'), + 'cph' : self.getConfig('captchaperhour'), + 'cpm' : self.getConfig('captchapermin')} - for opt in str(self.getConfig("hoster_options").split('|')): + for opt in str(self.getConfig('hoster_options').split('|')): details = map(str.strip, opt.split(':')) @@ -103,7 +105,7 @@ class Captcha9kw(Hook): break - post_data = {'apikey' : self.getConfig("passkey"), + post_data = {'apikey' : self.getConfig('passkey'), 'prio' : option['prio'], 'confirm' : option['confirm'], 'maxtimeout' : option['timeout'], @@ -128,7 +130,7 @@ class Captcha9kw(Hook): try: res = getURL(self.API_URL, post=post_data) except BadHeader, e: - sleep(3) + time.sleep(3) else: if res and res.isdigit(): break @@ -140,9 +142,9 @@ class Captcha9kw(Hook): task.data["ticket"] = res - for _i in xrange(int(self.getConfig("timeout") / 5)): + for _i in xrange(int(self.getConfig('timeout') / 5)): result = getURL(self.API_URL, - get={'apikey': self.getConfig("passkey"), + get={'apikey': self.getConfig('passkey'), 'id' : res, 'pyload': "1", 'info' : "1", @@ -150,7 +152,7 @@ class Captcha9kw(Hook): 'action': "usercaptchacorrectdata"}) if not result or result == "NO DATA": - sleep(5) + time.sleep(5) else: break else: @@ -166,10 +168,10 @@ class Captcha9kw(Hook): if not task.isTextual() and not task.isPositional(): return - if not self.getConfig("passkey"): + if not self.getConfig('passkey'): return - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return credits = self.getCredits() @@ -178,8 +180,8 @@ class Captcha9kw(Hook): self.logError(_("Your captcha 9kw.eu account has not enough credits")) return - queue = min(self.getConfig("queue"), 999) - timeout = min(max(self.getConfig("timeout"), 300), 3999) + queue = min(self.getConfig('queue'), 999) + timeout = min(max(self.getConfig('timeout'), 300), 3999) pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) for _i in xrange(5): @@ -187,11 +189,11 @@ class Captcha9kw(Hook): if queue < re.search(r'queue=(\d+)', servercheck).group(1): break - sleep(10) + time.sleep(10) else: self.fail(_("Too many captchas in queue")) - for opt in str(self.getConfig("hoster_options").split('|')): + for opt in str(self.getConfig('hoster_options').split('|')): details = map(str.strip, opt.split(':')) if not details or details[0].lower() != pluginname.lower(): @@ -221,7 +223,7 @@ class Captcha9kw(Hook): self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task)) return - passkey = self.getConfig("passkey") + passkey = self.getConfig('passkey') for _i in xrange(3): res = getURL(self.API_URL, @@ -238,7 +240,7 @@ class Captcha9kw(Hook): if res == "OK": break - sleep(5) + time.sleep(5) else: self.logDebug("Could not send %s request: %s" % (type, res)) diff --git a/pyload/plugin/hook/CaptchaBrotherhood.py b/pyload/plugin/hook/CaptchaBrotherhood.py index 554d102ec..fbf2e2e29 100644 --- a/pyload/plugin/hook/CaptchaBrotherhood.py +++ b/pyload/plugin/hook/CaptchaBrotherhood.py @@ -4,13 +4,13 @@ from __future__ import with_statement import StringIO import pycurl +import time try: from PIL import Image except ImportError: import Image -from time import sleep from urllib import urlencode from pyload.network.RequestFactory import getURL, getRequest @@ -46,16 +46,18 @@ class CaptchaBrotherhood(Hook): __description__ = """Send captchas to CaptchaBrotherhood.com""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("zoidberg", "zoidberg@mujmail.cz")] + interval = 0 #@TODO: Remove in 0.4.10 + API_URL = "http://www.captchabrotherhood.com/" def getCredits(self): res = getURL(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) + get={"username": self.getConfig('username'), "password": self.getConfig('passkey')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -84,8 +86,8 @@ class CaptchaBrotherhood(Hook): req = getRequest() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, - urlencode({'username' : self.getConfig("username"), - 'password' : self.getConfig("passkey"), + urlencode({'username' : self.getConfig('username'), + 'password' : self.getConfig('passkey'), 'captchaSource': "pyLoad", 'timeout' : "80"})) @@ -108,7 +110,7 @@ class CaptchaBrotherhood(Hook): ticket = res[3:] for _i in xrange(15): - sleep(5) + time.sleep(5) res = self.api_response("askCaptchaResult", ticket) if res.startswith("OK-answered"): return ticket, res[12:] @@ -118,8 +120,8 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = getURL("%s%s.aspx" % (self.API_URL, api), - get={"username": self.getConfig("username"), - "password": self.getConfig("passkey"), + get={"username": self.getConfig('username'), + "password": self.getConfig('passkey'), "captchaID": ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) @@ -134,10 +136,10 @@ class CaptchaBrotherhood(Hook): if not task.isTextual(): return False - if not self.getConfig("username") or not self.getConfig("passkey"): + if not self.getConfig('username') or not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return False if self.getCredits() > 10: diff --git a/pyload/plugin/hook/DeathByCaptcha.py b/pyload/plugin/hook/DeathByCaptcha.py index e0108963b..41d4d300b 100644 --- a/pyload/plugin/hook/DeathByCaptcha.py +++ b/pyload/plugin/hook/DeathByCaptcha.py @@ -3,10 +3,10 @@ from __future__ import with_statement import re +import time from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER -from time import sleep from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader @@ -59,10 +59,12 @@ class DeathByCaptcha(Hook): __description__ = """Send captchas to DeathByCaptcha.com""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("zoidberg", "zoidberg@mujmail.cz")] + interval = 0 #@TODO: Remove in 0.4.10 + API_URL = "http://api.dbcapi.me/api/" @@ -73,8 +75,8 @@ class DeathByCaptcha(Hook): if post: if not isinstance(post, dict): post = {} - post.update({"username": self.getConfig("username"), - "password": self.getConfig("passkey")}) + post.update({"username": self.getConfig('username'), + "password": self.getConfig('passkey')}) res = None try: @@ -127,7 +129,7 @@ class DeathByCaptcha(Hook): def submit(self, captcha, captchaType="file", match=None): #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig('passkey')): multipart = True data = (FORM_FILE, captcha) else: @@ -143,7 +145,7 @@ class DeathByCaptcha(Hook): ticket = res['captcha'] for _i in xrange(24): - sleep(5) + time.sleep(5) res = self.api_response("captcha/%d" % ticket, False) if res['text'] and res['is_correct']: break @@ -163,10 +165,10 @@ class DeathByCaptcha(Hook): if not task.isTextual(): return False - if not self.getConfig("username") or not self.getConfig("passkey"): + if not self.getConfig('username') or not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return False try: diff --git a/pyload/plugin/hook/DebridItaliaCom.py b/pyload/plugin/hook/DebridItaliaCom.py index e2f766d86..e7760ba5a 100644 --- a/pyload/plugin/hook/DebridItaliaCom.py +++ b/pyload/plugin/hook/DebridItaliaCom.py @@ -13,15 +13,13 @@ class DebridItaliaCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Debriditalia.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("stickell" , "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com" )] def getHosters(self): diff --git a/pyload/plugin/hook/EasybytezCom.py b/pyload/plugin/hook/EasybytezCom.py index 1163bbf46..79640a367 100644 --- a/pyload/plugin/hook/EasybytezCom.py +++ b/pyload/plugin/hook/EasybytezCom.py @@ -13,8 +13,6 @@ class EasybytezCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/ExpertDecoders.py b/pyload/plugin/hook/ExpertDecoders.py index 8fbc88c80..f1096b8ed 100644 --- a/pyload/plugin/hook/ExpertDecoders.py +++ b/pyload/plugin/hook/ExpertDecoders.py @@ -21,15 +21,17 @@ class ExpertDecoders(Hook): __description__ = """Send captchas to expertdecoders.com""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("zoidberg", "zoidberg@mujmail.cz")] + interval = 0 #@TODO: Remove in 0.4.10 + API_URL = "http://www.fasttypers.org/imagepost.ashx" def getCredits(self): - res = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) + res = getURL(self.API_URL, post={"key": self.getConfig('passkey'), "action": "balance"}) if res.isdigit(): self.logInfo(_("%s credits left") % res) @@ -55,7 +57,7 @@ class ExpertDecoders(Hook): try: result = req.load(self.API_URL, post={'action' : "upload", - 'key' : self.getConfig("passkey"), + 'key' : self.getConfig('passkey'), 'file' : b64encode(data), 'gen_task_id': ticket}) finally: @@ -69,10 +71,10 @@ class ExpertDecoders(Hook): if not task.isTextual(): return False - if not self.getConfig("passkey"): + if not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return False if self.getCredits() > 0: @@ -89,7 +91,7 @@ class ExpertDecoders(Hook): try: res = getURL(self.API_URL, - post={'action': "refund", 'key': self.getConfig("passkey"), 'gen_task_id': task.data['ticket']}) + post={'action': "refund", 'key': self.getConfig('passkey'), 'gen_task_id': task.data['ticket']}) self.logInfo(_("Request refund"), res) except BadHeader, e: diff --git a/pyload/plugin/hook/FastixRu.py b/pyload/plugin/hook/FastixRu.py index 8bc3b3f16..d0e2ff2fd 100644 --- a/pyload/plugin/hook/FastixRu.py +++ b/pyload/plugin/hook/FastixRu.py @@ -12,8 +12,6 @@ class FastixRu(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/FreeWayMe.py b/pyload/plugin/hook/FreeWayMe.py index 711be37a8..086824550 100644 --- a/pyload/plugin/hook/FreeWayMe.py +++ b/pyload/plugin/hook/FreeWayMe.py @@ -6,13 +6,11 @@ from pyload.plugin.internal.MultiHook import MultiHook class FreeWayMe(MultiHook): __name__ = "FreeWayMe" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] @@ -22,6 +20,13 @@ class FreeWayMe(MultiHook): def getHosters(self): - hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={'id': 3}).replace("\"", "").strip() - self.logDebug("Hosters", hostis) + # Get account data + if not self.account or not self.account.canUse(): + hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3}).replace("\"", "").strip() + else: + self.logDebug("AccountInfo available - Get HosterList with User Pass") + (user, data) = self.account.selectAccount() + hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3, "user": user, "pass": data['password']}).replace("\"", "").strip() + + self.logDebug("hosters: %s" % hostis) return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/pyload/plugin/hook/ImageTyperz.py b/pyload/plugin/hook/ImageTyperz.py index a9d7326de..a556b109a 100644 --- a/pyload/plugin/hook/ImageTyperz.py +++ b/pyload/plugin/hook/ImageTyperz.py @@ -40,10 +40,12 @@ class ImageTyperz(Hook): __description__ = """Send captchas to ImageTyperz.com""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("zoidberg", "zoidberg@mujmail.cz")] + interval = 0 #@TODO: Remove in 0.4.10 + SUBMIT_URL = "http://captchatypers.com/Forms/UploadFileAndGetTextNEW.ashx" RESPOND_URL = "http://captchatypers.com/Forms/SetBadImage.ashx" GETCREDITS_URL = "http://captchatypers.com/Forms/RequestBalance.ashx" @@ -52,8 +54,8 @@ class ImageTyperz(Hook): def getCredits(self): res = getURL(self.GETCREDITS_URL, post={'action': "REQUESTBALANCE", - 'username': self.getConfig("username"), - 'password': self.getConfig("passkey")}) + 'username': self.getConfig('username'), + 'password': self.getConfig('passkey')}) if res.startswith('ERROR'): raise ImageTyperzException(res) @@ -74,7 +76,7 @@ class ImageTyperz(Hook): try: #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig('passkey')): multipart = True data = (FORM_FILE, captcha) else: @@ -85,8 +87,8 @@ class ImageTyperz(Hook): res = req.load(self.SUBMIT_URL, post={'action': "UPLOADCAPTCHA", - 'username': self.getConfig("username"), - 'password': self.getConfig("passkey"), "file": data}, + 'username': self.getConfig('username'), + 'password': self.getConfig('passkey'), "file": data}, multipart=multipart) finally: req.close() @@ -110,10 +112,10 @@ class ImageTyperz(Hook): if not task.isTextual(): return False - if not self.getConfig("username") or not self.getConfig("passkey"): + if not self.getConfig('username') or not self.getConfig('passkey'): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if self.core.isClientConnected() and not self.getConfig('force'): return False if self.getCredits() > 0: @@ -130,8 +132,8 @@ class ImageTyperz(Hook): if task.data['service'] == self.__name__ and "ticket" in task.data: res = getURL(self.RESPOND_URL, post={'action': "SETBADIMAGE", - 'username': self.getConfig("username"), - 'password': self.getConfig("passkey"), + 'username': self.getConfig('username'), + 'password': self.getConfig('passkey'), 'imageid': task.data['ticket']}) if res == "SUCCESS": diff --git a/pyload/plugin/hook/LinkdecrypterCom.py b/pyload/plugin/hook/LinkdecrypterCom.py index efdf77065..ab1e662dc 100644 --- a/pyload/plugin/hook/LinkdecrypterCom.py +++ b/pyload/plugin/hook/LinkdecrypterCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.MultiHook import MultiHook class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "1.02" + __version__ = "1.03" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -22,4 +22,4 @@ class LinkdecrypterCom(MultiHook): def getCrypters(self): return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', - self.getURL("http://linkdecrypter.com/").replace("(g)", "")).group(1).split(', ') + self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ') diff --git a/pyload/plugin/hook/LinksnappyCom.py b/pyload/plugin/hook/LinksnappyCom.py index dc0c47496..7eddc5811 100644 --- a/pyload/plugin/hook/LinksnappyCom.py +++ b/pyload/plugin/hook/LinksnappyCom.py @@ -12,8 +12,6 @@ class LinksnappyCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/MegaDebridEu.py b/pyload/plugin/hook/MegaDebridEu.py index 7e86d4d49..e373a544b 100644 --- a/pyload/plugin/hook/MegaDebridEu.py +++ b/pyload/plugin/hook/MegaDebridEu.py @@ -12,8 +12,6 @@ class MegaDebridEu(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/MultishareCz.py b/pyload/plugin/hook/MultishareCz.py index 56f30fb39..21e200584 100644 --- a/pyload/plugin/hook/MultishareCz.py +++ b/pyload/plugin/hook/MultishareCz.py @@ -13,8 +13,6 @@ class MultishareCz(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/MyfastfileCom.py b/pyload/plugin/hook/MyfastfileCom.py index 097a54b60..3149e832c 100644 --- a/pyload/plugin/hook/MyfastfileCom.py +++ b/pyload/plugin/hook/MyfastfileCom.py @@ -12,8 +12,6 @@ class MyfastfileCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/NoPremiumPl.py b/pyload/plugin/hook/NoPremiumPl.py index da7967154..93c5b8d1e 100644 --- a/pyload/plugin/hook/NoPremiumPl.py +++ b/pyload/plugin/hook/NoPremiumPl.py @@ -12,8 +12,6 @@ class NoPremiumPl(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/OverLoadMe.py b/pyload/plugin/hook/OverLoadMe.py index e4602019f..6db7c1fa2 100644 --- a/pyload/plugin/hook/OverLoadMe.py +++ b/pyload/plugin/hook/OverLoadMe.py @@ -11,8 +11,6 @@ class OverLoadMe(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 ), ("ssl" , "bool" , "Use HTTPS" , True )] @@ -23,7 +21,7 @@ class OverLoadMe(MultiHook): def getHosters(self): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" html = self.getURL(https + "://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() self.logDebug("Hosterlist", html) diff --git a/pyload/plugin/hook/PremiumTo.py b/pyload/plugin/hook/PremiumTo.py index 58d753cec..51e801c4f 100644 --- a/pyload/plugin/hook/PremiumTo.py +++ b/pyload/plugin/hook/PremiumTo.py @@ -11,14 +11,12 @@ class PremiumTo(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Premium.to hook plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hook/PremiumizeMe.py b/pyload/plugin/hook/PremiumizeMe.py index c5f1588ec..209db7c75 100644 --- a/pyload/plugin/hook/PremiumizeMe.py +++ b/pyload/plugin/hook/PremiumizeMe.py @@ -12,8 +12,6 @@ class PremiumizeMe(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/RPNetBiz.py b/pyload/plugin/hook/RPNetBiz.py index 75fe0e39b..e8afb4fc0 100644 --- a/pyload/plugin/hook/RPNetBiz.py +++ b/pyload/plugin/hook/RPNetBiz.py @@ -12,8 +12,6 @@ class RPNetBiz(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/RapideoPl.py b/pyload/plugin/hook/RapideoPl.py index 12d53830b..74bad2cfd 100644 --- a/pyload/plugin/hook/RapideoPl.py +++ b/pyload/plugin/hook/RapideoPl.py @@ -12,8 +12,6 @@ class RapideoPl(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/RealdebridCom.py b/pyload/plugin/hook/RealdebridCom.py index a8eb03f83..74a114105 100644 --- a/pyload/plugin/hook/RealdebridCom.py +++ b/pyload/plugin/hook/RealdebridCom.py @@ -11,8 +11,6 @@ class RealdebridCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 ), ("ssl" , "bool" , "Use HTTPS" , True )] @@ -23,7 +21,7 @@ class RealdebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" html = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() return [x.strip() for x in html.split(",") if x.strip()] diff --git a/pyload/plugin/hook/RehostTo.py b/pyload/plugin/hook/RehostTo.py index cda80417c..69978edaa 100644 --- a/pyload/plugin/hook/RehostTo.py +++ b/pyload/plugin/hook/RehostTo.py @@ -11,8 +11,6 @@ class RehostTo(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/SimplyPremiumCom.py b/pyload/plugin/hook/SimplyPremiumCom.py index 28d9af41f..9f696666f 100644 --- a/pyload/plugin/hook/SimplyPremiumCom.py +++ b/pyload/plugin/hook/SimplyPremiumCom.py @@ -12,8 +12,6 @@ class SimplyPremiumCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/SimplydebridCom.py b/pyload/plugin/hook/SimplydebridCom.py index 011b346b8..74eba106e 100644 --- a/pyload/plugin/hook/SimplydebridCom.py +++ b/pyload/plugin/hook/SimplydebridCom.py @@ -11,8 +11,6 @@ class SimplydebridCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/SmoozedCom.py b/pyload/plugin/hook/SmoozedCom.py index 3f5aab63d..37c0d9bcb 100644 --- a/pyload/plugin/hook/SmoozedCom.py +++ b/pyload/plugin/hook/SmoozedCom.py @@ -11,8 +11,6 @@ class SmoozedCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] diff --git a/pyload/plugin/hook/UnrestrictLi.py b/pyload/plugin/hook/UnrestrictLi.py index 0c4984042..a0fb53004 100644 --- a/pyload/plugin/hook/UnrestrictLi.py +++ b/pyload/plugin/hook/UnrestrictLi.py @@ -12,8 +12,6 @@ class UnrestrictLi(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 ), ("history" , "bool" , "Delete History" , False)] diff --git a/pyload/plugin/hook/XFileSharingPro.py b/pyload/plugin/hook/XFileSharingPro.py index 94866566c..9599c8180 100644 --- a/pyload/plugin/hook/XFileSharingPro.py +++ b/pyload/plugin/hook/XFileSharingPro.py @@ -8,7 +8,7 @@ from pyload.plugin.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.32" + __version__ = "0.36" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -23,15 +23,16 @@ class XFileSharingPro(Hook): # event_list = ["pluginConfigChanged"] - regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', - r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), - 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', - r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} + interval = 0 #@TODO: Remove in 0.4.10 + regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), + 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} HOSTER_BUILTIN = [#WORKING HOSTERS: - "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", - "fileparadox.in", "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", - "ryushare.com", "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", + "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com", + "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", @@ -41,7 +42,7 @@ class XFileSharingPro(Hook): CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] - # def pluginConfigChanged(self.__name__, plugin, name, value): + # def pluginConfigChanged(self, plugin, name, value): # self.loadPattern() @@ -104,7 +105,7 @@ class XFileSharingPro(Hook): # def downloadFailed(self, pyfile): # if pyfile.pluginname == "BasePlugin" \ # and pyfile.hasStatus("failed") \ - # and not self.getConfig("use_hoster_list") \ + # and not self.getConfig('use_hoster_list') \ # and self.unloadHoster("BasePlugin"): # self.logDebug("Unloaded XFileSharingPro from BasePlugin") # pyfile.setStatus("queued") diff --git a/pyload/plugin/hook/ZeveraCom.py b/pyload/plugin/hook/ZeveraCom.py index a60c33bd4..0ca2e72d2 100644 --- a/pyload/plugin/hook/ZeveraCom.py +++ b/pyload/plugin/hook/ZeveraCom.py @@ -11,15 +11,13 @@ class ZeveraCom(MultiHook): __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), ("reload" , "bool" , "Reload plugin list" , True ), ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Zevera.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] def getHosters(self): diff --git a/pyload/plugin/hoster/AlldebridCom.py b/pyload/plugin/hoster/AlldebridCom.py index 8ab98bc6f..d739600d9 100644 --- a/pyload/plugin/hoster/AlldebridCom.py +++ b/pyload/plugin/hoster/AlldebridCom.py @@ -13,27 +13,16 @@ from pyload.utils import parseFileSize class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.46" __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Alldebrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Andy Voigt", "spamsales@online.de")] - def getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - - if name.endswith("..."): # incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - - return name - - def setup(self): self.chunkLimit = 16 @@ -58,18 +47,9 @@ class AlldebridCom(MultiHoster): pyfile.size = parseFileSize(data['filesize']) self.link = data['link'] - if self.getConfig("ssl"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error": - self.retry(wait_time=60, reason=_("An error occured while generating link")) - return super(AlldebridCom, self).checkFile() diff --git a/pyload/plugin/hoster/AndroidfilehostCom.py b/pyload/plugin/hoster/AndroidfilehostCom.py index 386df4f2c..aa1387c24 100644 --- a/pyload/plugin/hoster/AndroidfilehostCom.py +++ b/pyload/plugin/hoster/AndroidfilehostCom.py @@ -14,6 +14,7 @@ class AndroidfilehostCom(SimpleHoster): __version__ = "0.01" __pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Androidfilehost.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/BasketbuildCom.py b/pyload/plugin/hoster/BasketbuildCom.py index fb34bbc40..ea9b9bc29 100644 --- a/pyload/plugin/hoster/BasketbuildCom.py +++ b/pyload/plugin/hoster/BasketbuildCom.py @@ -15,6 +15,7 @@ class BasketbuildCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """basketbuild.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/BayfilesCom.py b/pyload/plugin/hoster/BayfilesCom.py index 457440bd3..ab94b4015 100644 --- a/pyload/plugin/hoster/BayfilesCom.py +++ b/pyload/plugin/hoster/BayfilesCom.py @@ -9,6 +9,7 @@ class BayfilesCom(DeadHoster): __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' + __config__ = [] __description__ = """Bayfiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/BezvadataCz.py b/pyload/plugin/hoster/BezvadataCz.py index cea32dd5c..20da88010 100644 --- a/pyload/plugin/hoster/BezvadataCz.py +++ b/pyload/plugin/hoster/BezvadataCz.py @@ -11,6 +11,7 @@ class BezvadataCz(SimpleHoster): __version__ = "0.26" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """BezvaData.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/BitshareCom.py b/pyload/plugin/hoster/BitshareCom.py index 81bc8dae9..8e8a87bc1 100644 --- a/pyload/plugin/hoster/BitshareCom.py +++ b/pyload/plugin/hoster/BitshareCom.py @@ -14,6 +14,7 @@ class BitshareCom(SimpleHoster): __version__ = "0.53" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" @@ -80,7 +81,7 @@ class BitshareCom(SimpleHoster): def getDownloadUrl(self): # Return location if direct download is active if self.premium: - header = self.load(self.pyfile.url, cookies=True, just_header=True) + header = self.load(self.pyfile.url, just_header=True) if 'location' in header: return header['location'] diff --git a/pyload/plugin/hoster/BoltsharingCom.py b/pyload/plugin/hoster/BoltsharingCom.py index 39e84cd7c..58d4a23a9 100644 --- a/pyload/plugin/hoster/BoltsharingCom.py +++ b/pyload/plugin/hoster/BoltsharingCom.py @@ -9,6 +9,7 @@ class BoltsharingCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?boltsharing\.com/\w{12}' + __config__ = [] __description__ = """Boltsharing.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/CatShareNet.py b/pyload/plugin/hoster/CatShareNet.py index 94a963c45..c2f7756c0 100644 --- a/pyload/plugin/hoster/CatShareNet.py +++ b/pyload/plugin/hoster/CatShareNet.py @@ -9,9 +9,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """CatShare.net hoster plugin""" __license__ = "GPLv3" @@ -36,11 +37,12 @@ class CatShareNet(SimpleHoster): self.resumeDownload = True - def getFileInfo(self): + def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: self.fail(_("Only connections from Polish IP address are allowed")) - return super(CatShareNet, self).getFileInfo() + + return super(CatShareNet, self).checkErrors() def handleFree(self, pyfile): diff --git a/pyload/plugin/hoster/CloudzerNet.py b/pyload/plugin/hoster/CloudzerNet.py index c3154e9f1..775b4656a 100644 --- a/pyload/plugin/hoster/CloudzerNet.py +++ b/pyload/plugin/hoster/CloudzerNet.py @@ -9,6 +9,7 @@ class CloudzerNet(DeadHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' + __config__ = [] __description__ = """Cloudzer.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/CloudzillaTo.py b/pyload/plugin/hoster/CloudzillaTo.py index e33e2ebe4..337aa9d3c 100644 --- a/pyload/plugin/hoster/CloudzillaTo.py +++ b/pyload/plugin/hoster/CloudzillaTo.py @@ -11,6 +11,7 @@ class CloudzillaTo(SimpleHoster): __version__ = "0.06" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Cloudzilla.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/CrockoCom.py b/pyload/plugin/hoster/CrockoCom.py index bcbbc84a1..42f4d7775 100644 --- a/pyload/plugin/hoster/CrockoCom.py +++ b/pyload/plugin/hoster/CrockoCom.py @@ -12,6 +12,7 @@ class CrockoCom(SimpleHoster): __version__ = "0.19" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Crocko hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/CyberlockerCh.py b/pyload/plugin/hoster/CyberlockerCh.py index c4e1d41b1..ec06844c3 100644 --- a/pyload/plugin/hoster/CyberlockerCh.py +++ b/pyload/plugin/hoster/CyberlockerCh.py @@ -9,6 +9,7 @@ class CyberlockerCh(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?cyberlocker\.ch/\w+' + __config__ = [] __description__ = """Cyberlocker.ch hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/CzshareCom.py b/pyload/plugin/hoster/CzshareCom.py index 3bf371508..70766d6fc 100644 --- a/pyload/plugin/hoster/CzshareCom.py +++ b/pyload/plugin/hoster/CzshareCom.py @@ -12,9 +12,10 @@ from pyload.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.98" + __version__ = "0.99" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -43,7 +44,7 @@ class CzshareCom(SimpleHoster): m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: self.account.relogin(self.user) - self.html = self.load(self.pyfile.url, cookies=True, decode=True) + self.html = self.load(self.pyfile.url, decode=True) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: return False @@ -87,7 +88,7 @@ class CzshareCom(SimpleHoster): self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html - self.html = self.load(parsed_url, cookies=True, decode=True) + self.html = self.load(parsed_url, decode=True) if re.search(self.MULTIDL_PATTERN, self.html): self.longWait(5 * 60, 12) @@ -104,7 +105,7 @@ class CzshareCom(SimpleHoster): captcha_url = 'http://sdilej.cz/captcha.php' for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) - self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) + self.html = self.load(parsed_url, post=inputs, decode=True) if u"<li>ZadanÃœ ovÄÅovacà kód nesouhlasÃ!</li>" in self.html: self.invalidCaptcha() @@ -133,7 +134,7 @@ class CzshareCom(SimpleHoster): self.wait() - def checkFile(self): + def checkFile(self, rules={}): # check download check = self.checkDownload({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), @@ -155,4 +156,4 @@ class CzshareCom(SimpleHoster): self.invalidCaptcha() self.retry() - return super(CzshareCom, self).checkFile() + return super(CzshareCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/DailymotionCom.py b/pyload/plugin/hoster/DailymotionCom.py index c212fa872..f90067446 100644 --- a/pyload/plugin/hoster/DailymotionCom.py +++ b/pyload/plugin/hoster/DailymotionCom.py @@ -72,7 +72,7 @@ class DailymotionCom(Hoster): def getQuality(self): - q = self.getConfig("quality") + q = self.getConfig('quality') if q == "Lowest": quality = 0 diff --git a/pyload/plugin/hoster/DataHu.py b/pyload/plugin/hoster/DataHu.py index 219e73441..820736e0a 100644 --- a/pyload/plugin/hoster/DataHu.py +++ b/pyload/plugin/hoster/DataHu.py @@ -14,6 +14,7 @@ class DataHu(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Data.hu hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DataportCz.py b/pyload/plugin/hoster/DataportCz.py index 8a32400ec..4f659b291 100644 --- a/pyload/plugin/hoster/DataportCz.py +++ b/pyload/plugin/hoster/DataportCz.py @@ -9,6 +9,7 @@ class DataportCz(SimpleHoster): __version__ = "0.41" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dataport.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DateiTo.py b/pyload/plugin/hoster/DateiTo.py index 216a758c8..97fdd0155 100644 --- a/pyload/plugin/hoster/DateiTo.py +++ b/pyload/plugin/hoster/DateiTo.py @@ -12,6 +12,7 @@ class DateiTo(SimpleHoster): __version__ = "0.07" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Datei.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DdlstorageCom.py b/pyload/plugin/hoster/DdlstorageCom.py index cfde84ad0..c2077eb16 100644 --- a/pyload/plugin/hoster/DdlstorageCom.py +++ b/pyload/plugin/hoster/DdlstorageCom.py @@ -9,6 +9,7 @@ class DdlstorageCom(DeadHoster): __version__ = "1.02" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/\w+' + __config__ = [] __description__ = """DDLStorage.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DebridItaliaCom.py b/pyload/plugin/hoster/DebridItaliaCom.py index 1e7e1a338..af9500707 100644 --- a/pyload/plugin/hoster/DebridItaliaCom.py +++ b/pyload/plugin/hoster/DebridItaliaCom.py @@ -11,6 +11,7 @@ class DebridItaliaCom(MultiHoster): __version__ = "0.17" __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Debriditalia.com multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DepositfilesCom.py b/pyload/plugin/hoster/DepositfilesCom.py index 67cfe4bdc..1832fd35b 100644 --- a/pyload/plugin/hoster/DepositfilesCom.py +++ b/pyload/plugin/hoster/DepositfilesCom.py @@ -11,9 +11,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Depositfiles.com hoster plugin""" __license__ = "GPLv3" @@ -32,32 +33,18 @@ class DepositfilesCom(SimpleHoster): COOKIES = [("dfiles.eu", "lang_current", "en")] + WAIT_PATTERN = r'(?:download_waiter_remain">|html_download_api-limit_interval">|>Please wait|>Try in).+' + ERROR_PATTER = r'File is checked, please try again in a minute' + LINK_FREE_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' LINK_PREMIUM_PATTERN = r'class="repeat"><a href="(.+?)"' LINK_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' def handleFree(self, pyfile): - if re.search(r'File is checked, please try again in a minute.', self.html) is not None: - self.logInfo(_("The file is being checked. Waiting 1 minute")) - self.retry(wait_time=60) - - wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) - if wait: - wait_time = int(wait.group(1)) - self.logInfo(_("Traffic used up. Waiting %d seconds") % wait_time) - self.wait(wait_time, True) - self.retry() + self.html = self.load(pyfile.url, post={'gateway_result': "1"}) - wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) - if wait: - wait_time = int(wait.group(1)) - self.logInfo(_("All free slots occupied. Waiting %d minutes") % wait_time) - self.setWait(wait_time * 60, False) - - wait = re.search(r'Please wait (\d+) sec', self.html) - if wait: - self.setWait(int(wait.group(1))) + self.checkErrors() m = re.search(r"var fid = '(\w+)';", self.html) if m is None: @@ -69,38 +56,31 @@ class DepositfilesCom(SimpleHoster): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.error(_("ReCaptcha key not found")) + return + + self.html = self.load("https://dfiles.eu/get_file.php", get=params) - for _i in xrange(5): + if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: + params['response'], params['challenge'] = recaptcha.challenge(captcha_key) self.html = self.load("https://dfiles.eu/get_file.php", get=params) - if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: - if 'response' in params: - self.invalidCaptcha() - params['response'], params['challenge'] = recaptcha.challenge(captcha_key) - self.logDebug(params) - continue - - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - if 'response' in params: - self.correctCaptcha() - - self.link = unquote(m.group(1)) - break - else: - self.error(_("Download link")) - else: - self.fail(_("No valid captcha response received")) + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + if 'response' in params: + self.correctCaptcha() + + self.link = unquote(m.group(1)) def handlePremium(self, pyfile): if '<span class="html_download_api-gold_traffic_limit">' in self.html: self.logWarning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") + elif 'onClick="show_gold_offer' in self.html: self.account.relogin(self.user) self.retry() + else: link = re.search(self.LINK_PREMIUM_PATTERN, self.html) mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) diff --git a/pyload/plugin/hoster/DevhostSt.py b/pyload/plugin/hoster/DevhostSt.py index e4c6f819b..5816f1ba0 100644 --- a/pyload/plugin/hoster/DevhostSt.py +++ b/pyload/plugin/hoster/DevhostSt.py @@ -14,6 +14,7 @@ class DevhostSt(SimpleHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """d-h.st hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DlFreeFr.py b/pyload/plugin/hoster/DlFreeFr.py index b0f9e7b7f..7df87bd5d 100644 --- a/pyload/plugin/hoster/DlFreeFr.py +++ b/pyload/plugin/hoster/DlFreeFr.py @@ -40,6 +40,7 @@ class DlFreeFr(SimpleHoster): __version__ = "0.28" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dl.free.fr hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DodanePl.py b/pyload/plugin/hoster/DodanePl.py index 35fa1ecab..9bd5e45a9 100644 --- a/pyload/plugin/hoster/DodanePl.py +++ b/pyload/plugin/hoster/DodanePl.py @@ -9,6 +9,7 @@ class DodanePl(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?dodane\.pl/file/\d+' + __config__ = [] __description__ = """Dodane.pl hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/DuploadOrg.py b/pyload/plugin/hoster/DuploadOrg.py index db00c46e9..6b7574eee 100644 --- a/pyload/plugin/hoster/DuploadOrg.py +++ b/pyload/plugin/hoster/DuploadOrg.py @@ -9,6 +9,7 @@ class DuploadOrg(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?dupload\.org/\w{12}' + __config__ = [] __description__ = """Dupload.grg hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/EdiskCz.py b/pyload/plugin/hoster/EdiskCz.py index 7aaef10ae..2fd56eb82 100644 --- a/pyload/plugin/hoster/EdiskCz.py +++ b/pyload/plugin/hoster/EdiskCz.py @@ -11,6 +11,7 @@ class EdiskCz(SimpleHoster): __version__ = "0.23" __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Edisk.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/EgoFilesCom.py b/pyload/plugin/hoster/EgoFilesCom.py index a843f5051..150b8bc0c 100644 --- a/pyload/plugin/hoster/EgoFilesCom.py +++ b/pyload/plugin/hoster/EgoFilesCom.py @@ -9,6 +9,7 @@ class EgoFilesCom(DeadHoster): __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?egofiles\.com/\w+' + __config__ = [] __description__ = """Egofiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/EnteruploadCom.py b/pyload/plugin/hoster/EnteruploadCom.py index efec5b37c..b3a736697 100644 --- a/pyload/plugin/hoster/EnteruploadCom.py +++ b/pyload/plugin/hoster/EnteruploadCom.py @@ -9,6 +9,7 @@ class EnteruploadCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?enterupload\.com/\w+' + __config__ = [] __description__ = """EnterUpload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/EpicShareNet.py b/pyload/plugin/hoster/EpicShareNet.py index 16685088a..0bab20afa 100644 --- a/pyload/plugin/hoster/EpicShareNet.py +++ b/pyload/plugin/hoster/EpicShareNet.py @@ -9,6 +9,7 @@ class EpicShareNet(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?epicshare\.net/\w{12}' + __config__ = [] __description__ = """EpicShare.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/EuroshareEu.py b/pyload/plugin/hoster/EuroshareEu.py index 84fbcda08..fa0f69d8f 100644 --- a/pyload/plugin/hoster/EuroshareEu.py +++ b/pyload/plugin/hoster/EuroshareEu.py @@ -8,9 +8,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Euroshare.eu hoster plugin""" __license__ = "GPLv3" @@ -57,8 +58,8 @@ class EuroshareEu(SimpleHoster): self.link = "http://euroshare.eu%s" % m.group(1) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) - return super(EuroshareEu, self).checkFile() + return super(EuroshareEu, self).checkFile(rules) diff --git a/pyload/plugin/hoster/ExtabitCom.py b/pyload/plugin/hoster/ExtabitCom.py index d5c1f0ba4..dfd37b0a0 100644 --- a/pyload/plugin/hoster/ExtabitCom.py +++ b/pyload/plugin/hoster/ExtabitCom.py @@ -14,6 +14,7 @@ class ExtabitCom(SimpleHoster): __version__ = "0.65" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Extabit.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FastixRu.py b/pyload/plugin/hoster/FastixRu.py index 129259304..679194969 100644 --- a/pyload/plugin/hoster/FastixRu.py +++ b/pyload/plugin/hoster/FastixRu.py @@ -12,25 +12,16 @@ from pyload.plugin.internal.MultiHoster import MultiHoster class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.11" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Fastix multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - def getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - if name.endswith("..."): # incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - return name - - def setup(self): self.chunkLimit = 3 @@ -51,13 +42,4 @@ class FastixRu(MultiHoster): else: self.link = data['downloadlink'] - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}): - self.retry(wait_time=60, reason=_("An error occurred while generating link")) - return super(FastixRu, self).checkFile() diff --git a/pyload/plugin/hoster/FastshareCz.py b/pyload/plugin/hoster/FastshareCz.py index 4baa362c3..fba0e0479 100644 --- a/pyload/plugin/hoster/FastshareCz.py +++ b/pyload/plugin/hoster/FastshareCz.py @@ -10,9 +10,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.29" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FastShare.cz hoster plugin""" __license__ = "GPLv3" @@ -22,11 +23,12 @@ class FastshareCz(SimpleHoster): COOKIES = [("fastshare.cz", "lang", "en")] - INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>[\w^_]+),' + NAME_PATTERN = r'<h3 class="section_title">(?P<N>.+?)<' + SIZE_PATTERN = r'>Size\s*:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)' - LINK_FREE_PATTERN = r'action=(/free/.*?)>\s*<img src="([^"]*)"><br' - LINK_PREMIUM_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+&)' + LINK_FREE_PATTERN = r'>Enter the code\s*:</em>\s*<span><img src="(.+?)"' + LINK_PREMIUM_PATTERN = r'(http://\w+\.fastshare\.cz/download\.php\?id=\d+&)' SLOT_ERROR = "> 100% of FREE slots are full" CREDIT_ERROR = " credit for " @@ -57,7 +59,7 @@ class FastshareCz(SimpleHoster): self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) - def checkFile(self): + def checkFile(self, rules={}): check = self.checkDownload({ 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), 'wrong captcha': re.compile(r'Download for FREE'), @@ -73,4 +75,4 @@ class FastshareCz(SimpleHoster): elif check == "credit": self.resetAccount() - return super(FastshareCz, self).checkFile() + return super(FastshareCz, self).checkFile(rules) diff --git a/pyload/plugin/hoster/FileApeCom.py b/pyload/plugin/hoster/FileApeCom.py index 2c39e314c..4dc1442c5 100644 --- a/pyload/plugin/hoster/FileApeCom.py +++ b/pyload/plugin/hoster/FileApeCom.py @@ -9,6 +9,7 @@ class FileApeCom(DeadHoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' + __config__ = [] __description__ = """FileApe.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FileSharkPl.py b/pyload/plugin/hoster/FileSharkPl.py index 24b1db6de..ab28ac144 100644 --- a/pyload/plugin/hoster/FileSharkPl.py +++ b/pyload/plugin/hoster/FileSharkPl.py @@ -10,9 +10,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FileShark.pl hoster plugin""" __license__ = "GPLv3" @@ -20,10 +21,9 @@ class FileSharkPl(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>' - SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>' - - OFFLINE_PATTERN = '(P|p)lik zosta. (usuni.ty|przeniesiony)' + NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>' + SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>' + OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' LINK_FREE_PATTERN = r'<a href="(.*?)" class="btn-upload-free">' LINK_PREMIUM_PATTERN = r'<a href="(.*?)" class="btn-upload-premium">' @@ -33,7 +33,7 @@ class FileSharkPl(SimpleHoster): IP_ERROR_PATTERN = r'Strona jest dost.pna wy..cznie dla u.ytkownik.w znajduj.cych si. na terenie Polski' SLOT_ERROR_PATTERN = r'Osi.gni.to maksymaln. liczb. .ci.ganych jednocze.nie plik.w\.' - CAPTCHA_PATTERN = '<img src="data:image/jpeg;base64,(.*?)" title="captcha"' + CAPTCHA_PATTERN = r'<img src="data:image/jpeg;base64,(.*?)" title="captcha"' TOKEN_PATTERN = r'name="form\[_token\]" value="(.*?)" />' @@ -80,6 +80,8 @@ class FileSharkPl(SimpleHoster): link = urljoin("http://fileshark.pl", m.group(1)) + self.html = self.load(link) + m = re.search(self.WAIT_PATTERN, self.html) if m: seconds = int(m.group(1)) @@ -106,24 +108,7 @@ class FileSharkPl(SimpleHoster): self.load = tmp_load - self.download(link, post=inputs, cookies=True, disposition=True) - - - def checkFile(self): - check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'), - 'wait_pattern' : re.compile(self.SECONDS_PATTERN), - 'DL-found' : re.compile('<a href="(.*)">')}) - if check == "DL-found": - self.correctCaptcha() - - elif check == "wrong_captcha": - self.invalidCaptcha() - self.retry(10, 1, _("Wrong captcha solution")) - - elif check == "wait_pattern": - self.retry() - - return super(FileSharkPl, self).checkFile() + self.download(link, post=inputs, disposition=True) def _decode64(self, data, *args, **kwargs): diff --git a/pyload/plugin/hoster/FileStoreTo.py b/pyload/plugin/hoster/FileStoreTo.py index 8998c0b1c..10d24c1b0 100644 --- a/pyload/plugin/hoster/FileStoreTo.py +++ b/pyload/plugin/hoster/FileStoreTo.py @@ -11,6 +11,7 @@ class FileStoreTo(SimpleHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FileStore.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilebeerInfo.py b/pyload/plugin/hoster/FilebeerInfo.py index 83fc6dbfc..34f3969c2 100644 --- a/pyload/plugin/hoster/FilebeerInfo.py +++ b/pyload/plugin/hoster/FilebeerInfo.py @@ -9,6 +9,7 @@ class FilebeerInfo(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' + __config__ = [] __description__ = """Filebeer.info plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilecloudIo.py b/pyload/plugin/hoster/FilecloudIo.py index ae50f95bb..5068ad8c9 100644 --- a/pyload/plugin/hoster/FilecloudIo.py +++ b/pyload/plugin/hoster/FilecloudIo.py @@ -13,6 +13,7 @@ class FilecloudIo(SimpleHoster): __version__ = "0.08" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filecloud.io hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilefactoryCom.py b/pyload/plugin/hoster/FilefactoryCom.py index 95d61cd6a..c6b857307 100644 --- a/pyload/plugin/hoster/FilefactoryCom.py +++ b/pyload/plugin/hoster/FilefactoryCom.py @@ -21,9 +21,10 @@ def getInfo(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filefactory.com hoster plugin""" __license__ = "GPLv3" @@ -59,7 +60,7 @@ class FilefactoryCom(SimpleHoster): self.wait(m.group(1)) - def checkFile(self): + def checkFile(self, rules={}): check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) @@ -70,7 +71,7 @@ class FilefactoryCom(SimpleHoster): elif check == "error": self.error(_("Unknown error")) - return super(FilefactoryCom, self).checkFile() + return super(FilefactoryCom, self).checkFile(rules) def handlePremium(self, pyfile): diff --git a/pyload/plugin/hoster/FilepostCom.py b/pyload/plugin/hoster/FilepostCom.py index 8c462b5d6..45187a972 100644 --- a/pyload/plugin/hoster/FilepostCom.py +++ b/pyload/plugin/hoster/FilepostCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from pyload.utils import json_loads from pyload.plugin.internal.captcha import ReCaptcha @@ -15,6 +14,7 @@ class FilepostCom(SimpleHoster): __version__ = "0.33" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filepost.com hoster plugin""" __license__ = "GPLv3" @@ -41,7 +41,7 @@ class FilepostCom(SimpleHoster): captcha_key = m.group(1) # Get wait time - get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} + get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time.time() * 10000)) + '-xml'} post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']} wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) @@ -57,7 +57,7 @@ class FilepostCom(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + file_pass) - get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass self.link = self.getJsonResponse(get_dict, post_dict, 'link') @@ -72,7 +72,7 @@ class FilepostCom(SimpleHoster): recaptcha = ReCaptcha(self) for i in xrange(5): - get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' if i: post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( captcha_key) diff --git a/pyload/plugin/hoster/FilepupNet.py b/pyload/plugin/hoster/FilepupNet.py index b19f40106..80f4fc1c8 100644 --- a/pyload/plugin/hoster/FilepupNet.py +++ b/pyload/plugin/hoster/FilepupNet.py @@ -15,6 +15,7 @@ class FilepupNet(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filepup.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilerNet.py b/pyload/plugin/hoster/FilerNet.py index 3cf4bec36..138e728ff 100644 --- a/pyload/plugin/hoster/FilerNet.py +++ b/pyload/plugin/hoster/FilerNet.py @@ -16,9 +16,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.19" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filer.net hoster plugin""" __license__ = "GPLv3" @@ -29,17 +30,9 @@ class FilerNet(SimpleHoster): INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>[\w^_]+)</small></h1>' OFFLINE_PATTERN = r'Nicht gefunden' - LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' - + WAIT_PATTERN = r'musst du <span id="time">(\d+)' - def checkErrors(self): - # Wait between downloads - m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html) - if m: - errmsg = self.info['error'] = _("Wait between free downloads") - self.retry(wait_time=int(m.group(1)), reason=errmsg) - - self.info.pop('error', None) + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' def handleFree(self, pyfile): diff --git a/pyload/plugin/hoster/FileshareInUa.py b/pyload/plugin/hoster/FileshareInUa.py index f7855378a..afda590c0 100644 --- a/pyload/plugin/hoster/FileshareInUa.py +++ b/pyload/plugin/hoster/FileshareInUa.py @@ -9,6 +9,7 @@ class FileshareInUa(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' + __config__ = [] __description__ = """Fileshare.in.ua hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilesonicCom.py b/pyload/plugin/hoster/FilesonicCom.py index 1dee6eefd..4ba0f3e50 100644 --- a/pyload/plugin/hoster/FilesonicCom.py +++ b/pyload/plugin/hoster/FilesonicCom.py @@ -9,6 +9,7 @@ class FilesonicCom(DeadHoster): __version__ = "0.35" __pattern__ = r'http://(?:www\.)?filesonic\.com/file/\w+' + __config__ = [] __description__ = """Filesonic.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FilezyNet.py b/pyload/plugin/hoster/FilezyNet.py index deab69101..0ed326a22 100644 --- a/pyload/plugin/hoster/FilezyNet.py +++ b/pyload/plugin/hoster/FilezyNet.py @@ -9,6 +9,7 @@ class FilezyNet(DeadHoster): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?filezy\.net/\w{12}' + __config__ = [] __description__ = """Filezy.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FiredriveCom.py b/pyload/plugin/hoster/FiredriveCom.py index 4ce47e692..5879c4848 100644 --- a/pyload/plugin/hoster/FiredriveCom.py +++ b/pyload/plugin/hoster/FiredriveCom.py @@ -9,6 +9,7 @@ class FiredriveCom(DeadHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config__ = [] __description__ = """Firedrive.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FlyFilesNet.py b/pyload/plugin/hoster/FlyFilesNet.py index 5aff3e811..612de14bd 100644 --- a/pyload/plugin/hoster/FlyFilesNet.py +++ b/pyload/plugin/hoster/FlyFilesNet.py @@ -14,6 +14,7 @@ class FlyFilesNet(SimpleHoster): __version__ = "0.10" __pattern__ = r'http://(?:www\.)?flyfiles\.net/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FlyFiles.net hoster plugin""" __license__ = "GPLv3" @@ -32,7 +33,7 @@ class FlyFilesNet(SimpleHoster): url = "http://flyfiles.net" # get download URL - parsed_url = getURL(url, post={"getDownLink": session}, cookies=True) + parsed_url = getURL(url, post={"getDownLink": session}) self.logDebug("Parsed URL: %s" % parsed_url) if parsed_url == '#downlink|' or parsed_url == "#downlink|#": diff --git a/pyload/plugin/hoster/FourSharedCom.py b/pyload/plugin/hoster/FourSharedCom.py index 00209f4f1..8c15c5954 100644 --- a/pyload/plugin/hoster/FourSharedCom.py +++ b/pyload/plugin/hoster/FourSharedCom.py @@ -11,6 +11,7 @@ class FourSharedCom(SimpleHoster): __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """4Shared.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FreeWayMe.py b/pyload/plugin/hoster/FreeWayMe.py index 21f99c19e..560275eba 100644 --- a/pyload/plugin/hoster/FreeWayMe.py +++ b/pyload/plugin/hoster/FreeWayMe.py @@ -9,6 +9,7 @@ class FreeWayMe(MultiHoster): __version__ = "0.16" __pattern__ = r'https://(?:www\.)?free-way\.me/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FreeWayMe multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FreevideoCz.py b/pyload/plugin/hoster/FreevideoCz.py index 3c9b94ea8..af238c564 100644 --- a/pyload/plugin/hoster/FreevideoCz.py +++ b/pyload/plugin/hoster/FreevideoCz.py @@ -9,6 +9,7 @@ class FreevideoCz(DeadHoster): __version__ = "0.30" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' + __config__ = [] __description__ = """Freevideo.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/FshareVn.py b/pyload/plugin/hoster/FshareVn.py index 186cb2f87..73ce4e254 100644 --- a/pyload/plugin/hoster/FshareVn.py +++ b/pyload/plugin/hoster/FshareVn.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import strptime, mktime, gmtime from urlparse import urljoin from pyload.network.RequestFactory import getURL @@ -28,6 +28,7 @@ class FshareVn(SimpleHoster): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FshareVn hoster plugin""" __license__ = "GPLv3" @@ -99,8 +100,8 @@ class FshareVn(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: self.logInfo(_("Wait until %s ICT") % m.group(1)) - wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) - self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) + wait_until = time.mktime.time(time.strptime.time(m.group(1), "%d/%m/%Y %H:%M")) + self.wait(wait_until - time.mktime.time(time.gmtime.time()) - 7 * 60 * 60, True) self.retry() elif '<ul class="message-error">' in self.html: msg = "Unknown error occured or wait time not parsed" diff --git a/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py index 9aa842e21..6397882f8 100644 --- a/pyload/plugin/hoster/GigapetaCom.py +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -13,6 +13,7 @@ class GigapetaCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """GigaPeta.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/GooIm.py b/pyload/plugin/hoster/GooIm.py index 2090141ca..0556e9804 100644 --- a/pyload/plugin/hoster/GooIm.py +++ b/pyload/plugin/hoster/GooIm.py @@ -14,6 +14,7 @@ class GooIm(SimpleHoster): __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Goo.im hoster plugin""" __license__ = "GPLv3" @@ -31,4 +32,4 @@ class GooIm(SimpleHoster): def handleFree(self, pyfile): self.wait(10) - self.download(pyfile.url, cookies=True) + self.download(pyfile.url) diff --git a/pyload/plugin/hoster/GoogledriveCom.py b/pyload/plugin/hoster/GoogledriveCom.py index 14a9d058d..8ae3664a3 100644 --- a/pyload/plugin/hoster/GoogledriveCom.py +++ b/pyload/plugin/hoster/GoogledriveCom.py @@ -15,6 +15,7 @@ class GoogledriveCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Drive.google.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/HellshareCz.py b/pyload/plugin/hoster/HellshareCz.py index 2caaeb143..06dbe2178 100644 --- a/pyload/plugin/hoster/HellshareCz.py +++ b/pyload/plugin/hoster/HellshareCz.py @@ -11,6 +11,7 @@ class HellshareCz(SimpleHoster): __version__ = "0.85" __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Hellshare.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/HellspyCz.py b/pyload/plugin/hoster/HellspyCz.py index 049dd8df3..f8d05cfe8 100644 --- a/pyload/plugin/hoster/HellspyCz.py +++ b/pyload/plugin/hoster/HellspyCz.py @@ -9,6 +9,7 @@ class HellspyCz(DeadHoster): __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' + __config__ = [] __description__ = """HellSpy.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/HotfileCom.py b/pyload/plugin/hoster/HotfileCom.py index a9b1aa099..9491669b0 100644 --- a/pyload/plugin/hoster/HotfileCom.py +++ b/pyload/plugin/hoster/HotfileCom.py @@ -9,6 +9,7 @@ class HotfileCom(DeadHoster): __version__ = "0.37" __pattern__ = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' + __config__ = [] __description__ = """Hotfile.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/IFileWs.py b/pyload/plugin/hoster/IFileWs.py index 8effe015a..62b83fe25 100644 --- a/pyload/plugin/hoster/IFileWs.py +++ b/pyload/plugin/hoster/IFileWs.py @@ -9,6 +9,7 @@ class IFileWs(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?ifile\.ws/\w{12}' + __config__ = [] __description__ = """Ifile.ws hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/IcyFilesCom.py b/pyload/plugin/hoster/IcyFilesCom.py index 2a5b1d55a..48ce78ff5 100644 --- a/pyload/plugin/hoster/IcyFilesCom.py +++ b/pyload/plugin/hoster/IcyFilesCom.py @@ -9,6 +9,7 @@ class IcyFilesCom(DeadHoster): __version__ = "0.06" __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.+)' + __config__ = [] __description__ = """IcyFiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/IfileIt.py b/pyload/plugin/hoster/IfileIt.py index 58e64aff1..1b851477a 100644 --- a/pyload/plugin/hoster/IfileIt.py +++ b/pyload/plugin/hoster/IfileIt.py @@ -9,6 +9,7 @@ class IfileIt(DeadHoster): __version__ = "0.29" __pattern__ = r'^unmatchable$' + __config__ = [] __description__ = """Ifile.it""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/IfolderRu.py b/pyload/plugin/hoster/IfolderRu.py index b6e98674f..04c19ace5 100644 --- a/pyload/plugin/hoster/IfolderRu.py +++ b/pyload/plugin/hoster/IfolderRu.py @@ -11,6 +11,7 @@ class IfolderRu(SimpleHoster): __version__ = "0.39" __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Ifolder.ru hoster plugin""" __license__ = "GPLv3" @@ -38,23 +39,23 @@ class IfolderRu(SimpleHoster): def handleFree(self, pyfile): - self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], cookies=True, decode=True) + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], decode=True) self.getFileInfo() url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1) - self.html = self.load(url, cookies=True, decode=True) + self.html = self.load(url, decode=True) url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() - self.html = self.load(url, cookies=True, decode=True) + self.html = self.load(url, decode=True) url = "http://ints.rusfolder.com/ints/frame/?session=%s" % session_id - self.html = self.load(url, cookies=True) + self.html = self.load(url) self.wait(31, False) captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id for _i in xrange(5): - self.html = self.load(url, cookies=True) + self.html = self.load(url) action, inputs = self.parseHtmlForm('ID="Form1"') inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1) inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1' @@ -62,7 +63,7 @@ class IfolderRu(SimpleHoster): inputs['action'] = '1' self.logDebug(inputs) - self.html = self.load(url, decode=True, cookies=True, post=inputs) + self.html = self.load(url, decode=True, post=inputs) if self.WRONG_CAPTCHA_PATTERN in self.html: self.invalidCaptcha() else: diff --git a/pyload/plugin/hoster/JumbofilesCom.py b/pyload/plugin/hoster/JumbofilesCom.py index fa2ffdbff..380e94a4b 100644 --- a/pyload/plugin/hoster/JumbofilesCom.py +++ b/pyload/plugin/hoster/JumbofilesCom.py @@ -11,6 +11,7 @@ class JumbofilesCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """JumboFiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/Keep2ShareCc.py b/pyload/plugin/hoster/Keep2ShareCc.py index d655cf6ba..3c2b6c570 100644 --- a/pyload/plugin/hoster/Keep2ShareCc.py +++ b/pyload/plugin/hoster/Keep2ShareCc.py @@ -14,6 +14,7 @@ class Keep2ShareCc(SimpleHoster): __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Keep2Share.cc hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/KickloadCom.py b/pyload/plugin/hoster/KickloadCom.py index 5079570af..d0acb7636 100644 --- a/pyload/plugin/hoster/KickloadCom.py +++ b/pyload/plugin/hoster/KickloadCom.py @@ -9,6 +9,7 @@ class KickloadCom(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?kickload\.com/get/.+' + __config__ = [] __description__ = """Kickload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/KingfilesNet.py b/pyload/plugin/hoster/KingfilesNet.py index ad856dfb6..711051e70 100644 --- a/pyload/plugin/hoster/KingfilesNet.py +++ b/pyload/plugin/hoster/KingfilesNet.py @@ -12,6 +12,7 @@ class KingfilesNet(SimpleHoster): __version__ = "0.07" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Kingfiles.net hoster plugin""" __license__ = "GPLv3" @@ -43,7 +44,7 @@ class KingfilesNet(SimpleHoster): 'referer' : "", 'method_free': "+"} - self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) solvemedia = SolveMedia(self) response, challenge = solvemedia.challenge() @@ -66,7 +67,7 @@ class KingfilesNet(SimpleHoster): 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: diff --git a/pyload/plugin/hoster/LemUploadsCom.py b/pyload/plugin/hoster/LemUploadsCom.py index deb0d374f..c7f2e8045 100644 --- a/pyload/plugin/hoster/LemUploadsCom.py +++ b/pyload/plugin/hoster/LemUploadsCom.py @@ -9,6 +9,7 @@ class LemUploadsCom(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?lemuploads\.com/\w{12}' + __config__ = [] __description__ = """LemUploads.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/LetitbitNet.py b/pyload/plugin/hoster/LetitbitNet.py index dfdae5784..01767cabf 100644 --- a/pyload/plugin/hoster/LetitbitNet.py +++ b/pyload/plugin/hoster/LetitbitNet.py @@ -39,6 +39,7 @@ class LetitbitNet(SimpleHoster): __version__ = "0.30" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Letitbit.net hoster plugin""" __license__ = "GPLv3" @@ -56,16 +57,6 @@ class LetitbitNet(SimpleHoster): self.resumeDownload = True - def getFileInfo(self): - api_rep = api_response(self.pyfile.url) - if api_rep['status'] == 'OK': - self.api_data = api_rep['data'][0] - self.pyfile.name = self.api_data['name'] - self.pyfile.size = self.api_data['size'] - else: - self.offline() - - def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: @@ -75,7 +66,7 @@ class LetitbitNet(SimpleHoster): self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs, cookies=True) + self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs) m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 @@ -89,7 +80,7 @@ class LetitbitNet(SimpleHoster): self.wait(seconds) - res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) + res = self.load("http://letitbit.net/ajax/download3.php", post=" ") if res != '1': self.error(_("Unknown response - ajax_check_url")) @@ -104,7 +95,7 @@ class LetitbitNet(SimpleHoster): self.logDebug("Post data to send", post_data) - res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) self.logDebug(res) diff --git a/pyload/plugin/hoster/LinksnappyCom.py b/pyload/plugin/hoster/LinksnappyCom.py index fe3104579..a898b21b9 100644 --- a/pyload/plugin/hoster/LinksnappyCom.py +++ b/pyload/plugin/hoster/LinksnappyCom.py @@ -14,6 +14,7 @@ class LinksnappyCom(MultiHoster): __version__ = "0.08" __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Linksnappy.com multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/LoadTo.py b/pyload/plugin/hoster/LoadTo.py index 42d76b4fa..a1421714a 100644 --- a/pyload/plugin/hoster/LoadTo.py +++ b/pyload/plugin/hoster/LoadTo.py @@ -16,6 +16,7 @@ class LoadTo(SimpleHoster): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?load\.to/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Load.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/LomafileCom.py b/pyload/plugin/hoster/LomafileCom.py index 18f315bd6..678c93ea7 100644 --- a/pyload/plugin/hoster/LomafileCom.py +++ b/pyload/plugin/hoster/LomafileCom.py @@ -9,6 +9,7 @@ class LomafileCom(DeadHoster): __version__ = "0.52" __pattern__ = r'http://lomafile\.com/\w{12}' + __config__ = [] __description__ = """Lomafile.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/LuckyShareNet.py b/pyload/plugin/hoster/LuckyShareNet.py index d9cc5fe88..a0385f620 100644 --- a/pyload/plugin/hoster/LuckyShareNet.py +++ b/pyload/plugin/hoster/LuckyShareNet.py @@ -14,6 +14,7 @@ class LuckyShareNet(SimpleHoster): __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """LuckyShare.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MediafireCom.py b/pyload/plugin/hoster/MediafireCom.py index 5adf004d0..3b39e2420 100644 --- a/pyload/plugin/hoster/MediafireCom.py +++ b/pyload/plugin/hoster/MediafireCom.py @@ -1,128 +1,63 @@ # -*- coding: utf-8 -*- -import re - -from pyload.plugin.internal.captcha import SolveMedia -from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo -from pyload.network.RequestFactory import getURL - - -def replace_eval(js_expr): - return js_expr.replace(r'eval("', '').replace(r"\'", r"'").replace(r'\"', r'"') - - -def checkHTMLHeader(url): - try: - for _i in xrange(3): - header = getURL(url, just_header=True) - - for line in header.splitlines(): - line = line.lower() - - if 'location' in line: - url = line.split(':', 1)[1].strip() - if 'error.php?errno=320' in url: - return url, 1 - - if not url.startswith('http://'): - url = 'http://www.mediafire.com' + url - - break - - elif 'content-disposition' in line: - return url, 2 - else: - break - except Exception: - return url, 3 - else: - return url, 0 - - -def getInfo(urls): - for url in urls: - location, status = checkHTMLHeader(url) - - if status: - file_info = (url, 0, status, url) - else: - file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True)) - - yield file_info +from module.plugins.internal.CaptchaService import SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.84" + __version__ = "0.85" - __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' + __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/))\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Mediafire.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>.+?)"/>' + SIZE_PATTERN = r'<li>File size: <span>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'.*?\',\'(?P<N>.+?)\',\'(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\',\'\',\'(?P<H>.+?)\'\)' + OFFLINE_PATTERN = r'class="error_msg_title"' - NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' - INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<H>[^\']*)\'\)' - OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' + LINK_FREE_PATTERN = r'kNO = "(.+?)"' PASSWORD_PATTERN = r'<form name="form_password"' def setup(self): - self.multiDL = False - - - def process(self, pyfile): - pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) + self.resumeDownload = True + self.multiDL = True - self.link, result = checkHTMLHeader(pyfile.url) - self.logDebug("Location (%d): %s" % (result, self.link)) - if result == 0: - self.html = self.load(self.link, decode=True) - self.checkCaptcha() - self.multiDL = True - self.check_data = self.getFileInfo() - - if self.account: - self.handlePremium(pyfile) - else: - self.handleFree(pyfile) - elif result == 1: - self.offline() - else: - self.multiDL = True - self.download(self.link, disposition=True) + def handleFree(self, pyfile): + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.html = self.load(pyfile.url, + post={'adcopy_challenge': challenge, + 'adcopy_response' : response}, + decode=True) - def handleFree(self, pyfile): if self.PASSWORD_PATTERN in self.html: password = self.getPassword() - if password: - self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(self.link, post={"downloadp": password}) + if not password: + self.fail(_("No password found")) + else: + self.logInfo(_("Password protected link, trying: ") + password) + self.html = self.load(self.link, post={'downloadp': password}) if self.PASSWORD_PATTERN in self.html: self.fail(_("Incorrect password")) - else: - self.fail(_("No password found")) - - m = re.search(r'kNO = r"(http://.*?)";', self.html) - if m is None: - self.error(_("No download URL")) - download_url = m.group(1) - self.download(download_url) + return super(MediafireCom, self).handleFree(pyfile) - def checkCaptcha(self): - solvemedia = SolveMedia(self) - response, challenge = solvemedia.challenge() - self.html = self.load(self.link, - post={'adcopy_challenge': challenge, - 'adcopy_response' : response}, - decode=True) +getInfo = create_getInfo(MediafireCom) diff --git a/pyload/plugin/hoster/MegaCoNz.py b/pyload/plugin/hoster/MegaCoNz.py index 9648e8316..e2506ee3f 100644 --- a/pyload/plugin/hoster/MegaCoNz.py +++ b/pyload/plugin/hoster/MegaCoNz.py @@ -50,7 +50,7 @@ class MegaCoNz(Hoster): __type__ = "hoster" __version__ = "0.26" - __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' + __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MegaDebridEu.py b/pyload/plugin/hoster/MegaDebridEu.py index 842ad4de9..28707ce6f 100644 --- a/pyload/plugin/hoster/MegaDebridEu.py +++ b/pyload/plugin/hoster/MegaDebridEu.py @@ -11,9 +11,10 @@ from pyload.plugin.internal.MultiHoster import MultiHoster class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.47" __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" @@ -23,24 +24,6 @@ class MegaDebridEu(MultiHoster): API_URL = "https://www.mega-debrid.eu/api.php" - def getFilename(self, url): - try: - return unquote_plus(url.rsplit("/", 1)[1]) - except IndexError: - return "" - - - def handlePremium(self, pyfile): - if not self.api_load(): - self.exitOnFail("Unable to connect to Mega-debrid.eu") - - self.link = self.debridLink(pyfile.url) - - filename = self.getFilename(self.link) - if filename: - pyfile.name = filename - - def api_load(self): """ Connexion to the mega-debrid API @@ -58,29 +41,20 @@ class MegaDebridEu(MultiHoster): return False - def debridLink(self, linkToDebrid): + def handlePremium(self, pyfile): """ Debrid a link Return The debrided link if succeed or original link if fail """ - jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token}, - post={"link": linkToDebrid}) - res = json_loads(jsonResponse) + if not self.api_load(): + self.error("Unable to connect to remote API") + jsonResponse = self.load(self.API_URL, + get={'action': 'getLink', 'token': self.token}, + post={'link': pyfile.url}) + + res = json_loads(jsonResponse) if res['response_code'] == "ok": - debridedLink = res['debridLink'][1:-1] - return debridedLink - else: - self.exitOnFail("Unable to debrid %s" % linkToDebrid) + self.link = res['debridLink'][1:-1] - def exitOnFail(self, msg): - """ - exit the plugin on fail case - And display the reason of this failure - """ - if self.getConfig("unloadFailing"): - self.logError(_(msg)) - self.resetAccount() - else: - self.fail(_(msg)) diff --git a/pyload/plugin/hoster/MegaFilesSe.py b/pyload/plugin/hoster/MegaFilesSe.py index 3cfd41da4..6a1a24beb 100644 --- a/pyload/plugin/hoster/MegaFilesSe.py +++ b/pyload/plugin/hoster/MegaFilesSe.py @@ -9,6 +9,7 @@ class MegaFilesSe(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?megafiles\.se/\w{12}' + __config__ = [] __description__ = """MegaFiles.se hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MegaRapidCz.py b/pyload/plugin/hoster/MegaRapidCz.py index b7b9e3ffe..9d639555f 100644 --- a/pyload/plugin/hoster/MegaRapidCz.py +++ b/pyload/plugin/hoster/MegaRapidCz.py @@ -26,6 +26,7 @@ class MegaRapidCz(SimpleHoster): __version__ = "0.56" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """MegaRapid.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MegareleaseOrg.py b/pyload/plugin/hoster/MegareleaseOrg.py index c2c7fe357..541a1823c 100644 --- a/pyload/plugin/hoster/MegareleaseOrg.py +++ b/pyload/plugin/hoster/MegareleaseOrg.py @@ -9,6 +9,7 @@ class MegareleaseOrg(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?megarelease\.org/\w{12}' + __config__ = [] __description__ = """Megarelease.org hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MegasharesCom.py b/pyload/plugin/hoster/MegasharesCom.py index 483969e2e..ed07f373b 100644 --- a/pyload/plugin/hoster/MegasharesCom.py +++ b/pyload/plugin/hoster/MegasharesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -13,6 +12,7 @@ class MegasharesCom(SimpleHoster): __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Megashares.com hoster plugin""" __license__ = "GPLv3" @@ -66,7 +66,7 @@ class MegasharesCom(SimpleHoster): 'rsargs[]': random_num, 'rsargs[]': passport_num, 'rsargs[]': "replace_sec_pprenewal", - 'rsrnd[]' : str(int(time() * 1000))}) + 'rsrnd[]' : str(int(time.time() * 1000))}) if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() diff --git a/pyload/plugin/hoster/MegauploadCom.py b/pyload/plugin/hoster/MegauploadCom.py index c1d5b4524..2e26b630d 100644 --- a/pyload/plugin/hoster/MegauploadCom.py +++ b/pyload/plugin/hoster/MegauploadCom.py @@ -9,6 +9,7 @@ class MegauploadCom(DeadHoster): __version__ = "0.31" __pattern__ = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' + __config__ = [] __description__ = """Megaupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MegavideoCom.py b/pyload/plugin/hoster/MegavideoCom.py index 442b0f292..d87967cd9 100644 --- a/pyload/plugin/hoster/MegavideoCom.py +++ b/pyload/plugin/hoster/MegavideoCom.py @@ -9,6 +9,7 @@ class MegavideoCom(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' + __config__ = [] __description__ = """Megavideo.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MultishareCz.py b/pyload/plugin/hoster/MultishareCz.py index 252e9cdb5..2444a1675 100644 --- a/pyload/plugin/hoster/MultishareCz.py +++ b/pyload/plugin/hoster/MultishareCz.py @@ -13,6 +13,7 @@ class MultishareCz(SimpleHoster): __version__ = "0.40" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """MultiShare.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MyfastfileCom.py b/pyload/plugin/hoster/MyfastfileCom.py index c065c2331..81f2ffa78 100644 --- a/pyload/plugin/hoster/MyfastfileCom.py +++ b/pyload/plugin/hoster/MyfastfileCom.py @@ -12,6 +12,7 @@ class MyfastfileCom(MultiHoster): __version__ = "0.08" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/MystoreTo.py b/pyload/plugin/hoster/MystoreTo.py index e2288e344..4791d0096 100644 --- a/pyload/plugin/hoster/MystoreTo.py +++ b/pyload/plugin/hoster/MystoreTo.py @@ -14,6 +14,7 @@ class MystoreTo(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?mystore\.to/dl/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Mystore.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/NahrajCz.py b/pyload/plugin/hoster/NahrajCz.py index 6aa87a520..5e594ce64 100644 --- a/pyload/plugin/hoster/NahrajCz.py +++ b/pyload/plugin/hoster/NahrajCz.py @@ -9,6 +9,7 @@ class NahrajCz(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?nahraj\.cz/content/download/.+' + __config__ = [] __description__ = """Nahraj.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/NarodRu.py b/pyload/plugin/hoster/NarodRu.py index 7b9da6e4e..6cd9d57cc 100644 --- a/pyload/plugin/hoster/NarodRu.py +++ b/pyload/plugin/hoster/NarodRu.py @@ -13,6 +13,7 @@ class NarodRu(SimpleHoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Narod.ru hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py index 2ed298ffa..5178c684c 100644 --- a/pyload/plugin/hoster/NetloadIn.py +++ b/pyload/plugin/hoster/NetloadIn.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import re +import time from urlparse import urljoin -from time import time from pyload.network.RequestFactory import getURL from pyload.plugin.Hoster import Hoster @@ -161,7 +161,7 @@ class NetloadIn(Hoster): def final_wait(self, page): - wait_time = self.get_wait_time(page) + wait_time = self.get_wait_time.time(page) self.setWait(wait_time) @@ -172,10 +172,10 @@ class NetloadIn(Hoster): self.url = self.get_file_url(page) - def check_free_wait(self,page): + def check_free_wait(self, page): if ">An access request has been made from IP address <" in page: self.wantReconnect = True - self.setWait(self.get_wait_time(page) or 30) + self.setWait(self.get_wait_time.time(page) or 30) self.wait() return True else: @@ -207,7 +207,7 @@ class NetloadIn(Hoster): for i in xrange(5): if not page: page = self.load(self.url) - t = time() + 30 + t = time.time() + 30 if "/share/templates/download_hddcrash.tpl" in page: self.logError(_("Netload HDD Crash")) @@ -281,7 +281,7 @@ class NetloadIn(Hoster): return None - def get_wait_time(self, page): + def get_wait_time.time(self, page): return int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 diff --git a/pyload/plugin/hoster/NitroflareCom.py b/pyload/plugin/hoster/NitroflareCom.py index 85630a148..dfe33e59c 100644 --- a/pyload/plugin/hoster/NitroflareCom.py +++ b/pyload/plugin/hoster/NitroflareCom.py @@ -1,14 +1,7 @@ # -*- coding: utf-8 -*- -# -# Note: -# Right now premium support is not added -# Thus, any file that require premium support -# cannot be downloaded. Only the file that is free to -# download can be downloaded. import re -from pyload.utils import json_loads from pyload.plugin.internal.CaptchaService import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -16,9 +9,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Nitroflare.com hoster plugin""" __license__ = "GPLv3" @@ -36,7 +30,7 @@ class NitroflareCom(SimpleHoster): RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' - WAIT_PATTERN = r'You have to wait .+' + WAIT_PATTERN = r'You have to wait .+?<' ERROR_PATTERN = r'downloading is not possible' @@ -68,8 +62,8 @@ class NitroflareCom(SimpleHoster): # used here to load the cookies which will be required later self.load(pyfile.url, post={'goToFreePage': ""}) - self.load("https://www.nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) - self.html = self.load("https://www.nitroflare.com/ajax/freeDownload.php", + self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) self.checkErrors() @@ -87,7 +81,7 @@ class NitroflareCom(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - self.html = self.load("https://www.nitroflare.com/ajax/freeDownload.php", + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method' : "fetchDownload", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) diff --git a/pyload/plugin/hoster/NoPremiumPl.py b/pyload/plugin/hoster/NoPremiumPl.py index ddb9d78f8..c80d2ef6c 100644 --- a/pyload/plugin/hoster/NoPremiumPl.py +++ b/pyload/plugin/hoster/NoPremiumPl.py @@ -10,6 +10,7 @@ class NoPremiumPl(MultiHoster): __version__ = "0.02" __pattern__ = r'https?://direct\.nopremium\.pl.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """NoPremium.pl multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/NosuploadCom.py b/pyload/plugin/hoster/NosuploadCom.py index edb8c6508..3d785dd90 100644 --- a/pyload/plugin/hoster/NosuploadCom.py +++ b/pyload/plugin/hoster/NosuploadCom.py @@ -26,14 +26,14 @@ class NosuploadCom(XFSHoster): def getDownloadLink(self): # stage1: press the "Free Download" button data = self.getPostParameters() - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + self.html = self.load(self.pyfile.url, post=data, decode=True) # stage2: wait some time and press the "Download File" button data = self.getPostParameters() wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1) self.logDebug("Hoster told us to wait %s seconds" % wait_time) self.wait(wait_time) - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + self.html = self.load(self.pyfile.url, post=data, decode=True) # stage3: get the download link return re.search(self.LINK_PATTERN, self.html, re.S).group(1) diff --git a/pyload/plugin/hoster/NowDownloadSx.py b/pyload/plugin/hoster/NowDownloadSx.py index 00101a379..1cc009b30 100644 --- a/pyload/plugin/hoster/NowDownloadSx.py +++ b/pyload/plugin/hoster/NowDownloadSx.py @@ -9,9 +9,10 @@ from pyload.utils import fixup class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.09" - __pattern__ = r'http://(?:www\.)?(nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)|likeupload\.org/)\w+' + __pattern__ = r'http://(?:www\.)?(nowdownload\.[a-zA-Z]{2,}/(dl/|download\.php.+?id=|mobile/(#/files/|.+?id=))|likeupload\.org/)\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """NowDownload.sx hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/NowVideoSx.py b/pyload/plugin/hoster/NowVideoSx.py index 3c747c253..3501c5219 100644 --- a/pyload/plugin/hoster/NowVideoSx.py +++ b/pyload/plugin/hoster/NowVideoSx.py @@ -8,9 +8,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" - __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|li|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' + __pattern__ = r'http://(?:www\.)?nowvideo\.[a-zA-Z]{2,}/(video/|mobile/(#/videos/|.+?id=))(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """NowVideo.sx hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/OneFichierCom.py b/pyload/plugin/hoster/OneFichierCom.py index b9756e7ff..dd8064585 100644 --- a/pyload/plugin/hoster/OneFichierCom.py +++ b/pyload/plugin/hoster/OneFichierCom.py @@ -8,9 +8,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.78" + __version__ = "0.79" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """1fichier.com hoster plugin""" __license__ = "GPLv3" @@ -31,7 +32,7 @@ class OneFichierCom(SimpleHoster): COOKIES = [("1fichier.com", "LG", "en")] DISPOSITION = False #: Remove in 0.4.10 - WAIT_PATTERN = r'>You must wait (\d+) minutes' + WAIT_PATTERN = r'>You must wait \d+ minutes' def setup(self): diff --git a/pyload/plugin/hoster/OronCom.py b/pyload/plugin/hoster/OronCom.py index f28d34391..9a5207367 100644 --- a/pyload/plugin/hoster/OronCom.py +++ b/pyload/plugin/hoster/OronCom.py @@ -9,6 +9,7 @@ class OronCom(DeadHoster): __version__ = "0.14" __pattern__ = r'https?://(?:www\.)?oron\.com/\w{12}' + __config__ = [] __description__ = """Oron.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py index 8c0436d78..4bec0b0db 100644 --- a/pyload/plugin/hoster/OverLoadMe.py +++ b/pyload/plugin/hoster/OverLoadMe.py @@ -13,33 +13,22 @@ from pyload.utils import parseFileSize class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.11" __pattern__ = r'https?://.*overload\.me/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Over-Load.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("marley", "marley@over-load.me")] - def getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - - if name.endswith("..."): #: incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - - return name - - def setup(self): self.chunkLimit = 5 def handlePremium(self, pyfile): - https = "https" if self.getConfig("ssl") else "http" + https = "https" if self.getConfig('ssl') else "http" data = self.account.getAccountData(self.user) page = self.load(https + "://api.over-load.me/getdownload.php", get={'auth': data['password'], @@ -58,16 +47,6 @@ class OverLoadMe(MultiHoster): pyfile.size = parseFileSize(data['filesize']) http_repl = ["http://", "https://"] - self.link = data['downloadlink'].replace(*http_repl if self.getConfig("ssl") else *http_repl[::-1]) - - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): - # only use when name wasn't already set - pyfile.name = self.getFilename(self.link) - + self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1]) - def checkFile(self): - if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}) - # usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link.")) - return super(OverLoadMe, self).checkFile() diff --git a/pyload/plugin/hoster/PandaplaNet.py b/pyload/plugin/hoster/PandaplaNet.py index b9d5b6e5a..2a61a69c4 100644 --- a/pyload/plugin/hoster/PandaplaNet.py +++ b/pyload/plugin/hoster/PandaplaNet.py @@ -9,6 +9,7 @@ class PandaplaNet(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' + __config__ = [] __description__ = """Pandapla.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/PotloadCom.py b/pyload/plugin/hoster/PotloadCom.py index 4845299a5..c1e96ff77 100644 --- a/pyload/plugin/hoster/PotloadCom.py +++ b/pyload/plugin/hoster/PotloadCom.py @@ -9,6 +9,7 @@ class PotloadCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' + __config__ = [] __description__ = """Potload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/PremiumTo.py b/pyload/plugin/hoster/PremiumTo.py index 07945f873..46ecf0b36 100644 --- a/pyload/plugin/hoster/PremiumTo.py +++ b/pyload/plugin/hoster/PremiumTo.py @@ -11,9 +11,10 @@ from pyload.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" @@ -34,7 +35,7 @@ class PremiumTo(MultiHoster): disposition=True) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") @@ -49,4 +50,4 @@ class PremiumTo(MultiHoster): if err: self.fail(err) - return super(PremiumTo, self).checkFile() + return super(PremiumTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/PremiumizeMe.py b/pyload/plugin/hoster/PremiumizeMe.py index c1153280b..c6dcfa794 100644 --- a/pyload/plugin/hoster/PremiumizeMe.py +++ b/pyload/plugin/hoster/PremiumizeMe.py @@ -10,6 +10,7 @@ class PremiumizeMe(MultiHoster): __version__ = "0.16" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/PromptfileCom.py b/pyload/plugin/hoster/PromptfileCom.py index fb8c907e5..f550fa573 100644 --- a/pyload/plugin/hoster/PromptfileCom.py +++ b/pyload/plugin/hoster/PromptfileCom.py @@ -11,6 +11,7 @@ class PromptfileCom(SimpleHoster): __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Promptfile.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/PrzeklejPl.py b/pyload/plugin/hoster/PrzeklejPl.py index bfb27834a..d6437e82e 100644 --- a/pyload/plugin/hoster/PrzeklejPl.py +++ b/pyload/plugin/hoster/PrzeklejPl.py @@ -9,6 +9,7 @@ class PrzeklejPl(DeadHoster): __version__ = "0.11" __pattern__ = r'http://(?:www\.)?przeklej\.pl/plik/.+' + __config__ = [] __description__ = """Przeklej.pl hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py index 9300d230b..570c9f876 100644 --- a/pyload/plugin/hoster/QuickshareCz.py +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -11,6 +11,7 @@ class QuickshareCz(SimpleHoster): __version__ = "0.56" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Quickshare.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/RPNetBiz.py b/pyload/plugin/hoster/RPNetBiz.py index af56d8162..5e393ecb9 100644 --- a/pyload/plugin/hoster/RPNetBiz.py +++ b/pyload/plugin/hoster/RPNetBiz.py @@ -11,10 +11,11 @@ class RPNetBiz(MultiHoster): __type__ = "hoster" __version__ = "0.14" + __pattern__ = r'https?://.+rpnet\.biz' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __description__ = """RPNet.biz multi-hoster plugin""" __license__ = "GPLv3" - - __pattern__ = r'https?://.+rpnet\.biz' __authors__ = [("Dman", "dmanugm@gmail.com")] diff --git a/pyload/plugin/hoster/RapideoPl.py b/pyload/plugin/hoster/RapideoPl.py index 9e9bbf58b..86dfad5f0 100644 --- a/pyload/plugin/hoster/RapideoPl.py +++ b/pyload/plugin/hoster/RapideoPl.py @@ -10,6 +10,7 @@ class RapideoPl(MultiHoster): __version__ = "0.02" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapideo.pl multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/RapidgatorNet.py b/pyload/plugin/hoster/RapidgatorNet.py index 8cd883537..2af0001df 100644 --- a/pyload/plugin/hoster/RapidgatorNet.py +++ b/pyload/plugin/hoster/RapidgatorNet.py @@ -7,15 +7,16 @@ from pycurl import HTTPHEADER from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader from pyload.plugin.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia -from pyload.plugin.internal.SimpleHoster import SimpleHoster, secondsToMidnight +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapidgator.net hoster plugin""" __license__ = "GPLv3" @@ -36,7 +37,7 @@ class RapidgatorNet(SimpleHoster): JSVARS_PATTERN = r'\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*\'?(.*?)\'?;' PREMIUM_ONLY_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' - ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' + ERROR_PATTERN = r'You have reached your (?:daily|hourly) downloads limit' WAIT_PATTERN = r'(Delay between downloads must be not less than|Try again in).+' LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' @@ -125,8 +126,12 @@ class RapidgatorNet(SimpleHoster): self.link = m.group(1) break else: - captcha, captcha_key = self.handleCaptcha() - response, challenge = captcha.challenge(captcha_key) + captcha = self.handleCaptcha() + + if not captcha: + self.error(_("Captcha pattern not found")) + + response, challenge = captcha.challenge() self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", 'adcopy_challenge' : challenge, @@ -141,24 +146,10 @@ class RapidgatorNet(SimpleHoster): def handleCaptcha(self): - m = re.search(self.ADSCAPTCHA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = AdsCaptcha(self) - else: - m = re.search(self.RECAPTCHA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = ReCaptcha(self) - else: - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = SolveMedia(self) - else: - self.error(_("Captcha")) - - return captcha, captcha_key + for klass in (AdsCaptcha, ReCaptcha, SolveMedia): + inst = klass(self) + if inst.detect_key(): + return inst def getJsonResponse(self, url): diff --git a/pyload/plugin/hoster/RapiduNet.py b/pyload/plugin/hoster/RapiduNet.py index 1e12ab776..e11114a4a 100644 --- a/pyload/plugin/hoster/RapiduNet.py +++ b/pyload/plugin/hoster/RapiduNet.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import re +import time from pycurl import HTTPHEADER -from time import time, altzone from pyload.utils import json_loads from pyload.plugin.captcha import ReCaptcha @@ -16,6 +16,7 @@ class RapiduNet(SimpleHoster): __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapidu.net hoster plugin""" __license__ = "GPLv3" @@ -47,14 +48,14 @@ class RapiduNet(SimpleHoster): decode=True) if str(jsvars['timeToDownload']) is "stop": - t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone + t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone self.logInfo("You've reach your daily download transfer") self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock else: - self.wait(int(jsvars['timeToDownload']) - int(time())) + self.wait(int(jsvars['timeToDownload']) - int(time.time())) recaptcha = ReCaptcha(self) diff --git a/pyload/plugin/hoster/RealdebridCom.py b/pyload/plugin/hoster/RealdebridCom.py index ae6f69d7c..ca303cf88 100644 --- a/pyload/plugin/hoster/RealdebridCom.py +++ b/pyload/plugin/hoster/RealdebridCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import re +import time from random import randrange from urllib import unquote -from time import time from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster @@ -14,25 +14,16 @@ from pyload.utils import parseFileSize class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.64" + __version__ = "0.67" __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Real-Debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - def getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - if not name or name.endswith(".."): #: incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - return name - - def setup(self): self.chunkLimit = 3 @@ -42,7 +33,7 @@ class RealdebridCom(MultiHoster): get={'lang' : "en", 'link' : pyfile.url, 'password': self.getPassword(), - 'time' : int(time() * 1000)})) + 'time' : int(time.time() * 1000)})) self.logDebug("Returned Data: %s" % data) @@ -58,19 +49,9 @@ class RealdebridCom(MultiHoster): pyfile.size = parseFileSize(data['file_size']) self.link = data['generated_links'][0][-1] - if self.getConfig("ssl"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}): - #usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link")) - return super(RealdebridCom, self).checkFile() diff --git a/pyload/plugin/hoster/RehostTo.py b/pyload/plugin/hoster/RehostTo.py index 3e3e88c6c..36bdb54b5 100644 --- a/pyload/plugin/hoster/RehostTo.py +++ b/pyload/plugin/hoster/RehostTo.py @@ -11,6 +11,7 @@ class RehostTo(MultiHoster): __version__ = "0.21" __pattern__ = r'https?://.*rehost\.to\..+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rehost.com multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/RemixshareCom.py b/pyload/plugin/hoster/RemixshareCom.py index a1cd2a37e..1df62bbba 100644 --- a/pyload/plugin/hoster/RemixshareCom.py +++ b/pyload/plugin/hoster/RemixshareCom.py @@ -19,6 +19,7 @@ class RemixshareCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Remixshare.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/RgHostNet.py b/pyload/plugin/hoster/RgHostNet.py index d9e548721..2552b5091 100644 --- a/pyload/plugin/hoster/RgHostNet.py +++ b/pyload/plugin/hoster/RgHostNet.py @@ -11,6 +11,7 @@ class RgHostNet(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?rghost\.net/\d+(?:r=\d+)?' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """RgHost.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SendspaceCom.py b/pyload/plugin/hoster/SendspaceCom.py index 4d477579d..5faf2a870 100644 --- a/pyload/plugin/hoster/SendspaceCom.py +++ b/pyload/plugin/hoster/SendspaceCom.py @@ -11,6 +11,7 @@ class SendspaceCom(SimpleHoster): __version__ = "0.17" __pattern__ = r'https?://(?:www\.)?sendspace\.com/file/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Sendspace.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/Share76Com.py b/pyload/plugin/hoster/Share76Com.py index d460726f2..e826b4e2d 100644 --- a/pyload/plugin/hoster/Share76Com.py +++ b/pyload/plugin/hoster/Share76Com.py @@ -9,6 +9,7 @@ class Share76Com(DeadHoster): __version__ = "0.04" __pattern__ = r'http://(?:www\.)?share76\.com/\w{12}' + __config__ = [] __description__ = """Share76.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/ShareFilesCo.py b/pyload/plugin/hoster/ShareFilesCo.py index edd56572e..946b6a423 100644 --- a/pyload/plugin/hoster/ShareFilesCo.py +++ b/pyload/plugin/hoster/ShareFilesCo.py @@ -9,6 +9,7 @@ class ShareFilesCo(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?sharefiles\.co/\w{12}' + __config__ = [] __description__ = """Sharefiles.co hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SharebeesCom.py b/pyload/plugin/hoster/SharebeesCom.py index 54de21095..405fab050 100644 --- a/pyload/plugin/hoster/SharebeesCom.py +++ b/pyload/plugin/hoster/SharebeesCom.py @@ -9,6 +9,7 @@ class SharebeesCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?sharebees\.com/\w{12}' + __config__ = [] __description__ = """ShareBees hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/ShareonlineBiz.py b/pyload/plugin/hoster/ShareonlineBiz.py index f3be1aeb2..2d8b6d925 100644 --- a/pyload/plugin/hoster/ShareonlineBiz.py +++ b/pyload/plugin/hoster/ShareonlineBiz.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import time from urllib import unquote from urlparse import urlparse @@ -14,9 +14,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.48" + __version__ = "0.49" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Shareonline.biz hoster plugin""" __license__ = "GPLv3" @@ -74,7 +75,7 @@ class ShareonlineBiz(SimpleHoster): m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) - res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -108,7 +109,7 @@ class ShareonlineBiz(SimpleHoster): self.download(download_url) - def checkFile(self): + def checkFile(self, rules={}): check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), 'fail' : re.compile(r"<title>Share-Online")}) @@ -120,7 +121,7 @@ class ShareonlineBiz(SimpleHoster): self.invalidCaptcha() self.retry(5, 5 * 60, _("Download failed")) - return super(ShareonlineBiz, self).checkFile() + return super(ShareonlineBiz, self).checkFile(rules) def handlePremium(self, pyfile): #: should be working better loading (account) api internally diff --git a/pyload/plugin/hoster/SharingmatrixCom.py b/pyload/plugin/hoster/SharingmatrixCom.py index d1892be14..81c371c98 100644 --- a/pyload/plugin/hoster/SharingmatrixCom.py +++ b/pyload/plugin/hoster/SharingmatrixCom.py @@ -9,6 +9,7 @@ class SharingmatrixCom(DeadHoster): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' + __config__ = [] __description__ = """Sharingmatrix.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/ShragleCom.py b/pyload/plugin/hoster/ShragleCom.py index 628537108..7f06e2424 100644 --- a/pyload/plugin/hoster/ShragleCom.py +++ b/pyload/plugin/hoster/ShragleCom.py @@ -9,6 +9,7 @@ class ShragleCom(DeadHoster): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' + __config__ = [] __description__ = """Cloudnator.com (Shragle.com) hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SimplyPremiumCom.py b/pyload/plugin/hoster/SimplyPremiumCom.py index 50b278985..83640bcd5 100644 --- a/pyload/plugin/hoster/SimplyPremiumCom.py +++ b/pyload/plugin/hoster/SimplyPremiumCom.py @@ -2,8 +2,6 @@ import re -from datetime import datetime, timedelta - from pyload.plugin.internal.MultiHoster import MultiHoster from pyload.plugin.internal.SimpleHoster import secondsToMidnight @@ -14,6 +12,7 @@ class SimplyPremiumCom(MultiHoster): __version__ = "0.08" __pattern__ = r'https?://.+simply-premium\.com' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SimplydebridCom.py b/pyload/plugin/hoster/SimplydebridCom.py index 4b740ff20..0605bb4f3 100644 --- a/pyload/plugin/hoster/SimplydebridCom.py +++ b/pyload/plugin/hoster/SimplydebridCom.py @@ -8,9 +8,10 @@ from pyload.plugin.internal.MultiHoster import MultiHoster, replace_patterns class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.17" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Simply-debrid.com multi-hoster plugin""" __license__ = "GPLv3" @@ -24,7 +25,7 @@ class SimplydebridCom(MultiHoster): ("ul.to", "uploaded.net/file") ("uploaded.com", "uploaded.net") ("filerio.com", "filerio.in") - ("lumfile.com", "lumfile.se")] + ("lumfile.com", "lumfile.se")]) if 'fileparadox' in self.link: self.link = self.link.replace("http://", "https://") @@ -38,8 +39,8 @@ class SimplydebridCom(MultiHoster): self.wait(5) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({"error": "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) - return super(SimplydebridCom, self).checkFile() + return super(SimplydebridCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/SmoozedCom.py b/pyload/plugin/hoster/SmoozedCom.py index 715d99b40..b321fee03 100644 --- a/pyload/plugin/hoster/SmoozedCom.py +++ b/pyload/plugin/hoster/SmoozedCom.py @@ -7,9 +7,10 @@ from pyload.plugin.internal.MultiHoster import MultiHoster class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Smoozed.com hoster plugin""" __license__ = "GPLv3" @@ -55,9 +56,9 @@ class SmoozedCom(MultiHoster): self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({'error': '{"state":"error"}', 'retry': '{"state":"retry"}'}): self.fail(_("Error response received")) - return super(SmoozedCom, self).checkFile() + return super(SmoozedCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/SockshareCom.py b/pyload/plugin/hoster/SockshareCom.py index e903e3daf..3881278e1 100644 --- a/pyload/plugin/hoster/SockshareCom.py +++ b/pyload/plugin/hoster/SockshareCom.py @@ -9,6 +9,7 @@ class SockshareCom(DeadHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config__ = [] __description__ = """Sockshare.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SoundcloudCom.py b/pyload/plugin/hoster/SoundcloudCom.py index fd5d1ea6c..31aa7ba3c 100644 --- a/pyload/plugin/hoster/SoundcloudCom.py +++ b/pyload/plugin/hoster/SoundcloudCom.py @@ -1,57 +1,56 @@ # -*- coding: utf-8 -*- -import pycurl import re -from pyload.plugin.Hoster import Hoster +from module.plugin.internal.SimpleHoster import SimpleHoster +from module.common.json_layer import json_loads -class SoundcloudCom(Hoster): +class SoundcloudCom(SimpleHoster): __name__ = "SoundcloudCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" - __pattern__ = r'https?://(?:www\.)?soundcloud\.com/(?P<UID>.+?)/(?P<SID>.+)' + __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w-]+/[\w-]+' + __config__ = [("use_premium", "bool" , "Use premium account if available", True ), + ("quality" , "Lower;Higher", "Quality" , "Higher")] __description__ = """SoundCloud.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Peekayy", "peekayy.dev@gmail.com")] - - - def process(self, pyfile): - # default UserAgent of HTTPRequest fails for this hoster so we use this one - self.req.http.c.setopt(pycurl.USERAGENT, 'Mozilla/5.0') - self.html = self.load(pyfile.url) - m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', self.html) - songId = clientId = "" - if m: - songId = m.group('ID') - if len(songId) <= 0: - self.logError(_("Could not find song id")) - self.offline() - else: - m = re.search(r'"clientID":"(?P<CID>.*?)"', self.html) - if m: - clientId = m.group('CID') - - if len(clientId) <= 0: - clientId = "b45b1aa10f1ac2941910a7f0d10f8e28" - - m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', self.html) - if m: - pyfile.name = m.group('TITLE') + ".mp3" - else: - pyfile.name = re.match(self.__pattern__, pyfile.url).group('SID') + ".mp3" - - # url to retrieve the actual song url - self.html = self.load("https://api.sndcdn.com/i1/tracks/%s/streams" % songId, get={"client_id": clientId}) - # getting streams - # for now we choose the first stream found in all cases - # it could be improved if relevant for this hoster - streams = [ - (result.group('QUALITY'), result.group('URL')) - for result in re.finditer(r'"(?P<QUALITY>.*?)":"(?P<URL>.*?)"', self.html) - ] - self.logDebug("Found Streams", streams) - self.logDebug("Downloading", streams[0][0], streams[0][1]) - self.download(streams[0][1]) + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'title" content="(?P<N>.+?)"' + OFFLINE_PATTERN = r'<title>"SoundCloud - Hear the worldâs sounds"</title>' + + + def handleFree(self, pyfile): + try: + song_id = re.search(r'sounds:(\d+)"', self.html).group(1) + + except Exception: + self.error(_("Could not find song id")) + + try: + client_id = re.search(r'"clientID":"(.+?)"', self.html).group(1) + + except Exception: + client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" + + # url to retrieve the actual song url + streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, + get={'client_id': client_id})) + + regex = re.compile(r'[^\d]') + http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')], + key=lambda t: regex.sub(t[0], ''), + reverse=True) + + self.logDebug("Streams found: %s" % (http_streams or "None")) + + if http_streams: + stream_name, self.link = http_streams[0 if self.getConfig('quality') == "Higher" else -1] + pyfile.name += '.' + stream_name.split('_')[1].lower() + + +getInfo = create_getInfo(SoundcloudCom) diff --git a/pyload/plugin/hoster/SpeedLoadOrg.py b/pyload/plugin/hoster/SpeedLoadOrg.py index a20f87902..5642987d2 100644 --- a/pyload/plugin/hoster/SpeedLoadOrg.py +++ b/pyload/plugin/hoster/SpeedLoadOrg.py @@ -9,6 +9,7 @@ class SpeedLoadOrg(DeadHoster): __version__ = "1.02" __pattern__ = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' + __config__ = [] __description__ = """Speedload.org hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SpeedfileCz.py b/pyload/plugin/hoster/SpeedfileCz.py index 981ba861d..f9df09d08 100644 --- a/pyload/plugin/hoster/SpeedfileCz.py +++ b/pyload/plugin/hoster/SpeedfileCz.py @@ -9,6 +9,7 @@ class SpeedfileCz(DeadHoster): __version__ = "0.32" __pattern__ = r'http://(?:www\.)?speedfile\.cz/.+' + __config__ = [] __description__ = """Speedfile.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/SpeedyshareCom.py b/pyload/plugin/hoster/SpeedyshareCom.py index c92522d70..541e41b96 100644 --- a/pyload/plugin/hoster/SpeedyshareCom.py +++ b/pyload/plugin/hoster/SpeedyshareCom.py @@ -16,6 +16,7 @@ class SpeedyshareCom(SimpleHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Speedyshare.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/StorageTo.py b/pyload/plugin/hoster/StorageTo.py index 78b9a60bb..835666b45 100644 --- a/pyload/plugin/hoster/StorageTo.py +++ b/pyload/plugin/hoster/StorageTo.py @@ -9,6 +9,7 @@ class StorageTo(DeadHoster): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?storage\.to/get/.+' + __config__ = [] __description__ = """Storage.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/TurbobitNet.py b/pyload/plugin/hoster/TurbobitNet.py index c69158c39..e1c7eeee6 100644 --- a/pyload/plugin/hoster/TurbobitNet.py +++ b/pyload/plugin/hoster/TurbobitNet.py @@ -20,6 +20,7 @@ class TurbobitNet(SimpleHoster): __version__ = "0.19" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Turbobit.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/TurbouploadCom.py b/pyload/plugin/hoster/TurbouploadCom.py index e964d1365..20ae8bb04 100644 --- a/pyload/plugin/hoster/TurbouploadCom.py +++ b/pyload/plugin/hoster/TurbouploadCom.py @@ -9,6 +9,7 @@ class TurbouploadCom(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+)' + __config__ = [] __description__ = """Turboupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/TwoSharedCom.py b/pyload/plugin/hoster/TwoSharedCom.py index 8c6864414..854c46979 100644 --- a/pyload/plugin/hoster/TwoSharedCom.py +++ b/pyload/plugin/hoster/TwoSharedCom.py @@ -11,6 +11,7 @@ class TwoSharedCom(SimpleHoster): __version__ = "0.13" __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """2Shared.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UlozTo.py b/pyload/plugin/hoster/UlozTo.py index 0e4156ad0..fbbe21f3e 100644 --- a/pyload/plugin/hoster/UlozTo.py +++ b/pyload/plugin/hoster/UlozTo.py @@ -18,6 +18,7 @@ class UlozTo(SimpleHoster): __version__ = "1.04" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Uloz.to hoster plugin""" __license__ = "GPLv3" @@ -46,7 +47,7 @@ class UlozTo(SimpleHoster): def process(self, pyfile): pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url) - self.html = self.load(pyfile.url, decode=True, cookies=True) + self.html = self.load(pyfile.url, decode=True) if re.search(self.ADULT_PATTERN, self.html): self.logInfo(_("Adult content confirmation needed")) @@ -57,7 +58,7 @@ class UlozTo(SimpleHoster): token = m.group(1) self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, - post={"agree": "Confirm", "_token_": token}, cookies=True) + post={"agree": "Confirm", "_token_": token}) if self.PASSWD_PATTERN in self.html: password = self.getPassword() @@ -65,7 +66,7 @@ class UlozTo(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + password) self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, - post={"password": password, "password_send": 'Send'}, cookies=True) + post={"password": password, "password_send": 'Send'}) if self.PASSWD_PATTERN in self.html: self.fail(_("Incorrect password")) @@ -82,7 +83,7 @@ class UlozTo(SimpleHoster): else: self.handleFree(pyfile) - self.doCheckDownload() + self.checkFile() def handleFree(self, pyfile): @@ -117,14 +118,14 @@ class UlozTo(SimpleHoster): self.error(_("CAPTCHA form changed")) self.multiDL = True - self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) + self.download("http://www.ulozto.net" + action, post=inputs, disposition=True) def handlePremium(self, pyfile): self.download(pyfile.url, get={'do': "directDownload"}, disposition=True) - def doCheckDownload(self): + def checkFile(self, rules={}): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), "offline" : re.compile(self.OFFLINE_PATTERN), @@ -153,3 +154,5 @@ class UlozTo(SimpleHoster): elif check == "not_found": self.fail(_("Server error - file not downloadable")) + return super(UlozTo, self).checkFile(rules) + diff --git a/pyload/plugin/hoster/UloziskoSk.py b/pyload/plugin/hoster/UloziskoSk.py index ce40c9f7a..506ceecb1 100644 --- a/pyload/plugin/hoster/UloziskoSk.py +++ b/pyload/plugin/hoster/UloziskoSk.py @@ -11,6 +11,7 @@ class UloziskoSk(SimpleHoster): __version__ = "0.25" __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Ulozisko.sk hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UnibytesCom.py b/pyload/plugin/hoster/UnibytesCom.py index 2c9b9ca5f..a02d5b8c7 100644 --- a/pyload/plugin/hoster/UnibytesCom.py +++ b/pyload/plugin/hoster/UnibytesCom.py @@ -13,6 +13,7 @@ class UnibytesCom(SimpleHoster): __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """UniBytes.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UnrestrictLi.py b/pyload/plugin/hoster/UnrestrictLi.py index c81bb0554..fa77d15e8 100644 --- a/pyload/plugin/hoster/UnrestrictLi.py +++ b/pyload/plugin/hoster/UnrestrictLi.py @@ -10,9 +10,10 @@ from pyload.plugin.internal.SimpleHoster import secondsToMidnight class UnrestrictLi(MultiHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" @@ -67,10 +68,10 @@ class UnrestrictLi(MultiHoster): self.setNameSize() - def checkFile(self): - super(UnrestrictLi, self).checkFile() + def checkFile(self, rules={}): + super(UnrestrictLi, self).checkFile(rules) - if self.getConfig("history"): + if self.getConfig('history'): self.load("https://unrestrict.li/history/", get={'delete': "all"}) self.logInfo(_("Download history deleted")) diff --git a/pyload/plugin/hoster/UploadStationCom.py b/pyload/plugin/hoster/UploadStationCom.py index d77bdb760..decde08ab 100644 --- a/pyload/plugin/hoster/UploadStationCom.py +++ b/pyload/plugin/hoster/UploadStationCom.py @@ -9,6 +9,7 @@ class UploadStationCom(DeadHoster): __version__ = "0.52" __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' + __config__ = [] __description__ = """UploadStation.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UploadableCh.py b/pyload/plugin/hoster/UploadableCh.py index c54ecb495..af3022594 100644 --- a/pyload/plugin/hoster/UploadableCh.py +++ b/pyload/plugin/hoster/UploadableCh.py @@ -2,8 +2,6 @@ import re -from time import sleep - from pyload.plugin.captcha import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -11,9 +9,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Uploadable.ch hoster plugin""" __license__ = "GPLv3" @@ -35,13 +34,13 @@ class UploadableCh(SimpleHoster): def handleFree(self, pyfile): # Click the "free user" button and wait - a = self.load(pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) + a = self.load(pyfile.url, post={'downloadLink': "wait"}, decode=True) self.logDebug(a) self.wait(30) # Make the recaptcha appear and show it the pyload interface - b = self.load(pyfile.url, cookies=True, post={'checkDownload': "check"}, decode=True) + b = self.load(pyfile.url, post={'checkDownload': "check"}, decode=True) self.logDebug(b) #: Expected output: {"success":"showCaptcha"} recaptcha = ReCaptcha(self) @@ -50,7 +49,6 @@ class UploadableCh(SimpleHoster): # Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", - cookies=True, post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.info['pattern']['ID']}, @@ -59,18 +57,18 @@ class UploadableCh(SimpleHoster): self.wait(3) # Get ready for downloading - self.load(pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) + self.load(pyfile.url, post={'downloadLink': "show"}, decode=True) self.wait(3) # Download the file - self.download(pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) + self.download(pyfile.url, post={'download': "normal"}, disposition=True) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({'wait': re.compile("Please wait for")}): self.logInfo("Downloadlimit reached, please wait or reconnect") self.wait(60 * 60, True) self.retry() - return super(UploadableCh, self).checkFile() + return super(UploadableCh, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UploadboxCom.py b/pyload/plugin/hoster/UploadboxCom.py index 01e4c6854..33b81b97e 100644 --- a/pyload/plugin/hoster/UploadboxCom.py +++ b/pyload/plugin/hoster/UploadboxCom.py @@ -9,6 +9,7 @@ class UploadboxCom(DeadHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?uploadbox\.com/files/.+' + __config__ = [] __description__ = """UploadBox.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index f9b121bfe..165b29c7a 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import sleep +import time from pyload.network.RequestFactory import getURL from pyload.plugin.internal.CaptchaService import ReCaptcha @@ -12,9 +11,10 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.84" + __version__ = "0.85" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Uploaded.net hoster plugin""" __license__ = "GPLv3" @@ -48,7 +48,7 @@ class UploadedTo(SimpleHoster): info['status'] = 1 break else: - sleep(3) + time.sleep(3) return info @@ -109,9 +109,9 @@ class UploadedTo(SimpleHoster): self.checkErrors() - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): self.wait(3 * 60 * 60, True) self.retry() - return super(UploadedTo, self).checkFile() + return super(UploadedTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UploadhereCom.py b/pyload/plugin/hoster/UploadhereCom.py index 77970a97b..259b53dc1 100644 --- a/pyload/plugin/hoster/UploadhereCom.py +++ b/pyload/plugin/hoster/UploadhereCom.py @@ -9,6 +9,7 @@ class UploadhereCom(DeadHoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?uploadhere\.com/\w{10}' + __config__ = [] __description__ = """Uploadhere.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UploadheroCom.py b/pyload/plugin/hoster/UploadheroCom.py index 917053f18..2def499d9 100644 --- a/pyload/plugin/hoster/UploadheroCom.py +++ b/pyload/plugin/hoster/UploadheroCom.py @@ -5,15 +5,18 @@ import re +from urlparse import urljoin + from pyload.plugin.internal.SimpleHoster import SimpleHoster class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """UploadHero.co plugin""" __license__ = "GPLv3" @@ -21,53 +24,45 @@ class UploadheroCom(SimpleHoster): ("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>' - SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>' - OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.' + NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.+?)<' + SIZE_PATTERN = r'>Filesize: </span><strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<p class="titre_dl_2">' COOKIES = [("uploadhero.co", "lang", "en")] - IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.*?)"' - IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' + IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.+?)"' + IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"' - LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' - LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" id="downloadnow"' + LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(.+?)"|"(http://storage\d+\.uploadhero\.co.+?)"' + LINK_PREMIUM_PATTERN = r'<a href="(.+?)" id="downloadnow"' def handleFree(self, pyfile): - self.checkErrors() - m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.error(_("CAPTCHA_PATTERN not found")) - captcha_url = "http://uploadhero.co" + m.group(1) + self.error(_("Captcha not found")) - for _i in xrange(5): - captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(pyfile.url, get={"code": captcha}) - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.correctCaptcha() - download_url = m.group(1) or m.group(2) - break - else: - self.invalidCaptcha() - else: - self.fail(_("No valid captcha code entered")) + captcha = self.decryptCaptcha(urljoin("http://uploadhero.co", m.group(1))) - self.download(download_url) + self.html = self.load(pyfile.url, + get={"code": captcha}) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) or m.group(2) + self.wait(50) def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: - self.html = self.load("http://uploadhero.co%s" % m.group(1)) + self.html = self.load(urljoin("http://uploadhero.co", m.group(1))) m = re.search(self.IP_WAIT_PATTERN, self.html) wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60 self.wait(wait_time, True) self.retry() - self.info.pop('error', None) + return super(UploadheroCom, self).checkErrors() diff --git a/pyload/plugin/hoster/UploadkingCom.py b/pyload/plugin/hoster/UploadkingCom.py index 6f4374096..33ecfd574 100644 --- a/pyload/plugin/hoster/UploadkingCom.py +++ b/pyload/plugin/hoster/UploadkingCom.py @@ -9,6 +9,7 @@ class UploadkingCom(DeadHoster): __version__ = "0.14" __pattern__ = r'http://(?:www\.)?uploadking\.com/\w{10}' + __config__ = [] __description__ = """UploadKing.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UpstoreNet.py b/pyload/plugin/hoster/UpstoreNet.py index 98e5c0d64..20c207a70 100644 --- a/pyload/plugin/hoster/UpstoreNet.py +++ b/pyload/plugin/hoster/UpstoreNet.py @@ -12,6 +12,7 @@ class UpstoreNet(SimpleHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?upstore\.net/' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Upstore.Net File Download Hoster""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/UptoboxCom.py b/pyload/plugin/hoster/UptoboxCom.py index da93b3c6b..de23d4ad0 100644 --- a/pyload/plugin/hoster/UptoboxCom.py +++ b/pyload/plugin/hoster/UptoboxCom.py @@ -6,7 +6,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' @@ -15,8 +15,9 @@ class UptoboxCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' - OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' + INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' + OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' + TEMP_OFFLINE_PATTERN = r'>Service Unavailable' LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' diff --git a/pyload/plugin/hoster/VeehdCom.py b/pyload/plugin/hoster/VeehdCom.py index 91d7cc443..f9756662c 100644 --- a/pyload/plugin/hoster/VeehdCom.py +++ b/pyload/plugin/hoster/VeehdCom.py @@ -11,8 +11,8 @@ class VeehdCom(Hoster): __version__ = "0.23" __pattern__ = r'http://veehd\.com/video/\d+_\S+' - __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), - ("replacement_char", "str", "Filename replacement character", "_")] + __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), + ("replacement_char", "str", "Filename replacement character", "_")] __description__ = """Veehd.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/VeohCom.py b/pyload/plugin/hoster/VeohCom.py index a4394736d..0fa118355 100644 --- a/pyload/plugin/hoster/VeohCom.py +++ b/pyload/plugin/hoster/VeohCom.py @@ -11,7 +11,8 @@ class VeohCom(SimpleHoster): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' - __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] + __config__ = [("use_premium", "bool" , "Use premium account if available", True ), + ("quality" , "Low;High;Auto", "Quality" , "Auto")] __description__ = """Veoh.com hoster plugin""" __license__ = "GPLv3" @@ -33,7 +34,7 @@ class VeohCom(SimpleHoster): def handleFree(self, pyfile): - quality = self.getConfig("quality") + quality = self.getConfig('quality') if quality == "Auto": quality = ("High", "Low") diff --git a/pyload/plugin/hoster/VimeoCom.py b/pyload/plugin/hoster/VimeoCom.py index c48ad3414..fb6ea094a 100644 --- a/pyload/plugin/hoster/VimeoCom.py +++ b/pyload/plugin/hoster/VimeoCom.py @@ -11,8 +11,9 @@ class VimeoCom(SimpleHoster): __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' - __config__ = [("quality", "Lowest;Mobile;SD;HD;Highest", "Quality", "Highest"), - ("original", "bool", "Try to download the original file first", True)] + __config__ = [("use_premium", "bool" , "Use premium account if available" , True ), + ("quality" , "Lowest;Mobile;SD;HD;Highest", "Quality" , "Highest"), + ("original" , "bool" , "Try to download the original file", True )] __description__ = """Vimeo.com hoster plugin""" __license__ = "GPLv3" @@ -46,14 +47,14 @@ class VimeoCom(SimpleHoster): link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) - if self.getConfig("original"): + if self.getConfig('original'): if "original" in link: self.download(link[q]) return else: self.logInfo(_("Original file not downloadable")) - quality = self.getConfig("quality") + quality = self.getConfig('quality') if quality == "Highest": qlevel = ("hd", "sd", "mobile") elif quality == "Lowest": diff --git a/pyload/plugin/hoster/Vipleech4UCom.py b/pyload/plugin/hoster/Vipleech4UCom.py index 100def197..0550f5c77 100644 --- a/pyload/plugin/hoster/Vipleech4UCom.py +++ b/pyload/plugin/hoster/Vipleech4UCom.py @@ -9,6 +9,7 @@ class Vipleech4UCom(DeadHoster): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' + __config__ = [] __description__ = """Vipleech4u.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/WarserverCz.py b/pyload/plugin/hoster/WarserverCz.py index d44b751f9..bedda34a7 100644 --- a/pyload/plugin/hoster/WarserverCz.py +++ b/pyload/plugin/hoster/WarserverCz.py @@ -9,6 +9,7 @@ class WarserverCz(DeadHoster): __version__ = "0.13" __pattern__ = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' + __config__ = [] __description__ = """Warserver.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/WebshareCz.py b/pyload/plugin/hoster/WebshareCz.py index 58c9c6a44..baeecfc94 100644 --- a/pyload/plugin/hoster/WebshareCz.py +++ b/pyload/plugin/hoster/WebshareCz.py @@ -12,6 +12,7 @@ class WebshareCz(SimpleHoster): __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """WebShare.cz hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/WrzucTo.py b/pyload/plugin/hoster/WrzucTo.py index de78d7af2..88eb38789 100644 --- a/pyload/plugin/hoster/WrzucTo.py +++ b/pyload/plugin/hoster/WrzucTo.py @@ -13,6 +13,7 @@ class WrzucTo(SimpleHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Wrzuc.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/WuploadCom.py b/pyload/plugin/hoster/WuploadCom.py index 729db1d4d..0b4411a5b 100644 --- a/pyload/plugin/hoster/WuploadCom.py +++ b/pyload/plugin/hoster/WuploadCom.py @@ -9,6 +9,7 @@ class WuploadCom(DeadHoster): __version__ = "0.23" __pattern__ = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' + __config__ = [] __description__ = """Wupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/X7To.py b/pyload/plugin/hoster/X7To.py index ac01bc5ff..f8700ba67 100644 --- a/pyload/plugin/hoster/X7To.py +++ b/pyload/plugin/hoster/X7To.py @@ -9,6 +9,7 @@ class X7To(DeadHoster): __version__ = "0.41" __pattern__ = r'http://(?:www\.)?x7\.to/' + __config__ = [] __description__ = """X7.to hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/XFileSharingPro.py b/pyload/plugin/hoster/XFileSharingPro.py index 8b9f7fcfa..e90826536 100644 --- a/pyload/plugin/hoster/XFileSharingPro.py +++ b/pyload/plugin/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __pattern__ = r'^unmatchable$' @@ -34,9 +34,6 @@ class XFileSharingPro(XFSHoster): self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') - if self.HOSTER_NAME[0].isdigit(): - self.HOSTER_NAME = 'X' + self.HOSTER_NAME - account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): diff --git a/pyload/plugin/hoster/XHamsterCom.py b/pyload/plugin/hoster/XHamsterCom.py index 92340152f..73944a61b 100644 --- a/pyload/plugin/hoster/XHamsterCom.py +++ b/pyload/plugin/hoster/XHamsterCom.py @@ -22,7 +22,7 @@ class XHamsterCom(Hoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?xhamster\.com/movies/.+' - __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] + __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] __description__ = """XHamster.com hoster plugin""" __license__ = "GPLv3" @@ -35,8 +35,8 @@ class XHamsterCom(Hoster): if not self.file_exists(): self.offline() - if self.getConfig("type"): - self.desired_fmt = self.getConfig("type") + if self.getConfig('type'): + self.desired_fmt = self.getConfig('type') pyfile.name = self.get_file_name() + self.desired_fmt self.download(self.get_file_url()) diff --git a/pyload/plugin/hoster/XdadevelopersCom.py b/pyload/plugin/hoster/XdadevelopersCom.py index 386973a94..8ef79657f 100644 --- a/pyload/plugin/hoster/XdadevelopersCom.py +++ b/pyload/plugin/hoster/XdadevelopersCom.py @@ -14,6 +14,7 @@ class XdadevelopersCom(SimpleHoster): __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?forum\.xda-developers\.com/devdb/project/dl/\?id=\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Xda-developers.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index b9aa45419..10d50369f 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/hoster/Xdcc.py @@ -4,11 +4,11 @@ import re import socket import struct import sys +import time from os import makedirs from os.path import exists, join from select import select -from time import time from pyload.plugin.Hoster import Hoster from pyload.utils import fs_join @@ -84,12 +84,12 @@ class Xdcc(Hoster): ####################### # CONNECT TO IRC AND IDLE FOR REAL LINK - dl_time = time() + dl_time = time.time() sock = socket.socket() sock.connect((host, int(port))) if nick == "pyload": - nick = "pyload-%d" % (time() % 1000) # last 3 digits + nick = "pyload-%d" % (time.time() % 1000) # last 3 digits sock.send("NICK %s\r\n" % nick) sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) @@ -111,13 +111,13 @@ class Xdcc(Hoster): break if retry: - if time() > retry: + if time.time() > retry: retry = None - dl_time = time() + dl_time = time.time() sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) else: - if (dl_time + self.timeout) < time(): # todo: add in config + if (dl_time + self.timeout) < time.time(): # todo: add in config sock.send("QUIT :byebye\r\n") sock.close() self.fail(_("XDCC Bot did not answer")) @@ -159,7 +159,7 @@ class Xdcc(Hoster): sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME") - sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time())) + sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer @@ -172,7 +172,7 @@ class Xdcc(Hoster): print "%s: %s" % (msg['origin'], msg['text']) if "You already requested that pack" in msg['text']: - retry = time() + 300 + retry = time.time() + 300 if "you must be on a known channel to request a pack" in msg['text']: self.fail(_("Wrong channel")) diff --git a/pyload/plugin/hoster/YibaishiwuCom.py b/pyload/plugin/hoster/YibaishiwuCom.py index a53acdaf5..9f90dbe5e 100644 --- a/pyload/plugin/hoster/YibaishiwuCom.py +++ b/pyload/plugin/hoster/YibaishiwuCom.py @@ -12,6 +12,7 @@ class YibaishiwuCom(SimpleHoster): __version__ = "0.14" __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """115.com hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/YoutubeCom.py b/pyload/plugin/hoster/YoutubeCom.py index bf8785022..260b1ba3d 100644 --- a/pyload/plugin/hoster/YoutubeCom.py +++ b/pyload/plugin/hoster/YoutubeCom.py @@ -36,13 +36,13 @@ class YoutubeCom(Hoster): __version__ = "0.41" __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' - __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 ), - (".flv" , "bool" , "Allow .flv" , True ), - (".webm" , "bool" , "Allow .webm" , False), - (".3gp" , "bool" , "Allow .3gp" , False), - ("3d" , "bool" , "Prefer 3D" , False)] + __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 ), + (".flv" , "bool" , "Allow .flv" , True ), + (".webm" , "bool" , "Allow .webm" , False), + (".3gp" , "bool" , "Allow .3gp" , False), + ("3d" , "bool" , "Prefer 3D" , False)] __description__ = """Youtube.com hoster plugin""" __license__ = "GPLv3" @@ -95,7 +95,7 @@ class YoutubeCom(Hoster): self.tempOffline() #get config - use3d = self.getConfig("3d") + use3d = self.getConfig('3d') if use3d: quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, @@ -104,10 +104,10 @@ class YoutubeCom(Hoster): quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} - desired_fmt = self.getConfig("fmt") + desired_fmt = self.getConfig('fmt') if not desired_fmt: - desired_fmt = quality.get(self.getConfig("quality"), 18) + desired_fmt = quality.get(self.getConfig('quality'), 18) elif desired_fmt not in self.formats: self.logWarning(_("FMT %d unknown, using default") % desired_fmt) diff --git a/pyload/plugin/hoster/ZShareNet.py b/pyload/plugin/hoster/ZShareNet.py index 12c65b206..fb02370f5 100644 --- a/pyload/plugin/hoster/ZShareNet.py +++ b/pyload/plugin/hoster/ZShareNet.py @@ -9,6 +9,7 @@ class ZShareNet(DeadHoster): __version__ = "0.21" __pattern__ = r'https?://(?:ww[2w]\.)?zshares?\.net/.+' + __config__ = [] __description__ = """ZShare.net hoster plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/hoster/ZeveraCom.py b/pyload/plugin/hoster/ZeveraCom.py index 264a62a7d..96bbf3455 100644 --- a/pyload/plugin/hoster/ZeveraCom.py +++ b/pyload/plugin/hoster/ZeveraCom.py @@ -10,9 +10,10 @@ from pyload.plugin.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Zevera.com multi-hoster plugin""" __license__ = "GPLv3" @@ -24,8 +25,8 @@ class ZeveraCom(MultiHoster): self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): self.fail(_("Error response received")) - return super(ZeveraCom, self).checkFile() + return super(ZeveraCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py index f52d90b8b..784eccb68 100644 --- a/pyload/plugin/hoster/ZippyshareCom.py +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -2,6 +2,8 @@ import re +from BeautifulSoup import BeautifulSoup + from pyload.plugin.internal.CaptchaService import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -9,22 +11,24 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.73" + __version__ = "0.77" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Zippyshare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("sebdelsol", "seb.morin@gmail.com")] COOKIES = [("zippyshare.com", "ziplocale", "en")] - NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' + NAME_PATTERN = r'("/|<title>Zippyshare.com - )(?P<N>[^/]+?)("\);|</title>)' SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'>File does not exist on this server' + OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' - LINK_PREMIUM_PATTERN = r'document.location = \'(.+?)\'' + LINK_PREMIUM_PATTERN = r"document.location = '(.+?)'" def setup(self): @@ -46,17 +50,38 @@ class ZippyshareCom(SimpleHoster): self.error(e) else: - self.link = '/'.join(("d", self.info['pattern']['KEY'], str(self.get_checksum()), self.pyfile.name)) + self.link = self.get_link() - def get_checksum(self): - try: - b1 = eval(re.search(r'\.omg = (.+?);', self.html).group(1)) - b2 = eval(re.search(r'\* \((.+?)\)', self.html).group(1)) - checksum = b1 * b2 + 18 + def get_link(self): + # get all the scripts inside the html body + soup = BeautifulSoup(self.html) + scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) - except Exception: - self.error(_("Unable to calculate checksum")) + # meant to be populated with the initialization of all the DOM elements found in the scripts + initScripts = set() - else: - return checksum + def replElementById(element): + id = element.group(1) # id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) # attr might be None + + varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) + + realid = id.strip('"\'') + if id != realid: #id is not a variable, so look for realid.attr in the html + initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) + initValue = '"%s"' % initValues[-1] if initValues else 'null' + initScripts.add('%s = %s;' % (varName, initValue)) + + return varName + + # handle all getElementById + reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' + scripts = [re.sub(reVar, replElementById, script) for script in scripts if script] + + # add try/catch in JS to handle deliberate errors + scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] + + # get the file's url by evaluating all the scripts + scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] + return self.js.eval('\n'.join(scripts)) diff --git a/pyload/plugin/internal/BasePlugin.py b/pyload/plugin/internal/BasePlugin.py index 103e0d5cb..ed4da72a1 100644 --- a/pyload/plugin/internal/BasePlugin.py +++ b/pyload/plugin/internal/BasePlugin.py @@ -6,14 +6,14 @@ from urllib import unquote from urlparse import urljoin, urlparse from pyload.network.HTTPRequest import BadHeader -from pyload.plugin.internal.SimpleHoster import fileUrl +from pyload.plugin.internal.SimpleHoster import create_getInfo, getFileURL from pyload.plugin.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.38" __pattern__ = r'^unmatchable$' @@ -51,7 +51,7 @@ class BasePlugin(Hoster): for _i in xrange(5): try: - link = fileUrl(self, unquote(pyfile.url)) + link = getFileURL(self, unquote(pyfile.url)) if link: self.download(link, ref=False, disposition=True) @@ -85,8 +85,20 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - check = self.checkDownload({'empty file': re.compile(r'\A\Z'), - 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')}) - if check: - self.fail(check.capitalize()) + errmsg = self.checkDownload({'Empty file' : re.compile(r'\A\s*\Z'), + 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), + 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'Request error': re.compile(r'([Aa]n error occured while processing your request)')}) + if not errmsg: + return + + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass + + self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) + + +getInfo = create_getInfo(BasePlugin) diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py index 2beccfcc5..d43956691 100644 --- a/pyload/plugin/internal/MultiHook.py +++ b/pyload/plugin/internal/MultiHook.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import sleep +import time from pyload.plugin.Hook import Hook from pyload.utils import decode, remove_chars @@ -11,28 +10,22 @@ from pyload.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.37" + __version__ = "0.40" - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org"), + __authors__ = [("pyLoad Team" , "admin@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 1 * 60 * 60 + MIN_RELOAD_INTERVAL = 1 * 60 * 60 #: 1 hour DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), - (r'1fichier\.com' , "onefichier.com" ), - (r'2shared\.com' , "twoshared.com" ), - (r'4shared\.com' , "fourshared.com" ), (r'bayfiles\.net' , "bayfiles.com" ), (r'cloudnator\.com' , "shragle.com" ), (r'dfiles\.eu' , "depositfiles.com" ), @@ -48,10 +41,21 @@ class MultiHook(Hook): (r'uploaded\.net' , "uploaded.to" ), (r'uploadhero\.co' , "uploadhero.com" ), (r'zshares\.net' , "zshare.net" ), - (r'(\d+.+)' , "X\1" )] + (r'^1' , "one" ), + (r'^2' , "two" ), + (r'^3' , "three" ), + (r'^4' , "four" ), + (r'^5' , "five" ), + (r'^6' , "six" ), + (r'^7' , "seven" ), + (r'^8' , "eight" ), + (r'^9' , "nine" ), + (r'^0' , "zero" )] def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + self.plugins = [] self.supported = [] self.new_supported = [] @@ -106,7 +110,7 @@ class MultiHook(Hook): return rep - def getConfig(self, option, default=''): + def getConfig(self, option, default=''): #@TODO: Remove in 0.4.10 """getConfig with default value - sublass may not implements all config options""" try: return self.getConf(option) @@ -119,17 +123,17 @@ class MultiHook(Hook): if self.plugins: return self.plugins - for _i in xrange(3): + for _i in xrange(2): try: pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) + break except Exception, e: - self.logError(e, "Waiting 1 minute and retry") - sleep(60) - - else: - break + self.logDebug(e, "Waiting 1 minute and retry") + time.sleep(60) else: + self.logWarning(_("Fallback to default reload interval due plugin parse error")) + self.interval = self.MIN_RELOAD_INTERVAL return list() try: @@ -152,17 +156,15 @@ class MultiHook(Hook): def _pluginSet(self, plugins): - plugins = set((decode(x).strip().lower() for x in plugins if '.' in x)) + regexp = re.compile(r'^[\w\-.^_]{3,63}\.[a-zA-Z]{2,}$', re.U) + plugins = [decode(p.strip()).lower() for p in plugins if regexp.match(p.strip())] - for rf, rt in self.DOMAIN_REPLACEMENTS: - regex = re.compile(rf) - for p in filter(lambda x: regex.match(x), plugins): - plugins.remove(p) - plugins.add(re.sub(rf, rt, p)) + for r in self.DOMAIN_REPLACEMENTS: + rf, rt = r + repr = re.compile(rf, re.I|re.U) + plugins = [re.sub(rf, rt, p) if repr.match(p) else p for p in plugins] - plugins.discard('') - - return plugins + return set(plugins) def getHosters(self): @@ -181,8 +183,28 @@ class MultiHook(Hook): raise NotImplementedError + #: Threaded _periodical, remove in 0.4.10 and use built-in flag for that + def _periodical(self): + try: + if self.isActivated(): + self.periodical() + + except Exception, e: + self.core.log.error(_("Error executing hooks: %s") % str(e)) + if self.core.debug: + print_exc() + + self.cb = self.core.scheduler.addJob(self.interval, self._periodical) + + def periodical(self): """reload plugin list periodically""" + if self.getConfig("reload", True): + self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_RELOAD_INTERVAL) + else: + self.core.scheduler.removeJob(self.cb) + self.cb = None + self.logInfo(_("Reloading supported %s list") % self.plugintype) old_supported = self.supported @@ -200,12 +222,6 @@ class MultiHook(Hook): for plugin in old_supported: self.unloadPlugin(plugin) - if self.getConfig("reload", True): - self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_INTERVAL) - else: - self.core.scheduler.removeJob(self.cb) - self.cb = None - def overridePlugins(self): excludedList = [] @@ -249,7 +265,7 @@ class MultiHook(Hook): self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp - regexp = r'.*(?P<DOMAIN>%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) + regexp = r'.*(?P<DOMAIN>%s).*' % "|".join(x.replace('.', '\.') for x in plugins) if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) @@ -263,11 +279,11 @@ class MultiHook(Hook): def unloadPlugin(self, plugin): hdict = self.core.pluginManager.plugins[self.plugintype][plugin] if "module" in hdict: - del hdict['module'] + hdict.pop('module', None) if "new_module" in hdict: - del hdict['new_module'] - del hdict['new_name'] + hdict.pop('new_module', None) + hdict.pop('new_name', None) def deactivate(self): @@ -280,29 +296,3 @@ class MultiHook(Hook): hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') hdict['re'] = re.compile(hdict['pattern']) - - - def downloadFailed(self, pyfile): - """remove plugin override if download fails but not if file is offline/temp.offline""" - if pyfile.status != 8 or not self.getConfig("revertfailed", True): - return - - hdict = self.core.pluginManager.plugins[self.plugintype][pyfile.pluginname] - if "new_name" in hdict and hdict['new_name'] == self.pluginname: - if pyfile.error == "MultiHook": - self.logDebug("Unload MultiHook", pyfile.pluginname, hdict) - self.unloadPlugin(pyfile.pluginname) - pyfile.setStatus("queued") - pyfile.sync() - else: - retries = max(self.getConfig("retry", 10), 0) - wait_time = max(self.getConfig("retryinterval", 1), 0) - - if 0 < retries > pyfile.plugin.retries: - self.logInfo(_("Retrying: %s") % pyfile.name) - pyfile.setCustomStatus("MultiHook", "queued") - pyfile.sync() - - pyfile.plugin.retries += 1 - pyfile.plugin.setWait(wait_time) - pyfile.plugin.wait() diff --git a/pyload/plugin/internal/MultiHoster.py b/pyload/plugin/internal/MultiHoster.py index ed425ffaa..036570805 100644 --- a/pyload/plugin/internal/MultiHoster.py +++ b/pyload/plugin/internal/MultiHoster.py @@ -2,15 +2,18 @@ import re +from pyload.plugin.Plugin import Fail, Retry from pyload.plugin.internal.SimpleHoster import SimpleHoster, replace_patterns, set_cookies class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.39" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Multi hoster plugin""" __license__ = "GPLv3" @@ -32,6 +35,9 @@ class MultiHoster(SimpleHoster): self.link = "" #@TODO: Move to hoster class in 0.4.10 self.directDL = False #@TODO: Move to hoster class in 0.4.10 + if not self.getConfig('use_premium', True): + self.retryFree() + if self.LOGIN_ACCOUNT and not self.account: self.fail(_("Required account not found")) @@ -49,29 +55,54 @@ class MultiHoster(SimpleHoster): def process(self, pyfile): - self.prepare() + try: + self.prepare() + + if self.directDL: + self.checkInfo() + self.logDebug("Looking for direct download link...") + self.handleDirect(pyfile) + + if not self.link and not self.lastDownload: + self.preload() + + self.checkErrors() + self.checkStatus(getinfo=False) + + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as premium download") + self.handlePremium(pyfile) + + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as free download") + self.handleFree(pyfile) + + self.downloadLink(self.link, True) + self.checkFile() + + except Fail, e: #@TODO: Move to PluginThread in 0.4.10 + if self.premium: + self.logWarning(_("Premium download failed")) + self.retryFree() - if self.directDL: - self.checkInfo() - self.logDebug("Looking for direct download link...") - self.handleDirect(pyfile) + elif self.getConfig("revertfailed", True) \ + and "new_module" in self.core.pluginManager.hosterPlugins[self.__name__]: + hdict = self.core.pluginManager.hosterPlugins[self.__name__] - if not self.link and not self.lastDownload: - self.preload() + tmp_module = hdict['new_module'] + tmp_name = hdict['new_name'] + hdict.pop('new_module', None) + hdict.pop('new_name', None) - self.checkErrors() - self.checkStatus(getinfo=False) + pyfile.initPlugin() - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as premium download") - self.handlePremium(pyfile) + hdict['new_module'] = tmp_module + hdict['new_name'] = tmp_name - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as free download") - self.handleFree(pyfile) + raise Retry(_("Revert to original hoster plugin")) - self.downloadLink(self.link, True) - self.checkFile() + else: + raise Fail(e) def handlePremium(self, pyfile): diff --git a/pyload/plugin/internal/SimpleCrypter.py b/pyload/plugin/internal/SimpleCrypter.py index e4b8874f3..472488268 100644 --- a/pyload/plugin/internal/SimpleCrypter.py +++ b/pyload/plugin/internal/SimpleCrypter.py @@ -15,14 +15,12 @@ class SimpleCrypter(Crypter, SimpleHoster): __version__ = "0.43" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Simple decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] """ diff --git a/pyload/plugin/internal/SimpleDereferer.py b/pyload/plugin/internal/SimpleDereferer.py index 6d323b4b0..e24a7b836 100644 --- a/pyload/plugin/internal/SimpleDereferer.py +++ b/pyload/plugin/internal/SimpleDereferer.py @@ -5,17 +5,17 @@ import re from urllib import unquote from pyload.plugin.Crypter import Crypter -from pyload.plugin.internal.SimpleHoster import fileUrl, set_cookies +from pyload.plugin.internal.SimpleHoster import getFileURL, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Simple dereferer plugin""" __license__ = "GPLv3" @@ -45,7 +45,7 @@ class SimpleDereferer(Crypter): def decrypt(self, pyfile): - link = fileUrl(self, pyfile.url) + link = getFileURL(self, pyfile.url) if not link: try: diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index ac7f5aa4d..75f54c767 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- +import datetime import mimetypes import os import re +import time -from datetime import datetime, timedelta from inspect import isclass -from time import time from urllib import unquote from urlparse import urljoin, urlparse @@ -15,7 +15,7 @@ from pyload.network.CookieJar import CookieJar from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL from pyload.plugin.Hoster import Hoster -from pyload.plugin.Plugin import Fail +from pyload.plugin.Plugin import Fail, Retry from pyload.utils import fixup, fs_encode, parseFileSize @@ -137,27 +137,27 @@ def parseFileInfo(plugin, url="", html=""): def timestamp(): - return int(time() * 1000) + return int(time.time() * 1000) #@TODO: Move to hoster class in 0.4.10 -def fileUrl(self, url, follow_location=None): +def getFileURL(self, url, follow_location=None): link = "" redirect = 1 if type(follow_location) is int: redirect = max(follow_location, 1) else: - redirect = 5 + redirect = 10 for i in xrange(redirect): try: self.logDebug("Redirect #%d to: %s" % (i, url)) - header = self.load(url, ref=True, cookies=True, just_header=True, decode=True) + header = self.load(url, just_header=True, decode=True) except Exception: #: Bad bad bad... req = pyreq.getHTTPRequest() - res = req.load(url, cookies=True, just_header=True, decode=True) + res = req.load(url, just_header=True, decode=True) req.close() @@ -226,18 +226,18 @@ def fileUrl(self, url, follow_location=None): def secondsToMidnight(gmt=0): - now = datetime.utcnow() + timedelta(hours=gmt) + now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt) if now.hour is 0 and now.minute < 10: midnight = now else: - midnight = now + timedelta(days=1) + midnight = now + datetime.timedelta(days=1) td = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - now if hasattr(td, 'total_seconds'): res = td.total_seconds() - else: #@NOTE: work-around for python 2.5 and 2.6 missing timedelta.total_seconds + else: #: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 return int(res) @@ -246,15 +246,14 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.15" + __version__ = "1.31" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Simple hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] """ @@ -311,7 +310,7 @@ class SimpleHoster(Hoster): LOGIN_ACCOUNT = False #: Set to True to require account login DISPOSITION = True #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 - directLink = fileUrl #@TODO: Remove in 0.4.10 + directLink = getFileURL #@TODO: Remove in 0.4.10 @classmethod @@ -349,7 +348,7 @@ class SimpleHoster(Hoster): info['error'] = "missing url" info['status'] = 1 - elif info['status'] is 3 and not fileUrl(None, url): + elif info['status'] is 3 and not getFileURL(None, url): try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -426,6 +425,9 @@ class SimpleHoster(Hoster): self.directDL = False #@TODO: Move to hoster class in 0.4.10 self.multihost = False #@TODO: Move to hoster class in 0.4.10 + if not self.getConfig('use_premium', True): + self.retryFree() + if self.LOGIN_ACCOUNT and not self.account: self.fail(_("Required account not found")) @@ -456,35 +458,43 @@ class SimpleHoster(Hoster): def process(self, pyfile): - self.prepare() - self.checkInfo() + try: + self.prepare() + self.checkInfo() - if self.directDL: - self.logDebug("Looking for direct download link...") - self.handleDirect(pyfile) + if self.directDL: + self.logDebug("Looking for direct download link...") + self.handleDirect(pyfile) - if self.multihost and not self.link and not self.lastDownload: - self.logDebug("Looking for leeched download link...") - self.handleMulti(pyfile) + if self.multihost and not self.link and not self.lastDownload: + self.logDebug("Looking for leeched download link...") + self.handleMulti(pyfile) + + if not self.link and not self.lastDownload: + self.MULTI_HOSTER = False + self.retry(1, reason="Multi hoster fails") if not self.link and not self.lastDownload: - self.MULTI_HOSTER = False - self.retry(1, reason="Multi hoster fails") + self.preload() + self.checkInfo() - if not self.link and not self.lastDownload: - self.preload() - self.checkInfo() + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as premium download") + self.handlePremium(pyfile) - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as premium download") - self.handlePremium(pyfile) + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as free download") + self.handleFree(pyfile) - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as free download") - self.handleFree(pyfile) + self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 + self.checkFile() - self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 - self.checkFile() + except Fail, e: #@TODO: Move to PluginThread in 0.4.10 + if self.premium: + self.logWarning(_("Premium download failed")) + self.retryFree() + else: + raise Fail(e) def downloadLink(self, link, disposition=True): @@ -499,7 +509,7 @@ class SimpleHoster(Hoster): self.download(link, ref=False, disposition=disposition) - def checkFile(self): + def checkFile(self, rules={}): if self.cTask and not self.lastDownload: self.invalidCaptcha() self.retry(10, reason=_("Wrong captcha")) @@ -509,21 +519,35 @@ class SimpleHoster(Hoster): self.error(self.pyfile.error or _("No file downloaded")) else: - rules = {'empty file': re.compile(r'\A\Z'), - 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')} + errmsg = self.checkDownload({'Empty file': re.compile(r'\A\s*\Z'), + 'Html error': re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)')}) - if hasattr(self, 'ERROR_PATTERN'): - rules['error'] = re.compile(self.ERROR_PATTERN) + if not errmsg: + for r, p in [('Html file' , re.compile(r'\A\s*<!DOCTYPE html') ), + ('Request error', re.compile(r'([Aa]n error occured while processing your request)'))]: + if r not in rules: + rules[r] = p - check = self.checkDownload(rules) - if check: #@TODO: Move to hoster in 0.4.10 - errmsg = check.strip().capitalize() - if self.lastCheck: - errmsg += " | " + self.lastCheck.group(0).strip() + for r, a in [('Error' , "ERROR_PATTERN" ), + ('Premium only', "PREMIUM_ONLY_PATTERN"), + ('Wait error' , "WAIT_PATTERN" )]: + if r not in rules and hasattr(self, a): + rules[r] = getattr(self, a) - self.lastDownload = "" - self.retry(10, 60, errmsg) + errmsg = self.checkDownload(rules) + + if not errmsg: + return + + errmsg = errmsg.strip().capitalize() + + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass + + self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) def checkErrors(self): @@ -537,16 +561,36 @@ class SimpleHoster(Hoster): elif hasattr(self, 'ERROR_PATTERN'): m = re.search(self.ERROR_PATTERN, self.html) if m: - errmsg = self.info['error'] = m.group(1) - self.error(errmsg) + try: + errmsg = m.group(1).strip() + except Exception: + errmsg = m.group(0).strip() + + self.info['error'] = errmsg + + if "hour" in errmsg: + self.wait(1 * 60 * 60, True) + + elif re.search("da(il)?y|today", errmsg): + self.wait(secondsToMidnight(gmt=2), True) + + elif "minute" in errmsg: + self.wait(1 * 60) + + else: + self.error(errmsg) elif hasattr(self, 'WAIT_PATTERN'): m = re.search(self.WAIT_PATTERN, self.html) if m: + try: + waitmsg = m.group(1).strip() + except Exception: + waitmsg = m.group(0).strip() + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) + re.findall(r'(\d+)\s*(hr|hour|min|sec)', waitmsg, re.I)) self.wait(wait_time, wait_time > 300) - return self.info.pop('error', None) @@ -692,6 +736,25 @@ class SimpleHoster(Hoster): return size <= traffic + def getConfig(self, option, default=''): #@TODO: Remove in 0.4.10 + """getConfig with default value - sublass may not implements all config options""" + try: + return self.getConf(option) + + except KeyError: + return default + + + def retryFree(self): + if not self.premium: + return + self.premium = False + self.account = None + self.req = self.core.requestFactory.getRequest(self.__name__) + self.retries = 0 + raise Retry(_("Fallback to free download")) + + #@TODO: Remove in 0.4.10 def wait(self, seconds=0, reconnect=None): return _wait(self, seconds, reconnect) diff --git a/pyload/plugin/internal/XFSAccount.py b/pyload/plugin/internal/XFSAccount.py index 2e6b7dc50..1f2d2b180 100644 --- a/pyload/plugin/internal/XFSAccount.py +++ b/pyload/plugin/internal/XFSAccount.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import gmtime, mktime, strptime from urlparse import urljoin from pyload.plugin.Account import Account @@ -16,8 +16,8 @@ class XFSAccount(Account): __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] HOSTER_DOMAIN = None @@ -75,7 +75,7 @@ class XFSAccount(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%d %B %Y")) + validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) @@ -83,7 +83,7 @@ class XFSAccount(Account): else: self.logDebug("Valid until: %s" % validuntil) - if validuntil > mktime(gmtime()): + if validuntil > time.mktime(time.gmtime()): premium = True trafficleft = -1 else: diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py index b0a5aff0f..fc48d6229 100644 --- a/pyload/plugin/internal/XFSHoster.py +++ b/pyload/plugin/internal/XFSHoster.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import re +import time from random import random -from time import sleep from urlparse import urljoin, urlparse from pyload.plugin.internal.captcha import ReCaptcha, SolveMedia @@ -14,15 +14,15 @@ from pyload.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __pattern__ = r'^unmatchable$' __description__ = """XFileSharing hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("stickell" , "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com" )] HOSTER_DOMAIN = None @@ -99,7 +99,7 @@ class XFSHoster(SimpleHoster): data = self.getPostParameters() - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True, follow_location=False) + self.html = self.load(pyfile.url, post=data, ref=True, decode=True, follow_location=False) m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m and not "op=" in m.group(1): @@ -189,7 +189,7 @@ class XFSHoster(SimpleHoster): if 'wait' in self.errmsg: wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I)) - self.wait(wait_time, True) + self.wait(wait_time, wait_time > 300) elif 'country' in self.errmsg: self.fail(_("Downloads are disabled for your country")) diff --git a/pyload/plugin/ocr/GigasizeCom.py b/pyload/plugin/ocr/GigasizeCom.py index 6982e6ca9..efa513a7e 100644 --- a/pyload/plugin/ocr/GigasizeCom.py +++ b/pyload/plugin/ocr/GigasizeCom.py @@ -6,7 +6,7 @@ from pyload.plugin.OCR import OCR class GigasizeCom(OCR): __name__ = "GigasizeCom" __type__ = "ocr" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Gigasize.com ocr plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/ocr/LinksaveIn.py b/pyload/plugin/ocr/LinksaveIn.py index 7ced74f4b..ddffb190a 100644 --- a/pyload/plugin/ocr/LinksaveIn.py +++ b/pyload/plugin/ocr/LinksaveIn.py @@ -15,7 +15,7 @@ from pyload.plugin.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Linksave.in ocr plugin""" __license__ = "GPLv3" @@ -46,7 +46,7 @@ class LinksaveIn(OCR): pix = frame.load() for x in xrange(frame.size[0]): for y in xrange(frame.size[1]): - if lut[pix[x, y]] != (0,0,0): + if lut[pix[x, y]] != (0, 0, 0): npix[x, y] = lut[pix[x, y]] frame_nr += 1 new.save(self.data_dir+"unblacked.png") @@ -112,7 +112,7 @@ class LinksaveIn(OCR): rgb_bg = bglut[bgpix[x, y]] rgb_c = lut[pix[x, y]] if rgb_c == rgb_bg: - orgpix[x, y] = (255,255,255) + orgpix[x, y] = (255, 255, 255) def eval_black_white(self): @@ -126,13 +126,13 @@ class LinksaveIn(OCR): r, g, b = rgb pix[x, y] = (255,255,255) if r > max(b, g)+thresh: - pix[x, y] = (0,0,0) + pix[x, y] = (0, 0, 0) if g < min(r, b): - pix[x, y] = (0,0,0) + pix[x, y] = (0, 0, 0) if g > max(r, b)+thresh: - pix[x, y] = (0,0,0) + pix[x, y] = (0, 0, 0) if b > max(r, g)+thresh: - pix[x, y] = (0,0,0) + pix[x, y] = (0, 0, 0) self.image = new self.pixels = self.image.load() diff --git a/pyload/plugin/ocr/NetloadIn.py b/pyload/plugin/ocr/NetloadIn.py index 8939b5318..bc5c4d882 100644 --- a/pyload/plugin/ocr/NetloadIn.py +++ b/pyload/plugin/ocr/NetloadIn.py @@ -6,7 +6,7 @@ from pyload.plugin.OCR import OCR class NetloadIn(OCR): __name__ = "NetloadIn" __type__ = "ocr" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Netload.in ocr plugin""" __license__ = "GPLv3" diff --git a/pyload/plugin/ocr/ShareonlineBiz.py b/pyload/plugin/ocr/ShareonlineBiz.py index bbc3d1762..dc0894d4f 100644 --- a/pyload/plugin/ocr/ShareonlineBiz.py +++ b/pyload/plugin/ocr/ShareonlineBiz.py @@ -6,7 +6,7 @@ from pyload.plugin.OCR import OCR class ShareonlineBiz(OCR): __name__ = "ShareonlineBiz" __type__ = "ocr" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Shareonline.biz ocr plugin""" __license__ = "GPLv3" |