From b5d1c47ac2590fe4314d7e96d58443c30463746c Mon Sep 17 00:00:00 2001 From: mkaay Date: Sat, 26 Dec 2009 22:35:20 +0100 Subject: gui contaoner upload, closes #39 --- pyLoadCore.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'pyLoadCore.py') diff --git a/pyLoadCore.py b/pyLoadCore.py index 7cf83389e..9e9da2c4b 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -44,7 +44,8 @@ from sys import stdout import thread import time from time import sleep -from shutil import copyfile +from shutil import copyfile +from tempfile import NamedTemporaryFile from module.file_list import File_List from module.network.Request import Request @@ -494,7 +495,17 @@ class ServerMethods(): self.core.file_list.packager.resetFileStatus(id) def restart_file(self, fileid): - self.core.file_list.packager.resetFileStatus(fileid) + self.core.file_list.packager.resetFileStatus(fileid) + + def upload_container(self, filename, type, content): + th = NamedTemporaryFile(mode="w", suffix="."+type, delete=False) + th.write(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() #def move_urls_up(self, ids): # for id in ids: -- cgit v1.2.3