diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-04-19 15:31:18 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-04-19 15:31:41 +0200 |
commit | 313bad0316684fed4d1e347ebbb4e42e4e6e49dd (patch) | |
tree | 7f215acaa2a70eb36abee66979fe5fbb70592930 | |
parent | Updated translations (diff) | |
download | pyload-313bad0316684fed4d1e347ebbb4e42e4e6e49dd.tar.xz |
major bugfix for link and packing adding
-rw-r--r-- | pyload/DownloadManager.py | 4 | ||||
-rw-r--r-- | pyload/api/DownloadApi.py | 14 | ||||
-rw-r--r-- | pyload/config/default.py | 2 | ||||
-rw-r--r-- | pyload/database/UserDatabase.py | 8 | ||||
-rw-r--r-- | pyload/threads/InfoThread.py | 2 |
5 files changed, 21 insertions, 9 deletions
diff --git a/pyload/DownloadManager.py b/pyload/DownloadManager.py index abb61a4fd..e3a767345 100644 --- a/pyload/DownloadManager.py +++ b/pyload/DownloadManager.py @@ -26,8 +26,6 @@ from ReadWriteLock import ReadWriteLock from Api import DownloadStatus as DS -from datatypes.PyFile import PyFile - from utils import lock, read_lock from utils.fs import exists, join, free_space @@ -221,7 +219,7 @@ class DownloadManager: elif plugin == "crypter": self.startDecrypterThread(info) else: - self.log.error(_("Plugin type '%s' is can be used for downloading") % plugin) + self.log.error(_("Plugin type '%s' can't be used for downloading") % plugin) return False diff --git a/pyload/api/DownloadApi.py b/pyload/api/DownloadApi.py index 299609e35..df573c6bb 100644 --- a/pyload/api/DownloadApi.py +++ b/pyload/api/DownloadApi.py @@ -3,15 +3,21 @@ from os.path import isabs -from pyload.Api import Api, RequirePerm, Permission +from pyload.Api import Api, RequirePerm, Permission, Role from pyload.utils.fs import join from ApiComponent import ApiComponent - class DownloadApi(ApiComponent): """ Component to create, add, delete or modify downloads.""" + # TODO: workaround for link adding without owner + def truePrimary(self): + if self.user: + return self.user.true_primary + else: + return self.core.db.getUserData(role=Role.Admin).uid + @RequirePerm(Permission.Add) def createPackage(self, name, folder, root, password="", site="", comment="", paused=False): """Create a new package. @@ -32,7 +38,7 @@ class DownloadApi(ApiComponent): folder = folder.replace("http://", "").replace(":", "").replace("\\", "_").replace("..", "") self.core.log.info(_("Added package %(name)s as folder %(folder)s") % {"name": name, "folder": folder}) - pid = self.core.files.addPackage(name, folder, root, password, site, comment, paused, self.user.true_primary) + pid = self.core.files.addPackage(name, folder, root, password, site, comment, paused, self.truePrimary()) return pid @@ -76,7 +82,7 @@ class DownloadApi(ApiComponent): """ hoster, crypter = self.core.pluginManager.parseUrls(links) - self.core.files.addLinks(hoster + crypter, pid, self.user.true_primary) + self.core.files.addLinks(hoster + crypter, pid, self.truePrimary()) if hoster: self.core.threadManager.createInfoThread(hoster, pid) diff --git a/pyload/config/default.py b/pyload/config/default.py index d4ac84c9b..63684415a 100644 --- a/pyload/config/default.py +++ b/pyload/config/default.py @@ -94,7 +94,7 @@ def make_config(config): ("skip_existing", "bool", _("Skip already existing files"), False), ("max_speed", "int", _("Max download speed in kb/s"), -1), ("ipv6", "bool", _("Allow IPv6"), False), - ("ssl", "bool", _("Prefer SSL downloads"), True), + ("ssl", "bool", _("Force SSL downloads"), False), ("chunks", "int", _("Max connections for one download"), 3), ("restart_failed", "bool", _("Restart failed downloads on startup"), False), ]) diff --git a/pyload/database/UserDatabase.py b/pyload/database/UserDatabase.py index 65f46169e..8846d194d 100644 --- a/pyload/database/UserDatabase.py +++ b/pyload/database/UserDatabase.py @@ -55,7 +55,7 @@ class UserMethods(DatabaseMethods): pass @queue - def getUserData(self, name=None, uid=None): + def getUserData(self, name=None, uid=None, role=None): qry = ('SELECT uid, name, email, role, permission, folder, traffic, dllimit, dlquota, ' 'hddquota, user, template FROM "users" WHERE ') @@ -71,6 +71,12 @@ class UserMethods(DatabaseMethods): if r: return UserData(*r) + elif role is not None: + self.c.execute(qry + "role=?", (role,)) + r = self.c.fetchone() + if r: + return UserData(*r) + return None @queue diff --git a/pyload/threads/InfoThread.py b/pyload/threads/InfoThread.py index 272fe9816..1ff68fb45 100644 --- a/pyload/threads/InfoThread.py +++ b/pyload/threads/InfoThread.py @@ -22,6 +22,8 @@ class InfoThread(DecrypterThread): # urls that already have a package name self.names = {} + self.progress = None + self.m.addThread(self) self.start() |