From 54bc92b4c5e0b3543a313f497cbc2276403c5980 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 10 Sep 2012 11:49:35 +0200 Subject: changed config + progress api --- module/Api.py | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) (limited to 'module/Api.py') diff --git a/module/Api.py b/module/Api.py index d530556fa..182024775 100644 --- a/module/Api.py +++ b/module/Api.py @@ -184,8 +184,6 @@ class Api(Iface): return serverStatus - # TODO: user sensitive pausing, now only available for admins - def pauseServer(self): """Pause server: It won't start any new downloads, but nothing gets aborted.""" self.core.threadManager.pause = True @@ -260,25 +258,13 @@ class Api(Iface): end = self.core.config['reconnect']['endTime'].split(":") return compare_time(start, end) and self.core.config["reconnect"]["activated"] - @RequirePerm(Permission.All) def getProgressInfo(self): """ Status of all currently running tasks :return: list of `ProgressInfo` """ - data = [] - for pyfile in self.core.threadManager.getActiveFiles(): - if not isinstance(pyfile, PyFile): - continue - - data.append(ProgressInfo( - pyfile.id, pyfile.name, pyfile.getSpeed(), pyfile.getETA(), pyfile.formatETA(), - pyfile.getBytesLeft(), pyfile.getSize(), pyfile.formatSize(), pyfile.getPercent(), - pyfile.status, pyfile.getStatusName(), pyfile.formatWait(), - pyfile.waitUntil, pyfile.packageid, pyfile.package().name, pyfile.pluginname)) - - return data + pass ########################## # Configuration @@ -361,7 +347,12 @@ class Api(Iface): @UserContext @RequirePerm(Permission.Plugins) - def deleteConfig(self, config): + def deleteConfig(self, plugin): + """Deletes modified config + + :param plugin: plugin name + :return: + """ pass @RequirePerm(Permission.Plugins) @@ -611,21 +602,21 @@ class Api(Iface): pass @RequirePerm(Permission.Add) - def addFromCollector(self, name, paused): + def addFromCollector(self, name, new_name): pass @RequirePerm(Permission.Delete) def deleteCollPack(self, name): pass - @RequirePerm(Permission.Delete) - def deleteCollLink(self, url): - pass - @RequirePerm(Permission.Add) def renameCollPack(self, name, new_name): pass + @RequirePerm(Permission.Delete) + def deleteCollLink(self, url): + pass + ############################# # File Information retrieval ############################# @@ -722,6 +713,11 @@ class Api(Iface): """Check online status of all files in a package, also a default action when package is added. """ self.core.files.reCheckPackage(pid) + @RequirePerm(Permission.Modify) + def restartFailed(self): + """Restarts all failed failes.""" + self.core.files.restartFailed() + @RequirePerm(Permission.Modify) def stopAllDownloads(self): """Aborts all running downloads.""" @@ -742,19 +738,10 @@ class Api(Iface): if pyfile.id in fids: pyfile.abortDownload() - @RequirePerm(Permission.Modify) - def restartFailed(self): - """Restarts all failed failes.""" - self.core.files.restartFailed() - ############################# # Modify Files/Packages ############################# - @RequirePerm(Permission.Modify) - def setFilePaused(self, fid, paused): - pass - @RequirePerm(Permission.Modify) def setPackagePaused(self, pid, paused): pass @@ -1007,6 +994,8 @@ class Api(Iface): # RPC Plugin Methods ############################# + # TODO: obsolete + @RequirePerm(Permission.Interaction) def getServices(self): """ A dict of available services, these can be defined by addon plugins. -- cgit v1.2.3