diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-08-21 17:33:10 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-08-21 17:33:10 +0200 |
commit | 7dc671b8bf301c2eae3ed7710bde6d0e37d75c61 (patch) | |
tree | 460fe33e499e36ebe49a33a12c72a26d6943c76e /module | |
parent | generic multihoster plugin (diff) | |
download | pyload-7dc671b8bf301c2eae3ed7710bde6d0e37d75c61.tar.xz |
extended debug report
Diffstat (limited to 'module')
-rw-r--r-- | module/PluginThread.py | 53 | ||||
-rw-r--r-- | module/plugins/hooks/UnRar.py | 5 |
2 files changed, 42 insertions, 16 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index c5b85a043..ffc866a3a 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -20,9 +20,9 @@ from Queue import Queue from threading import Thread -from time import sleep -from time import time -from time import strftime +from os import listdir +from os.path import join +from time import sleep, time, strftime from traceback import print_exc, format_exc from pprint import pformat from sys import exc_info, exc_clear @@ -48,8 +48,44 @@ class PluginThread(Thread): def writeDebugReport(self, pyfile): - dump = "pyLoad %s Debug Report of %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % ( - self.m.core.api.getServerVersion(), pyfile.pluginname, format_exc()) + """ writes a + :return: + """ + + dump_name = "debug_%s_%s" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) + + try: + dump_name += ".zip" + self.writeZipFile(pyfile) + + self.m.core.log.info("Debug Report written to %s" % dump_name) + + except: + dump_name += ".txt" + dump = self.writeDebugFile(pyfile) + f = open(dump_name, "wb") + f.write(dump) + f.close() + + self.m.core.log.info("Debug Report written to %s" % dump_name) + + def writeZipFile(self, pyfile): + import zipfile + + dump_name = "debug_%s_%s.zip" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) + + zip = zipfile.ZipFile(dump_name, "w") + + for f in listdir(join("tmp", pyfile.pluginname)): + zip.write(join("tmp", pyfile.pluginname, f), join(pyfile.pluginname, f)) + + zip.writestr(join(pyfile.pluginname, "debug_Report.txt"), self.writeDebugFile(pyfile)) + zip.close() + + + def writeDebugFile(self, pyfile): + dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % ( + self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc()) tb = exc_info()[2] stack = [] @@ -99,12 +135,7 @@ class PluginThread(Thread): dump += "\n\nCONFIG: \n\n" dump += pformat(self.m.core.config.plugin[pyfile.pluginname]) + "\n" - dump_name = "debug_%s_%s.txt" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) - self.m.core.log.info("Debug Report written to %s" % dump_name) - - f = open(dump_name, "wb") - f.write(dump) - f.close() + return dump def clean(self, pyfile): """ set thread unactive and release pyfile """ diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py index d5dfa1998..7ace49a76 100644 --- a/module/plugins/hooks/UnRar.py +++ b/module/plugins/hooks/UnRar.py @@ -213,11 +213,6 @@ class UnRar(Hook): if success: self.core.log.info(_("Unrar of %s ok") % fname) self.removeFiles(pack, fname) - if self.core.config['general']['folder_per_package']: - if self.getConfig("deletearchive"): - self.core.log.debug(_("Deleting package directory %s...") % folder) - rmdir(folder) - self.core.log.debug(_("Package directory %s has been deleted.") % folder) if os.name != "nt" and self.core.config['permission']['change_dl'] and\ self.core.config['permission']['change_file']: |