diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-27 01:38:32 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-27 01:38:32 +0200 |
commit | 0d220d634e512d89bda540f91c643b361c82ea8a (patch) | |
tree | 198e2be046a1d6fdbbec0b7c44f1d5563f327528 /module/plugins | |
parent | Better dead plugin fallback (diff) | |
download | pyload-0d220d634e512d89bda540f91c643b361c82ea8a.tar.xz |
Logging string cosmetics
Diffstat (limited to 'module/plugins')
85 files changed, 192 insertions, 264 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index bd7f97cba..15e75b965 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -150,7 +150,7 @@ class Account(Base): if req: req.close() - self.logDebug("Account Info: %s" % str(infos)) + self.logDebug("Account Info: %s" % infos) infos['timestamp'] = time() self.infos[name] = infos diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index f4441c356..bc0de31dc 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -27,7 +27,7 @@ class DebridItaliaCom(Account): validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M"))) return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: - self.logError('Unable to retrieve account information - Plugin may be out of date') + self.logError("Unable to retrieve account information - Plugin may be out of date") def login(self, user, data, req): self.html = req.load("http://debriditalia.com/login.php", diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py index 41b58c4e7..fc263e776 100644 --- a/module/plugins/accounts/EgoFilesCom.py +++ b/module/plugins/accounts/EgoFilesCom.py @@ -30,7 +30,7 @@ class EgoFilesCom(Account): trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError('Unable to retrieve account information - Plugin may be out of date') + self.logError("Unable to retrieve account information - Plugin may be out of date") def login(self, user, data, req): # Set English language diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 2e50298d7..cc00411d6 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -36,7 +36,7 @@ class FilerNet(Account): trafficleft = parseFileSize(traffic.group(1)) / 1024 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError('Unable to retrieve account information - Plugin may be out of date') + self.logError("Unable to retrieve account information - Plugin may be out of date") return {"premium": False, "validuntil": None, "trafficleft": None} def login(self, user, data, req): diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index fe5a79949..0132eb921 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -45,7 +45,7 @@ class FreeWayMe(Account): def getAccountStatus(self, user, req): answer = req.load("https://www.free-way.me/ajax/jd.php", get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) - self.logDebug("login: %s" % answer) + self.logDebug("Login: %s" % answer) if answer == "Invalid login": self.wrongPassword() return False diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 9207cddab..ac78bda8f 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -43,7 +43,7 @@ class HellshareCz(Account): trafficleft = int(credit) * 1024 validuntil = -1 except Exception, e: - self.logError('Unable to parse credit info', e) + self.logError("Unable to parse credit info", e) validuntil = -1 trafficleft = -1 @@ -53,14 +53,14 @@ class HellshareCz(Account): html = req.load('http://www.hellshare.com/') if req.lastEffectiveURL != 'http://www.hellshare.com/': #Switch to English - self.logDebug('Switch lang - URL: %s' % req.lastEffectiveURL) + self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) hash = re.search(r"(--[0-9a-f]+-)", json).group(1) - self.logDebug('Switch lang - HASH: %s' % hash) + self.logDebug("Switch lang - HASH: %s" % hash) html = req.load('http://www.hellshare.com/%s/' % hash) if re.search(self.CREDIT_LEFT_PATTERN, html): - self.logDebug('Already logged in') + self.logDebug("Already logged in") return html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index c849f9d2d..b3f9fb532 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -19,7 +19,7 @@ class LetitbitNet(Account): # api_key = self.accounts[user]['password'] # json_data = [api_key, ['key/info']] # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - # self.logDebug('API Key Info: ' + api_rep) + # self.logDebug("API Key Info: " + api_rep) # api_rep = json_loads(api_rep) # # if api_rep['status'] == 'FAIL': @@ -30,4 +30,4 @@ class LetitbitNet(Account): def login(self, user, data, req): # API_KEY is the username and the PREMIUM_KEY is the password - self.logInfo('You must use your API KEY as username and the PREMIUM KEY as password.') + self.logInfo("You must use your API KEY as username and the PREMIUM KEY as password.") diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 8db9c9ade..bd566330e 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -19,13 +19,13 @@ class MyfastfileCom(Account): validuntil = int(time() + self.json_data['days_left'] * 24 * 60 * 60) return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: - self.logError('Unable to get account information') + self.logError("Unable to get account information") def login(self, user, data, req): # Password to use is the API-Password written in http://myfastfile.com/myaccount html = req.load("http://myfastfile.com/api.php", get={"user": user, "pass": data['password']}) - self.logDebug('JSON data: ' + html) + self.logDebug("JSON data: " + html) self.json_data = json_loads(html) if self.json_data['status'] != 'ok': self.logError('Invalid login. The password to use is the API-Password you find in your "My Account" page') diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 9d1939c60..4305c47c6 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -31,5 +31,5 @@ class RealdebridCom(Account): if "Your login informations are incorrect" in page: self.wrongPassword() elif "PIN Code required" in page: - self.logWarning('PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com.') + self.logWarning("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com.") self.pin_code = True diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py index a75cc5e0e..e545efa54 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/crypter/ChipDe.py @@ -24,4 +24,4 @@ class ChipDe(Crypter): self.fail('Failed to find the URL') else: self.urls = [f.group(1)] - self.logDebug('The file URL is %s' % self.urls[0]) + self.logDebug("The file URL is %s" % self.urls[0]) diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index 4f6116100..a500ac796 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -27,7 +27,7 @@ class DataHuFolder(SimpleCrypter): password = self.getPassword() if password is '': self.fail("No password specified, please set right password on Add package form and retry") - self.logDebug('The folder is password protected', 'Using password: ' + password) + self.logDebug("The folder is password protected', 'Using password: " + password) self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True) if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password self.fail("Incorrect password, please set right password on Add package form and retry") @@ -35,7 +35,7 @@ class DataHuFolder(SimpleCrypter): package_name, folder_name = self.getPackageNameAndFolder() package_links = re.findall(self.LINK_PATTERN, self.html) - self.logDebug('Package has %d links' % len(package_links)) + self.logDebug("Package has %d links" % len(package_links)) if package_links: self.packages = [(package_name, package_links, folder_name)] diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index e7a5a59e9..26b06c1c7 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -56,4 +56,4 @@ class DuckCryptInfo(Crypter): soup = BeautifulSoup(src) self.urls = [soup.find("iframe")['src']] if not self.urls: - self.logDebug('no links m - (Plugin out of date?)') + self.logDebug("No link found - (Plugin out of date?)") diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py index 1d9c2801f..b4f6c3ea7 100644 --- a/module/plugins/crypter/GooGl.py +++ b/module/plugins/crypter/GooGl.py @@ -20,7 +20,7 @@ class GooGl(Crypter): def decrypt(self, pyfile): rep = self.load(self.API_URL, get={'shortUrl': pyfile.url}) - self.logDebug('JSON data: ' + rep) + self.logDebug("JSON data: " + rep) rep = json_loads(rep) if 'longUrl' in rep: diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 060a434d2..e80686c02 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -136,7 +136,7 @@ class LinkSaveIn(Crypter): package_links = [] self.logDebug("Search for Web links") if not self.js: - self.logDebug("no JS -> skip Web links") + self.logDebug("No JS -> skip Web links") else: #@TODO: Gather paginated web links pattern = r'<a href="http://linksave\.in/(\w{43})"' @@ -162,7 +162,7 @@ class LinkSaveIn(Crypter): def handleContainer(self, type_): package_links = [] type_ = type_.lower() - self.logDebug('Seach for %s Container links' % type_.upper()) + self.logDebug("Seach for %s Container links" % type_.upper()) if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) self.fail('unknown container type "%s" (this is probably a bug)' % type_) pattern = r"\('%s_link'\).href=unescape\('(.*?\.%s)'\)" % (type_, type_) @@ -177,7 +177,7 @@ class LinkSaveIn(Crypter): package_links = [] self.logDebug("Search for CNL2 links") if not self.js: - self.logDebug("no JS -> skip CNL2 links") + self.logDebug("No JS -> skip CNL2 links") elif 'cnl2_load' in self.html: try: (vcrypted, vjk) = self._getCipherParams() diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 21f05b962..f9f29d5f5 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -43,7 +43,7 @@ class LinkdecrypterCom(Crypter): if self.html.startswith('http://'): return self.html.splitlines() - self.logError('API', self.html) + self.logError("API", self.html) if self.html == 'INTERRUPTION(PASSWORD)': self.fail("No or incorrect password") diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index cdf87eeb2..beba5ed04 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -42,12 +42,12 @@ class LixIn(Crypter): for _ in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - self.logDebug("trying captcha") + self.logDebug("Trying captcha") captcharesult = self.decryptCaptcha("http://lix.in/" + m.group("image")) self.html = self.req.load(url, decode=True, post={"capt": captcharesult, "submit": "submit", "tiny": id}) else: - self.logDebug("no captcha/captcha solved") + self.logDebug("No captcha/captcha solved") else: self.html = self.req.load(url, decode=True, post={"submit": "submit", "tiny": id}) diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index bb7c90722..45078c4ba 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -23,7 +23,7 @@ class MediafireComFolder(Crypter): def decrypt(self, pyfile): url, result = checkHTMLHeader(pyfile.url) - self.logDebug('Location (%d): %s' % (result, url)) + self.logDebug("Location (%d): %s" % (result, url)) if result == 0: # load and parse html diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 1b7b8b3d4..3937299d0 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -156,7 +156,7 @@ class NCryptIn(Crypter): self.logDebug("CircleCaptcha protected") captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % str(coords)) + self.logDebug("Captcha resolved, coords [%s]" % coords) postData['circle.x'] = coords[0] postData['circle.y'] = coords[1] diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 1b120fc77..1c1afea25 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -125,7 +125,7 @@ class RelinkUs(Crypter): self.logDebug("Request user positional captcha resolving") captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % str(coords)) + self.logDebug("Captcha resolved, coords [%s]" % coords) captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid captcha_post_data = {'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit'} self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True) @@ -189,7 +189,7 @@ class RelinkUs(Crypter): return package_links def handleDLCLinks(self): - self.logDebug('Search for DLC links') + self.logDebug("Search for DLC links") package_links = [] m = re.search(self.DLC_LINK_REGEX, self.html) if m is not None: diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py index fe4ee4e36..1ef5b7617 100644 --- a/module/plugins/crypter/SerienjunkiesOrg.py +++ b/module/plugins/crypter/SerienjunkiesOrg.py @@ -304,7 +304,7 @@ class SerienjunkiesOrg(Crypter): for Hoster in hosterlist: if preferred == Hoster.lower().replace('.', ''): for Part in hosterlist[Hoster]: - self.logDebug("selected " + Part) + self.logDebug("Selected " + Part) result.append(str(Part)) del (hosterlist2[Hoster]) if self.getConfig("hosterListMode") in ["OnlyOne", "OnlyPreferred(One)"]: @@ -316,7 +316,7 @@ class SerienjunkiesOrg(Crypter): for Hoster in hosterlist2: if Hoster.strip().lower().replace('.', '') not in ignorelist: for Part in hosterlist2[Hoster]: - self.logDebug("selected2 " + Part) + self.logDebug("Selected2 " + Part) result.append(str(Part)) if self.getConfig('hosterListMode') == "OnlyOne": diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 87bb16a50..fa9739711 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -109,7 +109,7 @@ class ShareLinksBiz(Crypter): captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) self.logDebug("Waiting user for correct position") coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % str(coords)) + self.logDebug("Captcha resolved, coords [%s]" % coords) # Resolve captcha href = self._resolveCoords(coords, captchaMap) diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index 068412062..20eb553a9 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -33,6 +33,6 @@ class UploadedToFolder(SimpleCrypter): self.html = self.load(plain_link) package_links = self.html.split('\n')[:-1] - self.logDebug('Package has %d links' % len(package_links)) + self.logDebug("Package has %d links" % len(package_links)) self.packages = [(package_name, package_links, folder_name)] diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index d62de24a7..93723681a 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -74,7 +74,7 @@ class BypassCaptcha(Hook): result = data['Value'] ticket = data['TaskId'] - self.logDebug("result %s : %s" % (ticket, result)) + self.logDebug("Result %s : %s" % (ticket, result)) return ticket, result @@ -83,7 +83,7 @@ class BypassCaptcha(Hook): response = 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.", str(e)) + self.logError(_("Could not send response."), e def newCaptchaTask(self, task): if "service" in task.data: @@ -105,7 +105,7 @@ class BypassCaptcha(Hook): start_new_thread(self.processCaptcha, (task,)) else: - self.logInfo("Your %s account has not enough credits" % self.__name__) + self.logInfo(_("Your %s account has not enough credits") % self.__name__) def captchaCorrect(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 1b7406edd..7a54bb784 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -58,7 +58,7 @@ class Captcha9kw(Hook): with open(task.captchaFile, 'rb') as f: data = f.read() data = b64encode(data) - self.logDebug("%s : %s" % (task.captchaFile, data)) + self.logDebug(task.captchaFile, data) if task.isPositional(): mouse = 1 else: @@ -93,10 +93,10 @@ class Captcha9kw(Hook): result = response2 task.data['ticket'] = response - self.logInfo("result %s : %s" % (response, result)) + self.logInfo(_("Result %s : %s") % (response, result)) task.setResult(result) else: - self.logError("Bad upload: %s" % response) + self.logError(_("Bad upload"), response) return False def newCaptchaTask(self, task): @@ -129,12 +129,12 @@ class Captcha9kw(Hook): "pyload": "1", "source": "pyload", "id": task.data['ticket']}) - self.logInfo("Request correct: %s" % response) + self.logInfo(_("Request correct", response) except BadHeader, e: - self.logError("Could not send correct request.", str(e)) + self.logError(_("Could not send correct request."), e) else: - self.logError("No CaptchaID for correct request (task %s) found." % task) + self.logError(_("No CaptchaID for correct request (task %s) found.") % task) def captchaInvalid(self, task): if "ticket" in task.data: @@ -148,9 +148,9 @@ class Captcha9kw(Hook): "pyload": "1", "source": "pyload", "id": task.data['ticket']}) - self.logInfo("Request refund: %s" % response) + self.logInfo(_("Request refund", response) except BadHeader, e: - self.logError("Could not send refund request.", str(e)) + self.logError(_("Could not send refund request."), e) else: - self.logError("No CaptchaID for not correct request (task %s) found." % task) + self.logError(_("No CaptchaID for not correct request (task %s) found.") % task) diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index e240cbbc0..e4d24c366 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -139,7 +139,7 @@ class CaptchaBrotherhood(Hook): task.setWaiting(100) start_new_thread(self.processCaptcha, (task,)) else: - self.logInfo("Your CaptchaBrotherhood Account has not enough credits") + self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 013172899..525eb8150 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -62,7 +62,7 @@ class Checksum(Hook): def coreReady(self): if not self.getConfig("check_checksum"): - self.logInfo("Checksum validation is disabled in plugin configuration") + self.logInfo(_("Checksum validation is disabled in plugin configuration")) def setup(self): self.algorithms = sorted( @@ -101,7 +101,7 @@ class Checksum(Hook): api_size = int(data['size']) file_size = getsize(local_file) if api_size != file_size: - self.logWarning("File %s has incorrect size: %d B (%d expected)" % (pyfile.name, file_size, api_size)) + self.logWarning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.checkFailed(pyfile, local_file, "Incorrect file size") del data['size'] @@ -115,17 +115,17 @@ class Checksum(Hook): checksum = computeChecksum(local_file, key.replace("-", "").lower()) if checksum: if checksum == data[key].lower(): - self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % + self.logInfo(_('File integrity of "%s" verified by %s checksum (%s).') % (pyfile.name, key.upper(), checksum)) break else: - self.logWarning("%s checksum for file %s does not match (%s != %s)" % + self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % (key.upper(), pyfile.name, checksum, data[key])) self.checkFailed(pyfile, local_file, "Checksums do not match") else: - self.logWarning("Unsupported hashing algorithm: %s" % key.upper()) + self.logWarning(_("Unsupported hashing algorithm"), key.upper()) else: - self.logWarning("Unable to validate checksum for file %s" % pyfile.name) + self.logWarning(_("Unable to validate checksum for file"), pyfile.name) def checkFailed(self, pyfile, local_file, msg): check_action = self.getConfig("check_action") @@ -147,14 +147,13 @@ class Checksum(Hook): for link in pypack.getChildren().itervalues(): file_type = splitext(link['name'])[1][1:].lower() - #self.logDebug(link, file_type) if file_type not in self.formats: continue hash_file = fs_encode(save_join(download_folder, link['name'])) if not isfile(hash_file): - self.logWarning("File not found: %s" % link['name']) + self.logWarning(_("File not found"), link['name']) continue with open(hash_file) as f: @@ -168,8 +167,8 @@ class Checksum(Hook): algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['hash']: - self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % + self.logInfo(_('File integrity of "%s" verified by %s checksum (%s).') % (data['name'], algorithm, checksum)) else: - self.logWarning("%s checksum for file %s does not match (%s != %s)" % + self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % (algorithm, data['name'], checksum, data['hash'])) diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 5c523caf7..2bff53d7e 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -30,7 +30,7 @@ class ClickAndLoad(Hook): thread.start_new_thread(proxy, (self, ip, self.port, 9666)) except: - self.logError("ClickAndLoad port already in use.") + self.logError(_("ClickAndLoad port already in use")) def proxy(self, *settings): diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 530395d32..0340aefce 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -146,7 +146,7 @@ class DeathByCaptcha(Hook): raise DeathByCaptchaException('timed-out') result = response['text'] - self.logDebug("result %s : %s" % (ticket, result)) + self.logDebug("Result %s : %s" % (ticket, result)) return ticket, result @@ -171,8 +171,9 @@ class DeathByCaptcha(Hook): return False balance, rate = self.info['balance'], self.info['rate'] - self.logInfo("Account balance: US$%.3f (%d captchas left at %.2f cents each)" % (balance / 100, - balance // rate, rate)) + self.logInfo(_("Account balance"), + _("US$%.3f (%d captchas left at %.2f cents each)") % (balance / 100, + balance // rate, rate)) if balance > rate: task.handler.append(self) diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index bc926906f..3db0400a1 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -23,8 +23,8 @@ class DeleteFinished(Hook): if not self.info['sleep']: deloffline = self.getConfig('deloffline') mode = '0,1,4' if deloffline else '0,4' - msg = 'delete all finished packages in queue list (%s packages with offline links)' - self.logInfo(msg % ('including' if deloffline else 'excluding')) + msg = _('delete all finished packages in queue list (%s packages with offline links)') + self.logInfo(msg % (_('including') if deloffline else _('excluding'))) self.deleteFinished(mode) self.info['sleep'] = True self.addEvent('packageFinished', self.wakeup) @@ -58,7 +58,7 @@ class DeleteFinished(Hook): """Adds an event listener for event name""" if event in self.m.events: if func in self.m.events[event]: - self.logDebug('Function already registered %s' % func) + self.logDebug("Function already registered", func) else: self.m.events[event].append(func) else: diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index a3d70b3ab..4652f9a1f 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -35,7 +35,7 @@ class DownloadScheduler(Hook): schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)", schedule.lower().replace("full", "-1").replace("none", "0")) if not schedule: - self.logError("Invalid schedule") + self.logError(_("Invalid schedule")) return t0 = localtime() @@ -58,7 +58,7 @@ class DownloadScheduler(Hook): def setDownloadSpeed(self, speed): if speed == 0: abort = self.getConfig("abort") - self.logInfo("Stopping download server. (Running downloads will %sbe aborted.)" % ('' if abort else 'not ')) + self.logInfo(_("Stopping download server. (Running downloads will %sbe aborted.)") % '' if abort else _('not ')) self.core.api.pauseServer() if abort: self.core.api.stopAllDownloads() @@ -66,10 +66,10 @@ class DownloadScheduler(Hook): self.core.api.unpauseServer() if speed > 0: - self.logInfo("Setting download speed to %d kB/s" % speed) + self.logInfo(_("Setting download speed to %d kB/s") % speed) self.core.api.setConfigValue("download", "limit_speed", 1) self.core.api.setConfigValue("download", "max_speed", speed) else: - self.logInfo("Setting download speed to FULL") + self.logInfo(_("Setting download speed to FULL")) self.core.api.setConfigValue("download", "limit_speed", 0) self.core.api.setConfigValue("download", "max_speed", -1) diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index da37297d9..a84dc5279 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -31,7 +31,7 @@ class EasybytezCom(MultiHoster): return m.group(1).split(',') except Exception, e: self.logDebug(e) - self.logWarning("Unable to load supported hoster list, using last known") + self.logWarning(_("Unable to load supported hoster list, using last known")) return ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", "uploaded.to"] diff --git a/module/plugins/hooks/Ev0InFetcher.py b/module/plugins/hooks/Ev0InFetcher.py index c54c38bc6..881cb36ef 100644 --- a/module/plugins/hooks/Ev0InFetcher.py +++ b/module/plugins/hooks/Ev0InFetcher.py @@ -67,15 +67,14 @@ class Ev0InFetcher(Hook): if show.lower() in normalizefiletitle(item['title']) and lastfound < int(mktime(item.date_parsed)): links = self.filterLinks(item['description'].split("<br />")) packagename = item['title'].encode("utf-8") - self.logInfo("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show)) + self.logInfo(_("New episode '%s' (matched '%s')") % (packagename, show)) self.core.api.addPackage(packagename, links, 1 if self.getConfig("queue") else 0) self.setStorage("show_%s_lastfound" % show, int(mktime(item.date_parsed))) found = True if not found: - #self.logDebug("Ev0InFetcher: no new episodes found") pass for show, lastfound in self.getStorage().iteritems(): if int(lastfound) > 0 and int(lastfound) + (3600 * 24 * 30) < int(time()): self.delStorage("show_%s_lastfound" % show) - self.logDebug("Ev0InFetcher: cleaned '%s' record" % show) + self.logDebug("Cleaned '%s' record" % show) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index c7ab80da0..06f1e9982 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -49,7 +49,6 @@ class ExpertDecoders(Hook): with open(task.captchaFile, 'rb') as f: data = f.read() data = b64encode(data) - #self.logDebug("%s: %s : %s" % (ticket, task.captchaFile, data)) req = getRequest() #raise timeout threshold @@ -61,7 +60,7 @@ class ExpertDecoders(Hook): finally: req.close() - self.logDebug("result %s : %s" % (ticket, result)) + self.logDebug("Result %s : %s" % (ticket, result)) task.setResult(result) def newCaptchaTask(self, task): @@ -88,7 +87,7 @@ class ExpertDecoders(Hook): try: response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"), "gen_task_id": task.data['ticket']}) - self.logInfo("Request refund: %s" % response) + self.logInfo(_("Request refund"), response) except BadHeader, e: - self.logError("Could not send refund request.", str(e)) + self.logError(_("Could not send refund request."), e) diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index bdde9cd62..7576149b9 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -43,7 +43,7 @@ class ExternalScripts(Hook): for script_type, names in self.scripts.iteritems(): if names: - self.logInfo((_("Installed scripts for %s: ") % script_type) + ", ".join([basename(x) for x in names])) + self.logInfo(_("Installed scripts for"), script_type, ", ".join([basename(x) for x in names])) def initPluginType(self, folder, path): @@ -67,11 +67,11 @@ class ExternalScripts(Hook): def callScript(self, script, *args): try: cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] - self.logDebug("Executing %(script)s: %(cmd)s" % {"script": abspath(script), "cmd": " ".join(cmd)}) + self.logDebug("Executing", abspath(script), " ".join(cmd)) #output goes to pyload subprocess.Popen(cmd, bufsize=-1) except Exception, e: - self.logError(_("Error in %(script)s: %(error)s") % {"script": basename(script), "error": str(e)}) + self.logError(_("Error in %(script)s: %(error)s") % {"script": basename(script), "error": e}) def downloadPreparing(self, pyfile): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 84f6eab25..34daf8f4f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -93,12 +93,12 @@ class ExtractArchive(Hook): if e.errno == 2: self.logInfo(_("No %s installed") % p) else: - self.logWarning(_("Could not activate %s") % p, str(e)) + self.logWarning(_("Could not activate %s") % p, e) if self.core.debug: print_exc() except Exception, e: - self.logWarning(_("Could not activate %s") % p, str(e)) + self.logWarning(_("Could not activate %s") % p, e) if self.core.debug: print_exc() @@ -197,16 +197,16 @@ class ExtractArchive(Hook): password = p.password.strip().splitlines() new_files = self._extract(klass, fid, password, thread) except Exception, e: - self.logError(basename(target), str(e)) + self.logError(basename(target), e) success = False continue - self.logDebug("Extracted: %s" % new_files) + self.logDebug("Extracted", new_files) self.setPermissions(new_files) for file in new_files: if not exists(file): - self.logDebug("new file %s does not exists" % file) + self.logDebug("New file %s does not exists" % file) continue if recursive and isfile(file): new_files_ids.append((file, fid)) # append as new target @@ -242,7 +242,7 @@ class ExtractArchive(Hook): success = True else: self.logInfo(basename(plugin.file), _("Password protected")) - self.logDebug("Passwords: %s" % str(passwords)) + self.logDebug("Passwords", passwords) pwlist = copy(self.getPasswords()) # remove already supplied pws from list (only local) @@ -252,7 +252,7 @@ class ExtractArchive(Hook): for pw in passwords + pwlist: try: - self.logDebug("Try password: %s" % pw) + self.logDebug("Try password", pw) if plugin.checkPassword(pw): plugin.extract(progress, pw) self.addPassword(pw) @@ -265,7 +265,7 @@ class ExtractArchive(Hook): raise Exception(_("Wrong password")) if self.core.debug: - self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles())) + self.logDebug("Would delete", ", ".join(plugin.getDeleteFiles())) if deletearchive: files = plugin.getDeleteFiles() @@ -284,13 +284,13 @@ class ExtractArchive(Hook): return extracted_files except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), str(e)) + self.logError(basename(plugin.file), _("Archive Error"), e) except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) except Exception, e: if self.core.debug: print_exc() - self.logError(basename(plugin.file), _("Unknown Error"), str(e)) + self.logError(basename(plugin.file), _("Unknown Error"), e) self.manager.dispatchEvent("archive_extract_failed", pyfile) raise Exception(_("Extract failed")) diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 12d58ac8a..1926188e3 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -22,5 +22,5 @@ class FreeWayMe(MultiHoster): def getHoster(self): hostis = getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3}).replace("\"", "").strip() - self.logDebug("hosters: %s" % hostis) + self.logDebug("Hosters", hostis) return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 7ebc0275f..fe458328a 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -89,8 +89,8 @@ class IRCInterface(Thread, Hook): for t in self.getConfig("owner").split(): if t.strip().startswith("#"): self.sock.send("JOIN %s\r\n" % t.strip()) - self.logInfo("pyLoad IRC: Connected to %s!" % host) - self.logInfo("pyLoad IRC: Switching to listening mode!") + self.logInfo(_("Connected to"), host) + self.logInfo(_("Switching to listening mode!")) try: self.main_loop() @@ -177,7 +177,7 @@ class IRCInterface(Thread, Hook): for line in res: self.response(line, msg['origin']) except Exception, e: - self.logError("pyLoad IRC: " + repr(e)) + self.logError(repr(e)) def response(self, msg, origin=""): if origin == "": diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index d9d4e547e..a3e16b522 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -61,7 +61,7 @@ class ImageTyperz(Hook): except: raise ImageTyperzException("invalid response") - self.logInfo("Account balance: $%s left" % response) + self.logInfo(_("Account balance: $%s left") % response) return balance def submit(self, captcha, captchaType="file", match=None): @@ -118,7 +118,7 @@ class ImageTyperz(Hook): start_new_thread(self.processCaptcha, (task,)) else: - self.logInfo("Your %s account has not enough credits" % self.__name__) + self.logInfo(_("Your %s account has not enough credits") % self.__name__) def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: @@ -127,9 +127,9 @@ class ImageTyperz(Hook): "imageid": task.data['ticket']}) if response == "SUCCESS": - self.logInfo("Bad captcha solution received, requested refund") + self.logInfo(_("Bad captcha solution received, requested refund")) else: - self.logError("Bad captcha solution received, refund request failed", response) + self.logError(_("Bad captcha solution received, refund request failed"), response) def processCaptcha(self, task): c = task.captchaFile diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index 1aa8f7ca1..fe2e85a01 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -52,4 +52,4 @@ class LinkdecrypterCom(Hook): dict['pattern'] = regexp dict['re'] = re.compile(regexp) - self.logDebug("REGEXP: " + regexp) + self.logDebug("REGEXP", regexp) diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index 605b04f21..81c3be07e 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -25,7 +25,7 @@ class MegaDebridEu(MultiHoster): if json_data['response_code'] == "ok": host_list = [element[0] for element in json_data['hosters']] else: - self.logError("Unable to retrieve hoster list") + self.logError(_("Unable to retrieve hoster list")) host_list = list() return host_list diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index a859092fb..dc8092d0a 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -44,11 +44,11 @@ class MergeFiles(Hook): download_folder = save_join(download_folder, pack.folder) for name, file_list in files.iteritems(): - self.logInfo("Starting merging of %s" % name) + self.logInfo(_("Starting merging of"), name) final_file = open(save_join(download_folder, name), "wb") for splitted_file in file_list: - self.logDebug("Merging part %s" % splitted_file) + self.logDebug("Merging part", splitted_file) pyfile = self.core.files.getFile(fid_dict[splitted_file]) pyfile.setStatus("processing") try: @@ -64,7 +64,7 @@ class MergeFiles(Hook): else: break s_file.close() - self.logDebug("Finished merging part %s" % splitted_file) + self.logDebug("Finished merging part", splitted_file) except Exception, e: print traceback.print_exc() finally: @@ -73,4 +73,4 @@ class MergeFiles(Hook): pyfile.release() final_file.close() - self.logInfo("Finished merging of %s" % name) + self.logInfo(_("Finished merging of"), name) diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index e2167b65e..418dfde71 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -44,7 +44,7 @@ class MultiHome(Hook): if iface: iface.useFor(pluginName, account) requestFactory.iface = lambda: iface.adress - self.logDebug("Multihome: using address: " + iface.adress) + self.logDebug("Using address", iface.adress) return oldGetRequest(pluginName, account) requestFactory.getRequest = getRequest diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index bbf665b08..9b9654402 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -20,7 +20,7 @@ class MyfastfileCom(MultiHoster): def getHoster(self): json_data = getURL('http://myfastfile.com/api.php?hosts', decode=True) - self.logDebug('JSON data: ' + json_data) + self.logDebug("JSON data", json_data) json_data = json_loads(json_data) return json_data['hosts'] diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index 5be0b8482..fc026a187 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -26,6 +26,6 @@ class OverLoadMe(MultiHoster): page = getURL(https + "://api.over-load.me/hoster.php", get={"auth": "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"} ).replace("\"", "").strip() - self.logDebug("Hosterlist: %s" % page) + self.logDebug("Hosterlist", page) return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index d504bb83b..6917a2ead 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -30,7 +30,7 @@ class RehostTo(MultiHoster): user = self.account.selectAccount()[0] if not user: - self.logError("Rehost.to: " + _("Please add your rehost.to account first and restart pyLoad")) + self.logError(_("Please add your rehost.to account first and restart pyLoad")) return data = self.account.getAccountInfo(user) diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 3aef6f8cd..30c808b4d 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -31,7 +31,7 @@ class RestartFailed(Hook): self.logDebug("Invalid interval value, kept current") def periodical(self): - self.logInfo("Restart failed downloads") + self.logInfo(_("Restart failed downloads")) self.api.restartFailed() def setup(self): diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index f25c5e2b4..685c9573d 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -22,14 +22,14 @@ class UnSkipOnFail(Hook): def downloadFailed(self, pyfile): pyfile_name = basename(pyfile.name) pid = pyfile.package().id - msg = 'look for skipped duplicates for %s (pid:%s)...' + msg = _('look for skipped duplicates for %s (pid:%s)') self.logInfo(msg % (pyfile_name, pid)) dups = self.findDuplicates(pyfile) for link in dups: # check if link is "skipped"(=4) if link.status == 4: lpid = link.packageID - self.logInfo('restart "%s" (pid:%s)...' % (pyfile_name, lpid)) + self.logInfo(_('restart "%s" (pid:%s)') % (pyfile_name, lpid)) self.setLinkStatus(link, "queued") def findDuplicates(self, pyfile): diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 546e6e6e8..6de3f4935 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -207,7 +207,7 @@ class UpdateManager(Hook): else: 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 blacklist: blacklisted = sorted(map(lambda x: (x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]), blacklist)) @@ -247,7 +247,7 @@ class UpdateManager(Hook): if not type_plugins: return - self.logDebug("Request deletion of plugins: %s" % type_plugins) + self.logDebug("Requested deletion of plugins", type_plugins) removed = [] @@ -261,7 +261,7 @@ class UpdateManager(Hook): try: remove(filename) except Exception, e: - self.logDebug("Error deleting \"%s\"" % path.basename(filename), str(e)) + self.logDebug("Error deleting", path.basename(filename), e) err = True filename += "c" @@ -271,7 +271,7 @@ class UpdateManager(Hook): self.manager.deactivateHook(name) remove(filename) except Exception, e: - self.logDebug("Error deleting \"%s\"" % path.basename(filename), str(e)) + self.logDebug("Error deleting", path.basename(filename), e) err = True if not err: diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index e19b40e22..1042d9498 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -62,7 +62,6 @@ class XFileSharingPro(Hook): return regexp = r"http://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}" % ("|".join(sorted(hosterList)).replace('.', '\.')) - #self.logDebug(regexp) dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] dict['pattern'] = regexp diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index c4a94a8bc..47d4d9fe4 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -84,22 +84,22 @@ class XMPPInterface(IRCInterface, JabberClient): try: self.loop() except Exception, ex: - self.logError("pyLoad XMPP: %s" % str(ex)) + self.logError(ex) def stream_state_changed(self, state, arg): """This one is called when the state of stream connecting the component to a server changes. This will usually be used to let the user know what is going on.""" - self.logDebug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg)) + self.logDebug("*** State changed: %s %r ***" % (state, arg)) def disconnected(self): - self.logDebug("pyLoad XMPP: Client was disconnected") + self.logDebug("Client was disconnected") def stream_closed(self, stream): - self.logDebug("pyLoad XMPP: Stream was closed | %s" % stream) + self.logDebug("Stream was closed", stream) def stream_error(self, err): - self.logDebug("pyLoad XMPP: Stream Error: %s" % err) + self.logDebug("Stream Error", err) def get_message_handlers(self): """Return list of (message_type, message_handler) tuples. @@ -113,8 +113,8 @@ class XMPPInterface(IRCInterface, JabberClient): subject = stanza.get_subject() body = stanza.get_body() t = stanza.get_type() - self.logDebug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(),))) - self.logDebug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t)) + self.logDebug("Message from %s received." % unicode(stanza.get_from())) + self.logDebug("Body: %s Subject: %s Type: %s" % (body, subject, t)) if t == "headline": # 'headline' messages should never be replied to @@ -158,7 +158,7 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.logError("pyLoad XMPP: " + repr(e)) + self.logError(repr(e)) return messages @@ -171,7 +171,7 @@ class XMPPInterface(IRCInterface, JabberClient): def announce(self, message): """ send message to all owners""" for user in self.getConfig("owners").split(";"): - self.logDebug("pyLoad XMPP: Send message to %s" % user) + self.logDebug("Send message to", user) to_jid = JID(user) diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 7201f1929..b1513bbac 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -50,7 +50,7 @@ class AlldebridCom(Hoster): page = self.load(url) data = json_loads(page) - self.logDebug("Json data: %s" % str(data)) + self.logDebug("Json data", data) if data['error']: if data['error'] == "This link isn't available on the hoster website.": diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 51627dc33..df8cfea9e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -57,7 +57,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError('Parse error (CREDIT): %s' % e) + self.logError("Parse error (CREDIT): %s" % e) return True diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 3dc01eef3..6b68706a4 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -31,7 +31,7 @@ class DataHu(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m: url = m.group(1) - self.logDebug('Direct link: ' + url) + self.logDebug("Direct link: " + url) else: self.parseError('Unable to get direct link') diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index ff8c430ee..c5155dc31 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -61,7 +61,7 @@ class DateiTo(SimpleHoster): self.fail('Too bad...') download_url = self.html - self.logDebug('Download URL', download_url) + self.logDebug("Download URL", download_url) self.download(download_url) def checkErrors(self): diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index 449dc0050..aed09fdcb 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -29,7 +29,7 @@ class EdiskCz(SimpleHoster): def process(self, pyfile): url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) - self.logDebug('URL:' + url) + self.logDebug("URL:" + url) m = re.search(self.ACTION_PATTERN, url) if m is None: diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 7f7104da1..a99e43731 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -56,7 +56,7 @@ class EgoFilesCom(SimpleHoster): self.html = self.load(self.pyfile.url, post=post_data, decode=True) m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.logInfo('Wrong captcha') + self.logInfo("Wrong captcha") self.invalidCaptcha() elif hasattr(m, 'group'): downloadURL = m.group('link') @@ -73,7 +73,7 @@ class EgoFilesCom(SimpleHoster): def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: - self.logDebug('DIRECT LINK from header: ' + header['location']) + self.logDebug("DIRECT LINK from header: " + header['location']) self.download(header['location']) else: self.html = self.load(self.pyfile.url, decode=True) @@ -82,7 +82,7 @@ class EgoFilesCom(SimpleHoster): if m is None: self.parseError('Unable to detect direct download url') else: - self.logDebug('DIRECT URL from html: ' + m.group('link')) + self.logDebug("DIRECT URL from html: " + m.group('link')) self.download(m.group('link'), disposition=True) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 199544840..59f88a32b 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -47,7 +47,7 @@ class FastixRu(Hoster): url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) page = self.load(url) data = json_loads(page) - self.logDebug("Json data: %s" % str(data)) + self.logDebug("Json data", data) if "error\":true" in page: self.offline() else: diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 627e4dee9..eb0c497a5 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -73,7 +73,7 @@ class FilefactoryCom(SimpleHoster): self.parseError('Unable to detect free direct link') direct = direct.group(1) - self.logDebug('DIRECT LINK: ' + direct) + self.logDebug("DIRECT LINK: " + direct) self.download(direct, disposition=True) check = self.checkDownload({"multiple": "You are currently downloading too many files at once.", @@ -102,5 +102,5 @@ class FilefactoryCom(SimpleHoster): else: self.parseError('Unable to detect premium direct link') - self.logDebug('DIRECT PREMIUM LINK: ' + url) + self.logDebug("DIRECT PREMIUM LINK: " + url) self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 0e1b6ea5a..c5439cf01 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -114,7 +114,7 @@ class FilepostCom(SimpleHoster): elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']: return None elif 'CAPTCHA' in json_response['js']['error']: - self.logDebug('error response is unknown, but mentions CAPTCHA -> return None') + self.logDebug("Error response is unknown, but mentions CAPTCHA") return None else: self.fail(json_response['js']['error']) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index b4cb314b6..3ad9f2091 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -54,7 +54,7 @@ class FilerNet(SimpleHoster): if 'token' not in inputs: self.parseError('Unable to detect token') token = inputs['token'] - self.logDebug('Token: ' + token) + self.logDebug("Token: " + token) self.html = self.load(self.pyfile.url, post={'token': token}, decode=True) @@ -62,7 +62,7 @@ class FilerNet(SimpleHoster): if 'hash' not in inputs: self.parseError('Unable to detect hash') hash_data = inputs['hash'] - self.logDebug('Hash: ' + hash_data) + self.logDebug("Hash: " + hash_data) downloadURL = r'' recaptcha = ReCaptcha(self) @@ -83,7 +83,7 @@ class FilerNet(SimpleHoster): self.correctCaptcha() break else: - self.logInfo('Wrong captcha') + self.logInfo("Wrong captcha") self.invalidCaptcha() if not downloadURL: @@ -102,7 +102,7 @@ class FilerNet(SimpleHoster): self.parseError("Unable to detect direct link, try to enable 'Direct download' in your user settings") dl = 'http://filer.net' + m.group(1) - self.logDebug('Direct link: ' + dl) + self.logDebug("Direct link: " + dl) self.download(dl, disposition=True) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index b7f051d80..7ddff112e 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -103,7 +103,7 @@ class FileserveCom(Hoster): # show download link response = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("show downloadLink response : %s" % response) + self.logDebug("Show downloadLink response : %s" % response) if "fail" in response: self.fail("Couldn't retrieve download url") @@ -130,7 +130,7 @@ class FileserveCom(Hoster): def doTimmer(self): response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("wait response : %s" % response[:80]) + self.logDebug("Wait response : %s" % response[:80]) if "fail" in response: self.fail("Failed getting wait time") diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index bc042cbcc..3fd66bc32 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -69,7 +69,7 @@ class FshareVn(SimpleHoster): self.parseError('FORM') elif 'link_file_pwd_dl' in inputs: for password in self.getPassword().splitlines(): - self.logInfo('Password protected link, trying "%s"' % password) + self.logInfo("Password protected link, trying", password) inputs['link_file_pwd_dl'] = password self.html = self.load(self.url, post=inputs, decode=True) if not 'name="link_file_pwd_dl"' in self.html: diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index c1ec66435..78d6aaba7 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -52,7 +52,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logDebug('Hoster told us to wait for %s' % m.group(1)) + self.logDebug("Hoster told us to wait for %s" % m.group(1)) # string to time convert courtesy of https://stackoverflow.com/questions/10663720 ftr = [3600, 60, 1] wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) @@ -62,7 +62,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html) if m: # if someone is already downloading on our line, wait 30min and retry - self.logDebug('Already downloading, waiting for 30 minutes') + self.logDebug("Already downloading, waiting for 30 minutes") self.wait(30 * 60, reconnect=True) self.retry() @@ -89,14 +89,14 @@ class Keep2shareCC(SimpleHoster): self.correctCaptcha() break else: - self.logInfo('Wrong captcha') + self.logInfo("Wrong captcha") self.invalidCaptcha() else: self.fail("All captcha attempts failed") def startDownload(self, url): d = urljoin(self.base_url, url) - self.logDebug('Direct Link: ' + d) + self.logDebug("Direct Link: " + d) self.download(d, disposition=True) def sanitize_url(self): diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3159be4f1..ec1dd14bd 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -148,13 +148,13 @@ class LetitbitNet(SimpleHoster): json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - self.logDebug('API Data: ' + api_rep) + self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) direct_link = api_rep['data'][0][0] - self.logDebug('Direct Link: ' + direct_link) + self.logDebug("Direct Link: " + direct_link) self.download(direct_link, disposition=True) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index e4200e9f2..c6862cbd2 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -46,7 +46,7 @@ class LinksnappyCom(Hoster): j = json_loads(r)['links'][0] if j['error']: - self.logError('Error converting the link: %s' % j['error']) + self.logError("Error converting the link: %s" % j['error']) self.fail('Error converting the link') pyfile.name = j['filename'] diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 60f1204e5..de18b8512 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -30,7 +30,7 @@ class LuckyShareNet(SimpleHoster): m = re.search(r"waitingtime = (\d+);", html) if m: waittime = int(m.group(1)) - self.logDebug('You have to wait %d seconds between free downloads' % waittime) + self.logDebug("You have to wait %d seconds between free downloads" % waittime) self.retry(wait_time=waittime) else: self.parseError('Unable to detect wait time between free downloads') @@ -42,9 +42,9 @@ class LuckyShareNet(SimpleHoster): # TODO: Some files could not be downloaded in free mode def handleFree(self): file_id = re.match(self.__pattern__, self.pyfile.url).group('ID') - self.logDebug('File ID: ' + file_id) + self.logDebug("File ID: " + file_id) rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True) - self.logDebug('JSON: ' + rep) + self.logDebug("JSON: " + rep) json = self.parseJson(rep) self.wait(int(json['time'])) @@ -54,13 +54,13 @@ class LuckyShareNet(SimpleHoster): challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash']), decode=True) - self.logDebug('JSON: ' + rep) + self.logDebug("JSON: " + rep) if 'link' in rep: json.update(self.parseJson(rep)) self.correctCaptcha() break elif 'Verification failed' in rep: - self.logInfo('Wrong captcha') + self.logInfo("Wrong captcha") self.invalidCaptcha() else: self.parseError('Unable to get downlaod link') @@ -68,7 +68,7 @@ class LuckyShareNet(SimpleHoster): if not json['link']: self.fail("No Download url retrieved/all captcha attempts failed") - self.logDebug('Direct URL: ' + json['link']) + self.logDebug("Direct URL: " + json['link']) self.download(json['link']) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index d0878a34d..f83003424 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -74,7 +74,7 @@ class MediafireCom(SimpleHoster): pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) self.url, result = checkHTMLHeader(pyfile.url) - self.logDebug('Location (%d): %s' % (result, self.url)) + self.logDebug("Location (%d): %s" % (result, self.url)) if result == 0: self.html = self.load(self.url, decode=True) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 18bed0231..b55a9514e 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -53,7 +53,7 @@ class NarodRu(SimpleHoster): else: self.fail("No valid captcha code entered") - self.logDebug('Download link: ' + url) + self.logDebug("Download link: " + url) self.download(url) diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 3187dd89f..d35daa8f7 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -31,7 +31,7 @@ class NosuploadCom(XFileSharingPro): # stage2: wait some time and press the "Download File" button data = self.getPostParameters() wait_time = re.search(self.WAIT_PATTERN, self.html, re.MULTILINE | re.DOTALL).group(1) - self.logDebug("hoster told us to wait %s seconds" % wait_time) + 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) diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index 193698f17..5ad02b81b 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -53,7 +53,7 @@ class NowDownloadEu(SimpleHoster): url = re.search(self.LINK_PATTERN, self.html) if url is None: self.fail('Download Link not Found (Plugin out of Date?)') - self.logDebug('Download link: ' + str(url.group(1))) + self.logDebug("Download link", url.group(1)) self.download(str(url.group(1))) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 0536f7185..8a962d062 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -40,7 +40,7 @@ class OneFichierCom(SimpleHoster): self.html = self.load(self.pyfile.url, decode=True) if self.WAITING_PATTERN in self.html: - self.logInfo('You have to wait been each free download! Retrying in %d seconds.' % self.WAIT_TIME) + self.logInfo("You have to wait been each free download! Retrying in %d seconds." % self.WAIT_TIME) self.waitAndRetry(self.WAIT_TIME) else: # detect parallel download m = re.search(self.NOT_PARALLEL, self.html) diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index d16af7e5a..85e573f75 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -29,7 +29,7 @@ class PromptfileCom(SimpleHoster): if m is None: self.parseError("Unable to detect chash") chash = m.group(1) - self.logDebug("read chash %s" % chash) + self.logDebug("Read chash %s" % chash) # continue to stage2 self.html = self.load(self.pyfile.url, decode=True, post={'chash': chash}) @@ -38,7 +38,7 @@ class PromptfileCom(SimpleHoster): if m is None: self.parseError("Unable to detect direct link") direct = m.group(1) - self.logDebug("found direct link: " + direct) + self.logDebug("Found direct link: " + direct) self.download(direct, disposition=True) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 972effffb..15a5726ef 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -36,11 +36,11 @@ class QuickshareCz(SimpleHoster): if self.premium: if 'UU_prihlasen' in self.jsvars: if self.jsvars['UU_prihlasen'] == '0': - self.logWarning('User not logged in') + self.logWarning("User not logged in") self.relogin(self.user) self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): - self.logWarning('Not enough credit left') + self.logWarning("Not enough credit left") self.premium = False if self.premium: diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index ce4d9ab36..3fea849ff 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -59,12 +59,12 @@ class RapidgatorNet(SimpleHoster): json = self.load('%s/%s' % (self.API_URL, cmd), get={'sid': self.sid, 'url': self.pyfile.url}, decode=True) - self.logDebug('API:%s' % cmd, json, "SID: %s" % self.sid) + self.logDebug("API:%s" % cmd, json, "SID: %s" % self.sid) json = json_loads(json) status = json['response_status'] msg = json['response_details'] except BadHeader, e: - self.logError('API:%s' % cmd, e, "SID: %s" % self.sid) + self.logError("API:%s" % cmd, e, "SID: %s" % self.sid) status = e.code msg = e diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index dbdaf3f8e..b81a2efcf 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -85,14 +85,14 @@ class UlozTo(SimpleHoster): if not action or not inputs: self.parseError("free download form") - self.logDebug('inputs.keys() = ' + str(inputs.keys())) + self.logDebug("inputs.keys = " + str(inputs.keys())) # get and decrypt captcha if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): # Old version - last seen 9.12.2013 self.logDebug('Using "old" version') captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) - self.logDebug('CAPTCHA ID: ' + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) + self.logDebug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) @@ -101,11 +101,11 @@ class UlozTo(SimpleHoster): self.logDebug('Using "new" version') xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={"rnd": str(int(time.time()))}) - self.logDebug('xapca = ' + str(xapca)) + self.logDebug("xapca = " + str(xapca)) data = json_loads(xapca) captcha_value = self.decryptCaptcha(str(data['image'])) - self.logDebug("CAPTCHA HASH: " + data['hash'] + ", CAPTCHA SALT: " + str(data['salt']) + ", CAPTCHA VALUE: " + captcha_value) + self.logDebug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) else: diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index ac70f42d4..c81d36a13 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -48,7 +48,7 @@ class UloziskoSk(SimpleHoster): self.parseError('ID') id = m.group(1) - self.logDebug('URL:' + parsed_url + ' ID:' + id) + self.logDebug("URL:" + parsed_url + ' ID:' + id) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: @@ -57,7 +57,7 @@ class UloziskoSk(SimpleHoster): captcha = self.decryptCaptcha(captcha_url, cookies=True) - self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha) + self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) self.download(parsed_url, post={ "antispam": captcha, diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index e936b84b1..c490bf879 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -63,7 +63,7 @@ class UnibytesCom(SimpleHoster): else: self.fail("No valid captcha code entered") - self.logDebug('Download link: ' + url) + self.logDebug("Download link: " + url) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(url) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 286f1caf0..49c50865b 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -205,7 +205,7 @@ class UploadedTo(Hoster): self.wait() result = self.load(url, post=options) - self.logDebug("result: %s" % result) + self.logDebug("Result: %s" % result) if "limit-size" in result: self.fail("File too big for free download") @@ -220,7 +220,7 @@ class UploadedTo(Hoster): self.wait() self.retry() elif '"err":"captcha"' in result: - self.logError("ul.net captcha is disabled") + self.logError("captcha is disabled") self.invalidCaptcha() elif "type:'download'" in result: self.correctCaptcha() diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 140024731..5293ce01d 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -31,7 +31,7 @@ class UpstoreNet(SimpleHoster): if m is None: self.parseError("could not detect hash") chash = m.group(1) - self.logDebug("read hash " + chash) + self.logDebug("Read hash " + chash) # continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} self.html = self.load(self.pyfile.url, post=post_data, decode=True) @@ -41,7 +41,7 @@ class UpstoreNet(SimpleHoster): recaptcha = ReCaptcha(self) if not recaptcha.detect_key(self.html): self.parseError("could not find recaptcha pattern") - self.logDebug("using captcha key " + recaptcha.recaptcha_key) + self.logDebug("Using captcha key " + recaptcha.recaptcha_key) # try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) @@ -68,7 +68,7 @@ class UpstoreNet(SimpleHoster): self.parseError("could not detect direct link") direct = m.group(1) - self.logDebug('found direct link: ' + direct) + self.logDebug("Found direct link: " + direct) self.download(direct, disposition=True) diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 66c258439..bdca87cc8 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -20,7 +20,7 @@ class VeehdCom(Hoster): def _debug(self, msg): - self.logDebug('[%s] %s' % (self.__name__, msg)) + self.logDebug("[%s] %s" % (self.__name__, msg)) def setup(self): self.multiDL = True diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index d7e24e0b0..e488b256d 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -203,7 +203,7 @@ class XFileSharingPro(SimpleHoster): link = link.strip() if self.captcha: self.correctCaptcha() - self.logDebug('DIRECT LINK: %s' % link) + self.logDebug("DIRECT LINK: %s" % link) self.download(link, disposition=True) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index b6b59b242..8d9871cb2 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -8,7 +8,7 @@ class ZeveraCom(Hoster): __type__ = "hoster" __version__ = "0.21" - __pattern__ = r'http://(?:www\.)?zevera.com/.*' + __pattern__ = r'http://(?:www\.)?zevera\.com/.*' __description__ = """Zevera.com hoster plugin""" __author_name__ = "zoidberg" @@ -24,7 +24,7 @@ class ZeveraCom(Hoster): self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com") self.fail("No zevera.com account provided") - self.logDebug("zevera.com: Old URL: %s" % pyfile.url) + self.logDebug("Old URL: %s" % pyfile.url) if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": self.fail("Offline or not downloadable - contact Zevera support") @@ -38,71 +38,3 @@ class ZeveraCom(Hoster): check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) if check == "error": self.fail("Error response received - contact Zevera support") - - # BitAPI not used - defunct, probably abandoned by Zevera - # - # api_url = "http://zevera.com/API.ashx" - # - # def process(self, pyfile): - # if not self.account: - # self.logError(_("Please enter your zevera.com account or deactivate this plugin")) - # self.fail("No zevera.com account provided") - # - # self.logDebug("zevera.com: Old URL: %s" % pyfile.url) - # - # last_size = retries = 0 - # olink = pyfile.url #quote(pyfile.url.encode('utf_8')) - # - # for _ in xrange(100): - # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_request', olink = olink) - # self.checkAPIErrors(self.retData) - # - # if self.retData['FileInfo']['StatusID'] == 100: - # break - # elif self.retData['FileInfo']['StatusID'] == 99: - # self.fail('Failed to initialize download (99)') - # else: - # if self.retData['FileInfo']['Progress']['BytesReceived'] <= last_size: - # if retries >= 6: - # self.fail('Failed to initialize download (%d)' % self.retData['FileInfo']['StatusID'] ) - # retries += 1 - # else: - # retries = 0 - # - # last_size = self.retData['FileInfo']['Progress']['BytesReceived'] - # - # self.setWait(self.retData['Update_Wait']) - # self.wait() - # - # pyfile.name = self.retData['FileInfo']['RealFileName'] - # pyfile.size = self.retData['FileInfo']['FileSizeInBytes'] - # - # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_start', - # FileID = self.retData['FileInfo']['FileID']) - # self.checkAPIErrors(self.retData) - # - # self.download(self.api_url, get = { - # 'cmd': "open_stream", - # 'login': self.account.loginname, - # 'pass': self.account.password, - # 'FileID': self.retData['FileInfo']['FileID'], - # 'startBytes': 0 - # } - # ) - # - # def checkAPIErrors(self, retData): - # if not retData: - # self.fail('Unknown API response') - # - # if retData['ErrorCode']: - # self.logError(retData['ErrorCode'], retData['ErrorMessage']) - # #self.fail('ERROR: ' + retData['ErrorMessage']) - # - # if pyfile.size / 1024000 > retData['AccountInfo']['AvailableTODAYTrafficForUseInMBytes']: - # self.logWarning("Not enough data left to download the file") - # - # def crazyDecode(self, ustring): - # # accepts decoded ie. unicode string - API response is double-quoted, double-utf8-encoded - # # no idea what the proper order of calling these functions would be :-/ - # return html_unescape(unquote(unquote(ustring.replace( - # '@DELIMITER@','#'))).encode('raw_unicode_escape').decode('utf-8')) diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index f6d202ee9..7f1bb5103 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -40,7 +40,7 @@ class MultiHoster(Hook): try: hosterSet = self.toHosterSet(self.getHoster()) - set(self.ignored) except Exception, e: - self.logError("%s" % str(e)) + self.logError(e) return [] try: @@ -54,7 +54,7 @@ class MultiHoster(Hook): hosterSet -= configSet except Exception, e: - self.logError("%s" % str(e)) + self.logError(e) self.hosters = list(hosterSet) @@ -98,7 +98,7 @@ class MultiHoster(Hook): def periodical(self): """reload hoster list periodically""" - self.logInfo("Reloading supported hoster list") + self.logInfo(_("Reloading supported hoster list")) old_supported = self.supported self.supported, self.new_supported, self.hosters = [], [], [] @@ -107,7 +107,7 @@ class MultiHoster(Hook): old_supported = [hoster for hoster in old_supported if hoster not in self.supported] if old_supported: - self.logDebug("UNLOAD: %s" % ", ".join(old_supported)) + self.logDebug("UNLOAD", ", ".join(old_supported)) for hoster in old_supported: self.unloadHoster(hoster) @@ -138,24 +138,24 @@ class MultiHoster(Hook): klass = getattr(module, self.__name__) # inject plugin plugin - self.logDebug("Overwritten Hosters: %s" % ", ".join(sorted(self.supported))) + self.logDebug("Overwritten Hosters", ", ".join(sorted(self.supported))) for hoster in self.supported: dict = self.core.pluginManager.hosterPlugins[hoster] dict['new_module'] = module dict['new_name'] = self.__name__ if excludedList: - self.logInfo("The following hosters were not overwritten - account exists: %s" % ", ".join(sorted(excludedList))) + self.logInfo(_("The following hosters were not overwritten - account exists"), ", ".join(sorted(excludedList))) if self.new_supported: - self.logDebug("New Hosters: %s" % ", ".join(sorted(self.new_supported))) + self.logDebug("New Hosters", ", ".join(sorted(self.new_supported))) # create new regexp regexp = r".*(%s).*" % "|".join([x.replace(".", "\\.") for x in self.new_supported]) if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: regexp = r"%s|%s" % (klass.__pattern__, regexp) - self.logDebug("Regexp: %s" % regexp) + self.logDebug("Regexp", regexp) dict = self.core.pluginManager.hosterPlugins[self.__name__] dict['pattern'] = regexp diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 184ba66c9..a4134dcc0 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -83,7 +83,7 @@ class SimpleCrypter(Crypter): if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'): self.handleMultiPages() - self.logDebug('Package has %d links' % len(self.package_links)) + self.logDebug("Package has %d links" % len(self.package_links)) if self.package_links: self.packages = [(package_name, self.package_links, folder_name)] diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6ecb2d9f2..c18bfff15 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -15,7 +15,6 @@ def replace_patterns(string, ruleslist): for r in ruleslist: rf, rt = r string = re.sub(rf, rt, string) - #self.logDebug(rf, rt, string) return string @@ -230,7 +229,7 @@ class SimpleHoster(Hoster): def getFileInfo(self): - self.logDebug("URL: %s" % self.pyfile.url) + self.logDebug("URL", self.pyfile.url) name, size, status = parseFileInfo(self)[:3] @@ -250,7 +249,7 @@ class SimpleHoster(Hoster): if size: self.pyfile.size = size else: - self.logError("File size not parsed") + self.logError(_("File size not parsed")) self.logDebug("FILE NAME: %s FILE SIZE: %s" % (self.pyfile.name, self.pyfile.size)) return self.file_info @@ -276,7 +275,7 @@ class SimpleHoster(Hoster): time_str = "(unknown time)" max_tries = 100 - self.logInfo("Download limit reached, reconnect or wait %s" % time_str) + self.logInfo(_("Download limit reached, reconnect or wait %s") % time_str) self.setWait(wait_time, True) self.wait() @@ -292,7 +291,7 @@ class SimpleHoster(Hoster): if traffic == -1: return True size = self.pyfile.size / 1024 - self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic)) + self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic)) return size <= traffic |