diff options
Diffstat (limited to 'module')
35 files changed, 117 insertions, 147 deletions
diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 0c60e64d0..fd02abe0f 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -34,7 +34,7 @@ class CzshareCom(Account): validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M')) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: premium = True diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index 32bccc2e4..494f2938f 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -45,7 +45,7 @@ class Keep2ShareCc(Account): validuntil = time.mktime(time.strptime(expiredate, "%Y.%m.%d")) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: premium = True if validuntil > time.mktime(time.gmtime()) else False @@ -56,7 +56,7 @@ class Keep2ShareCc(Account): trafficleft = self.parse_traffic(m.group(1)) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index ee9be072b..9b4fda9f7 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -32,7 +32,7 @@ class MegasharesCom(Account): validuntil = time.mktime(time.strptime(timestr, "%b %d, %Y")) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index af71b1321..0b9e67a7c 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -42,7 +42,7 @@ class NitroflareCom(Account): re.findall(r'(\d+)\s*(day|hour|minute)', expiredate, re.I)) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: self.log_debug("Valid until: %s" % validuntil) @@ -59,7 +59,7 @@ class NitroflareCom(Account): trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))), "GB") except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: self.log_debug("TRAFFIC_LEFT_PATTERN not found") diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index 36d26930a..3375207d9 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -36,7 +36,7 @@ class NowVideoSx(Account): validuntil = time.mktime(time.strptime(expiredate, "%Y-%b-%d")) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: if validuntil > time.mktime(time.gmtime()): diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 42838690e..56d9c16a8 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -38,7 +38,8 @@ class OneFichierCom(Account): validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d")) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) + else: premium = True diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index f1177530f..ea6da4c4b 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -48,7 +48,7 @@ class RapidgatorNet(Account): self.log_error(json['response_details']) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return {'validuntil' : validuntil, 'trafficleft': trafficleft, @@ -73,6 +73,6 @@ class RapidgatorNet(Account): self.log_error(json['response_details']) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) self.fail_login() diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index c038d1ebc..6c7103b21 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -40,7 +40,7 @@ class UploadingCom(Account): validuntil = time.mktime(time.strptime(expiredate, "%b %d, %Y")) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: if validuntil > time.mktime(time.gmtime()): diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py index 302d229b8..6629656b2 100644 --- a/module/plugins/captcha/SolveMedia.py +++ b/module/plugins/captcha/SolveMedia.py @@ -61,7 +61,7 @@ class SolveMedia(CaptchaService): result = self.result("http://api.solvemedia.com/papi/media", challenge) except Fail, e: - self.log_warning(e) + self.log_warning(e, trace=True) self.plugin.invalidCaptcha() result = None diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 8a4a0f258..3f81c0485 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -83,9 +83,8 @@ class DailymotionComFolder(Crypter): def decrypt(self, pyfile): - m = re.match(self.__pattern__, pyfile.url) - m_id = m.group('ID') - m_type = m.group('TYPE') + m_id = self.info['pattern']['ID'] + m_type = self.info['pattern']['TYPE'] if m_type == "playlist": self.log_debug("Url recognized as Playlist") diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 6c50c8480..30f97f4fc 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -50,7 +50,7 @@ class DevhostStFolder(SimpleCrypter): self.pyfile.name = m.group(1) except Exception, e: - self.log_debug(e) + self.log_debug(e, trace=True) self.pyfile.name = self.info['pattern']['USER'] try: diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index d61c9d3dd..3d09eeac2 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -274,7 +274,7 @@ class LinkCryptWs(Crypter): package_links.extend(self._get_links(crypted, jk)) except Exception: - self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links")) + self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"), trace=True) return self.handle_web_links() return package_links diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 6d8383fee..4ff13a276 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -204,7 +204,7 @@ class RelinkUs(Crypter): package_links.extend(self._get_links(crypted, jk)) except Exception: - self.log_debug("Unable to decrypt CNL2 links") + self.log_debug("Unable to decrypt CNL2 links", trace=True) return package_links diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 98572191e..c39cf11da 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -200,7 +200,7 @@ class DeathByCaptcha(Hook): self.log_error(e.getDesc()) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) @threaded diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index aeb432626..6da2d5071 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -68,4 +68,4 @@ class HotFolder(Addon): self.pyload.api.addPackage(f, [newpath], 1) except (IOError, OSError), e: - self.log_error(e) + self.log_error(e, trace=True) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 6135b3244..a3d538272 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -191,7 +191,7 @@ class IRCInterface(Thread, Addon): self.response(line, msg['origin']) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) def response(self, msg, origin=""): diff --git a/module/plugins/hooks/LogMarker.py b/module/plugins/hooks/LogMarker.py new file mode 100644 index 000000000..eb78a28ff --- /dev/null +++ b/module/plugins/hooks/LogMarker.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.Addon import Addon, Expose + + +class LogMarker(Addon): + __name__ = "LogMarker" + __type__ = "hook" + __version__ = "0.01" + __status__ = "testing" + + __description__ = """Log a mark when the day begins""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def periodical(self): + self.log_info("------------------------------------------------") + self.log_info(_("--------------------- MARK ---------------------")) + self.log_info("------------------------------------------------")
\ No newline at end of file diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index c6405e5a3..a7d6fc7ba 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -68,7 +68,7 @@ class MergeFiles(Addon): self.log_debug("Finished merging part", splitted_file) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) finally: pyfile.setProgress(100) diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 715f82edb..5fdbf6402 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -64,15 +64,15 @@ class TransmissionRPC(Addon): req=req) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return else: - self.log_error(e) + self.log_error(e, trace=True) return except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return try: @@ -81,4 +81,4 @@ class TransmissionRPC(Addon): self.log_debug("Result: %s" % res['result']) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 312355675..330269397 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -323,7 +323,7 @@ class UpdateManager(Addon): self.manager.deactivateHook(name) except Exception, e: - self.log_debug(e) + self.log_debug(e, trace=True) for filename in (py_filename, pyc_filename): if not exists(filename): diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 0f8fb377f..f6e7020cd 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -180,7 +180,7 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) return messages diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index c2b8d9257..aceaa3461 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,10 +9,10 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' + __pattern__ = r'http://(?:www\.)?catshare\.net/\w{15,16}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """CatShare.net hoster plugin""" diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 75fcf39d8..d61bb310d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -61,7 +61,7 @@ class CzshareCom(SimpleHoster): except Exception, e: #: let's continue and see what happens... - self.log_error(e) + self.log_error(e, trace=True) return True @@ -72,7 +72,7 @@ class CzshareCom(SimpleHoster): inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) self.restart(premium=False) #: Download the file, destination is determined by pyLoad @@ -100,7 +100,7 @@ class CzshareCom(SimpleHoster): pyfile.size = int(inputs['size']) except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) self.error(_("Form")) #: Get and decrypt captcha diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 8657d4527..7486423b1 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -66,15 +66,13 @@ class NoPremiumPl(MultiHoster): data = self.run_file_query(pyfile.url, 'fileinfo') except Exception: - self.log_debug("Query error #1") - self.temp_offline() + self.temp_offline("Query error #1") try: parsed = json_loads(data) except Exception: - self.log_debug("Data not found") - self.temp_offline() + self.temp_offline("Data not found") self.log_debug(parsed) @@ -100,5 +98,4 @@ class NoPremiumPl(MultiHoster): self.link = self.run_file_query(pyfile.url, 'filedownload') except Exception: - self.log_debug("Query error #2") - self.temp_offline() + self.temp_offline("Query error #2") diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index f525e5b33..e7f2602a0 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.90" + __version__ = "0.91" __status__ = "testing" __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+))?' @@ -27,8 +27,9 @@ class OneFichierCom(SimpleHoster): ("Ludovic Lehmann", "ludo.lehmann@gmail.com")] - COOKIES = [("1fichier.com", "LG", "en")] + URL_REPLACEMENTS = [("https:", "http:")] #@TODO: Remove in 0.4.10 + COOKIES = [("1fichier.com", "LG", "en")] DIRECT_LINK = True NAME_PATTERN = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<' diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index fb552626c..4081cf1f2 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OpenloadIo(SimpleHoster): __name__ = "OpenloadIo" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?openload\.(co|io)/(f|embed)/(?P<ID>[\w\-]+)' @@ -36,15 +36,13 @@ class OpenloadIo(SimpleHoster): @classmethod - def get_info(cls, url="", html=""): - file_id = self.info['pattern']['ID'] + def api_info(cls, url): + file_id = cls.info['pattern']['ID'] info_json = cls._load_json(cls._FILE_INFO_URI_PATTERN.format(file_id)) file_info = info_json['result'][file_id] return {'name' : file_info['name'], - 'size' : file_info['size'], - 'status': 3 if url.strip() else 8, - 'url' : url} + 'size' : file_info['size']} def setup(self): diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index a43440e61..d4c753c07 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -66,15 +66,13 @@ class RapideoPl(MultiHoster): data = self.run_file_query(pyfile.url, 'fileinfo') except Exception: - self.log_debug("RunFileQuery error") - self.temp_offline() + self.temp_offline("Query error #1") try: parsed = json_loads(data) except Exception: - self.log_debug("Loads error") - self.temp_offline() + self.temp_offline("Data not found") self.log_debug(parsed) @@ -100,5 +98,4 @@ class RapideoPl(MultiHoster): self.link = self.run_file_query(pyfile.url, 'filedownload') except Exception: - self.log_debug("runFileQuery error #2") - self.temp_offline() + self.temp_offline("Query error #2") diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index d20d1cadd..6d83c3b56 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -143,7 +143,7 @@ class TurbobitNet(SimpleHoster): return "http://turbobit.net%s" % out.strip() except Exception, e: - self.log_error(e) + self.log_error(e, trace=True) else: if self.retries >= 2: #: Retry with updated js diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 2ca01de0e..1034fec19 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -13,7 +13,7 @@ from module.utils import compare_time, lock class Account(Plugin): __name__ = "Account" __type__ = "account" - __version__ = "0.55" + __version__ = "0.56" __status__ = "testing" __description__ = """Base account plugin""" @@ -63,7 +63,7 @@ class Account(Plugin): self.periodical() except Exception, e: - self.log_error(_("Error executing periodical task: %s") % e) + self.log_error(_("Error executing periodical task: %s") % e, trace=True) self.init_periodical(self.interval, threaded) diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index ae61acf65..c6e7ea7b8 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -101,7 +101,7 @@ class Addon(Plugin): self.periodical() except Exception, e: - self.log_error(_("Error executing periodical task: %s") % e) + self.log_error(_("Error executing periodical task: %s") % e, trace=True) self.init_periodical(self.interval, threaded) diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index b0458ca95..96d0b86f3 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -281,7 +281,7 @@ class Hoster(Base): #@TODO: Rewrite in 0.4.10 size = self.pyfile.size / 1024 self.log_info(_("Filesize: %s KiB") % size, - _("Traffic left for user %s: %s KiB") % (self.account.user, traffic)) + _("Traffic left for user `%s`: %s KiB") % (self.account.user, traffic)) return size <= traffic diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 884639b6b..333082425 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -20,7 +20,7 @@ from module.utils import save_join as fs_join class OCR(Plugin): __name__ = "OCR" __type__ = "ocr" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """OCR base plugin""" @@ -88,7 +88,7 @@ class OCR(Plugin): tmpTxt.close() except IOError, e: - self.log_error(e) + self.log_error(e, trace=True) return self.pyload.log_debug("Saving tiff...") @@ -139,7 +139,7 @@ class OCR(Plugin): os.remove(tmpSub.name) except OSError, e: - self.log_warning(e) + self.log_warning(e, trace=True) def recognize(self, name): @@ -179,18 +179,25 @@ class OCR(Plugin): try: if pixels[x - 1, y - 1] != 255: count += 1 + if pixels[x - 1, y] != 255: count += 1 + if pixels[x - 1, y + 1] != 255: count += 1 + if pixels[x, y + 1] != 255: count += 1 + if pixels[x + 1, y + 1] != 255: count += 1 + if pixels[x + 1, y] != 255: count += 1 + if pixels[x + 1, y - 1] != 255: count += 1 + if pixels[x, y - 1] != 255: count += 1 diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index bd5251e2e..61f219556 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -226,7 +226,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.49" + __version__ = "0.50" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -271,93 +271,38 @@ class Plugin(object): def log_debug(self, *args, **kwargs): - frame = inspect.currentframe() - try: - if kwargs: - for key, val in kwargs.iteritems(): - if key not in ("traceback"): - raise TypeError(frame.f_code.co_name + "() got an unexpected keyword argument '" + key + "'") - - if not self.pyload.debug: - return - - self._log("debug", self.__type__, self.__name__, args) - - if kwargs.get('traceback') is True: - traceback.print_stack(frame.f_back) - - finally: - del frame + self._log("debug", self.__type__, self.__name__, args) + if self.pyload.debug and kwargs.get('trace'): + print "Traceback (most recent call last):" + traceback.print_stack(inspect.currentframe().f_back) def log_info(self, *args, **kwargs): - frame = inspect.currentframe() - try: - if kwargs: - for key, val in kwargs.iteritems(): - if key not in ("traceback"): - raise TypeError(frame.f_code.co_name + "() got an unexpected keyword argument '" + key + "'") - - self._log("info", self.__type__, self.__name__, args) - - if kwargs.get('traceback') is True: - traceback.print_stack(frame.f_back) - - finally: - del frame + self._log("info", self.__type__, self.__name__, args) + if self.pyload.debug and kwargs.get('trace'): + print "Traceback (most recent call last):" + traceback.print_stack(inspect.currentframe().f_back) def log_warning(self, *args, **kwargs): - frame = inspect.currentframe() - try: - if kwargs: - for key, val in kwargs.iteritems(): - if key not in ("traceback"): - raise TypeError(frame.f_code.co_name + "() got an unexpected keyword argument '" + key + "'") - - self._log("warning", self.__type__, self.__name__, args) - - if kwargs.get('traceback') is True: - traceback.print_stack(frame.f_back) - - finally: - del frame + self._log("warning", self.__type__, self.__name__, args) + if self.pyload.debug and kwargs.get('trace'): + print "Traceback (most recent call last):" + traceback.print_stack(inspect.currentframe().f_back) def log_error(self, *args, **kwargs): - frame = inspect.currentframe() - try: - if kwargs: - for key, val in kwargs.iteritems(): - if key not in ("traceback"): - raise TypeError(frame.f_code.co_name + "() got an unexpected keyword argument '" + key + "'") - - self._log("error", self.__type__, self.__name__, args) - - if kwargs.get('traceback') is True: - traceback.print_stack(frame.f_back) - - finally: - del frame - - - def log_critical(self, *args): - frame = inspect.currentframe() - try: - if kwargs: - for key, val in kwargs.iteritems(): - if key not in ("traceback"): - raise TypeError(frame.f_code.co_name + "() got an unexpected keyword argument '" + key + "'") - - self._log("critical", self.__type__, self.__name__, args) + self._log("error", self.__type__, self.__name__, args) + if kwargs.get('trace'): + print "Traceback (most recent call last):" + traceback.print_stack(inspect.currentframe().f_back) - if kwargs.get('traceback') is False: - return - if self.pyload.debug: - traceback.print_stack(frame.f_back) - finally: - del frame + def log_critical(self, *args, **kwargs): + self._log("critical", self.__type__, self.__name__, args) + if kwargs.get('trace', True): + print "Traceback (most recent call last):" + traceback.print_stack(inspect.currentframe().f_back) def set_permissions(self, path): @@ -495,7 +440,7 @@ class Plugin(object): f.write(encode(html)) except IOError, e: - self.log_error(e) + self.log_error(e, trace=True) if not just_header: return html diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 7e759b593..a6d179ec7 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -16,7 +16,7 @@ from module.utils import fixup, fs_encode, parseFileSize as parse_size class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.95" + __version__ = "1.96" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -126,13 +126,12 @@ class SimpleHoster(Hoster): @classmethod def api_info(cls, url): - return super(SimpleHoster, cls).get_info(url) + return {} @classmethod def get_info(cls, url="", html=""): - info = cls.api_info(url) - online = True if info['status'] == 2 else False + info = super(SimpleHoster, cls).get_info(url) try: info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: Pattern groups will be saved here @@ -140,6 +139,9 @@ class SimpleHoster(Hoster): except Exception: info['pattern'] = {} + info = cls.api_info(url) + online = True if info['status'] is 2 else False + if not html and not online: if not url: info['error'] = "missing url" @@ -233,10 +235,10 @@ class SimpleHoster(Hoster): if self.LINK_PREMIUM_PATTERN is None: self.LINK_PREMIUM_PATTERN = self.LINK_PATTERN - if (self.LEECH_HOSTER - and (self.__pattern__ is not self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern'] - and re.match(self.__pattern__, self.pyfile.url) is None)): - self.leech_dl = True + if self.LEECH_HOSTER: + pattern = self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern'] + if self.__pattern__ is not pattern and re.match(self.__pattern__, self.pyfile.url) is None: + self.leech_dl = True if self.leech_dl: self.direct_dl = False diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 8b0aadf12..4c3f35c2b 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -106,11 +106,14 @@ class XFSAccount(Account): trafficleft = -1 if validuntil is None: validuntil = -1 + else: if 'U' in traffic: unit = traffic['U'] + elif isinstance(self.TRAFFIC_LEFT_UNIT, basestring): unit = self.TRAFFIC_LEFT_UNIT + else: unit = "" |