diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-06 17:28:41 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-06 17:28:41 +0200 |
commit | e401472c292205cd0ca4c286d8a3ec42982783ed (patch) | |
tree | 74726a6ca3239140599a755d779f900190e7eb4e | |
parent | Little bits to settings design (diff) | |
download | pyload-e401472c292205cd0ca4c286d8a3ec42982783ed.tar.xz |
container upload fix
-rw-r--r-- | module/plugins/Plugin.py | 3 | ||||
-rw-r--r-- | module/web/ajax/views.py | 2 | ||||
-rwxr-xr-x | pyLoadCore.py | 12 |
3 files changed, 8 insertions, 9 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 549caba22..516a3b772 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -195,6 +195,9 @@ class Plugin(object): Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) if Ocr: sleep(randint(3000, 5000) / 1000.0) + + if self.pyfile.abort: raise Abort + ocr = Ocr() result = ocr.get_captcha(temp.name) else: diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py index b1fe2f676..588881eea 100644 --- a/module/web/ajax/views.py +++ b/module/web/ajax/views.py @@ -62,7 +62,7 @@ def add_package(request): if name == None or name == "": name = f.name - fpath = join(settings.DL_ROOT, f.name) + fpath = join(settings.PYLOAD.get_conf_val("general","download_folder"), "tmp_"+ f.name) destination = open(fpath, 'wb') for chunk in f.chunks(): destination.write(chunk) diff --git a/pyLoadCore.py b/pyLoadCore.py index 74cb10d23..d8fb1c965 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -529,16 +529,12 @@ class ServerMethods(): def restart_file(self, fileid): self.core.files.restartFile(int(fileid)) - def upload_container(self, filename, type, content): - #@TODO py2.5 unproofed - th = NamedTemporaryFile(mode="w", suffix="." + type, delete=False) + def upload_container(self, filename, content): + th = open(join(self.core.config["general"]["download_folder"] , "tmp_" + filename), "wb") th.write(str(content)) - path = th.name th.close() - pid = self.core.file_list.packager.addNewPackage(filename) - cid = self.core.file_list.collector.addLink(path) - self.move_file_2_package(cid, pid) - self.core.file_list.save() + + self.add_package(th.name, [th.name], 1) def get_log(self, offset=0): filename = join(self.core.config['log']['log_folder'], 'log.txt') |