diff options
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/Base.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/Hoster.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/Plugin.py | 44 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 2 |
4 files changed, 28 insertions, 22 deletions
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index b2c4acd0a..9c355d5de 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -459,7 +459,7 @@ class Base(Plugin): try: id = frame.f_back.f_lineno finally: - del frame + del frame #: Delete the frame or it wont be cleaned if id not in self.retries: self.retries[id] = 0 diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 428313ef8..d164a9557 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -158,7 +158,7 @@ class Hoster(Base): self.check_status() - def isdownload(self, url, redirect=True, resumable=None): + def isresource(self, url, redirect=True, resumable=None): resource = False maxredirs = 5 diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 689573682..f43bf240a 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -117,8 +117,10 @@ class Plugin(object): def _print_exc(self): frame = inspect.currentframe() - print format_exc(frame.f_back) - del frame + try: + print format_exc(frame.f_back) + finally: + del frame def remove(self, path, trash=False): #@TODO: Change to `trash=True` in 0.4.10 @@ -220,23 +222,7 @@ class Plugin(object): self.last_html = html if self.pyload.debug: - frame = inspect.currentframe() - - try: - framefile = fsjoin("tmp", self.classname, "%s_line%s.dump.html" - % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) - - if not exists(os.path.join("tmp", self.classname)): - os.makedirs(os.path.join("tmp", self.classname)) - - with open(framefile, "wb") as f: - f.write(encode(html)) - - except IOError, e: - self.log_error(e) - - finally: - del frame #: Delete the frame or it wont be cleaned + self.dump_html() #@TODO: Move to network in 0.4.10 header = {'code': req.code} @@ -250,6 +236,26 @@ class Plugin(object): return html + def dump_html(self): + frame = inspect.currentframe() + + try: + framefile = fsjoin("tmp", self.classname, "%s_line%s.dump.html" + % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) + + if not exists(os.path.join("tmp", self.classname)): + os.makedirs(os.path.join("tmp", self.classname)) + + with open(framefile, "wb") as f: + f.write(encode(self.last_html)) + + except IOError, e: + self.log_error(e) + + finally: + del frame #: Delete the frame or it wont be cleaned + + def clean(self): """ Remove references diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index dc4adfc5d..a00b6e3fb 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -437,7 +437,7 @@ class SimpleHoster(Hoster): def handle_direct(self, pyfile): - self.link = pyfile.url if self.isdownload(pyfile.url) else None + self.link = pyfile.url if self.isresource(pyfile.url) else None def handle_multi(self, pyfile): #: Multi-hoster handler |