summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/Api.py49
-rw-r--r--module/database/ConfigDatabase.py41
-rw-r--r--module/database/DatabaseBackend.py6
-rw-r--r--module/database/__init__.py4
-rw-r--r--module/plugins/Base.py13
-rw-r--r--module/remote/socketbackend/ttypes.py35
-rw-r--r--module/remote/thriftbackend/pyload.thrift48
-rwxr-xr-xmodule/remote/thriftbackend/thriftgen/pyload/Pyload-remote47
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/Pyload.py417
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/ttypes.py105
10 files changed, 329 insertions, 436 deletions
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
#############################
@@ -723,6 +714,11 @@ class Api(Iface):
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,20 +738,11 @@ 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.
diff --git a/module/database/ConfigDatabase.py b/module/database/ConfigDatabase.py
index cc24f6785..198ae0173 100644
--- a/module/database/ConfigDatabase.py
+++ b/module/database/ConfigDatabase.py
@@ -1,28 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.database import DatabaseMethods, queue, async, inner
-
-# TODO
+from module.database import DatabaseMethods, queue, async
class ConfigMethods(DatabaseMethods):
@async
- def saveConfig(self, plugin, user, config):
- pass
+ def saveConfig(self, plugin, config, user=None):
+ if user is None:
+ self.c.execute('INSERT INTO settings(plugin, config) VALUES(?,?)', (plugin, config))
+ else:
+ self.c.execute('INSERT INTO settings(plugin, config, user) VALUES(?,?,?)', (plugin, config, user))
+
@queue
- def loadConfig(self, plugin, user):
- pass
+ def loadConfig(self, plugin, user=None):
+ if user is None:
+ self.c.execute('SELECT config FROM settings WHERE plugin=?', (plugin, ))
+ else:
+ self.c.execute('SELECT config FROM settings WHERE plugin=? AND user=?', (plugin, user))
+
+ return self.c.fetchone()[0]
@async
- def deleteConfig(self, plugin, user):
- pass
+ def deleteConfig(self, plugin, user=None):
+ if user is None:
+ self.c.execute('DELETE FROM settings WHERE plugin=?', (plugin, ))
+ else:
+ self.c.execute('DELETE FROM settings WHERE plugin=? AND user=?', (plugin, user))
@queue
def loadAllConfigs(self):
- pass
+ self.c.execute('SELECT user, plugin, config FROM settings')
+ configs = {}
+ for r in self.c:
+ if r[0] in configs:
+ configs[r[0]][r[1]] = r[2]
+ else:
+ configs[r[0]] = {r[1]: r[2]}
+ return configs
+
+ @async
+ def clearAllConfigs(self):
+ self.c.execute('DELETE FROM settings')
ConfigMethods.register() \ No newline at end of file
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py
index 3e6b059c0..58e1e74d8 100644
--- a/module/database/DatabaseBackend.py
+++ b/module/database/DatabaseBackend.py
@@ -139,7 +139,7 @@ class DatabaseBackend(Thread):
set_DB(self)
def setup(self):
-
+ """ *MUST* be called before db can be used !"""
self.start()
self.running.wait()
@@ -352,9 +352,9 @@ class DatabaseBackend(Thread):
self.c.execute(
'CREATE TABLE IF NOT EXISTS "settings" ('
'"plugin" TEXT NOT NULL, '
- '"user" INTEGER NOT NULL, '
+ '"user" INTEGER DEFAULT -1 NOT NULL, '
'"config" TEXT NOT NULL, '
- 'FOREIGN KEY(owner) REFERENCES users(uid), '
+ 'FOREIGN KEY(user) REFERENCES users(uid), '
'PRIMARY KEY (plugin, user) ON CONFLICT REPLACE'
')'
)
diff --git a/module/database/__init__.py b/module/database/__init__.py
index bf4ead872..d3f97fb53 100644
--- a/module/database/__init__.py
+++ b/module/database/__init__.py
@@ -3,4 +3,6 @@ from DatabaseBackend import DatabaseMethods, DatabaseBackend, queue, async, inne
from FileDatabase import FileMethods
from UserDatabase import UserMethods
from StorageDatabase import StorageMethods
-from AccountDatabase import AccountMethods \ No newline at end of file
+from AccountDatabase import AccountMethods
+from ConfigDatabase import ConfigMethods
+from StatisticDatabase import StatisticMethods \ No newline at end of file
diff --git a/module/plugins/Base.py b/module/plugins/Base.py
index c97c42328..9f6499985 100644
--- a/module/plugins/Base.py
+++ b/module/plugins/Base.py
@@ -47,14 +47,13 @@ class Base(object):
__pattern__ = r""
#: Internal addon plugin which is always loaded
__internal__ = False
- #: Config definition: list of (name, type, verbose_name, default_value) or
- #: (name, type, verbose_name, short_description, default_value)
+ #: Config definition: list of (name, type, label, default_value) or
+ #: (name, type, label, short_description, default_value)
__config__ = list()
- __label__ = "" #TODO: default should be name, makes long_desc obsolete?
#: Short description, one liner
- __description__ = ""
+ __label__ = ""
#: More detailed text
- __long_description__ = """"""
+ __description__ = """"""
#: List of needed modules
__dependencies__ = tuple()
#: Used to assign a category to addon plugins
@@ -76,7 +75,7 @@ class Base(object):
__author_mail__ = tuple()
- def __init__(self, core):
+ def __init__(self, core, user=None):
self.__name__ = self.__class__.__name__
#: Core instance
@@ -89,6 +88,8 @@ class Base(object):
self.evm = core.eventManager
#: :class:`InteractionManager`
self.im = core.interactionManager
+ #: :class:`User`, user related to this plugin
+ self.user = user
#: last interaction task
self.task = None
diff --git a/module/remote/socketbackend/ttypes.py b/module/remote/socketbackend/ttypes.py
index fd520f418..f4697e39e 100644
--- a/module/remote/socketbackend/ttypes.py
+++ b/module/remote/socketbackend/ttypes.py
@@ -154,6 +154,15 @@ class DownloadInfo(BaseObject):
self.statusmsg = statusmsg
self.error = error
+class DownloadProgress(BaseObject):
+ __slots__ = ['fid', 'pid', 'speed', 'status']
+
+ def __init__(self, fid=None, pid=None, speed=None, status=None):
+ self.fid = fid
+ self.pid = pid
+ self.speed = speed
+ self.status = status
+
class EventInfo(BaseObject):
__slots__ = ['eventname', 'event_args']
@@ -248,25 +257,17 @@ class PackageStats(BaseObject):
self.sizedone = sizedone
class ProgressInfo(BaseObject):
- __slots__ = ['fid', 'name', 'speed', 'eta', 'format_eta', 'bleft', 'size', 'format_size', 'percent', 'status', 'statusmsg', 'format_wait', 'wait_until', 'packageID', 'packageName', 'plugin']
+ __slots__ = ['plugin', 'name', 'statusmsg', 'eta', 'format_eta', 'done', 'total', 'download']
- def __init__(self, fid=None, name=None, speed=None, eta=None, format_eta=None, bleft=None, size=None, format_size=None, percent=None, status=None, statusmsg=None, format_wait=None, wait_until=None, packageID=None, packageName=None, plugin=None):
- self.fid = fid
+ def __init__(self, plugin=None, name=None, statusmsg=None, eta=None, format_eta=None, done=None, total=None, download=None):
+ self.plugin = plugin
self.name = name
- self.speed = speed
+ self.statusmsg = statusmsg
self.eta = eta
self.format_eta = format_eta
- self.bleft = bleft
- self.size = size
- self.format_size = format_size
- self.percent = percent
- self.status = status
- self.statusmsg = statusmsg
- self.format_wait = format_wait
- self.wait_until = wait_until
- self.packageID = packageID
- self.packageName = packageName
- self.plugin = plugin
+ self.done = done
+ self.total = total
+ self.download = download
class ServerStatus(BaseObject):
__slots__ = ['pause', 'active', 'queue', 'total', 'speed', 'download', 'reconnect']
@@ -359,7 +360,7 @@ class Iface:
pass
def deleteCollPack(self, name):
pass
- def deleteConfig(self, config):
+ def deleteConfig(self, plugin):
pass
def deleteFiles(self, fids):
pass
@@ -469,8 +470,6 @@ class Iface:
pass
def setConfigHandler(self, plugin, iid, value):
pass
- def setFilePaused(self, fid, paused):
- pass
def setInteractionResult(self, iid, result):
pass
def setPackageData(self, pid, data):
diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift
index fb906e23a..8257107b4 100644
--- a/module/remote/thriftbackend/pyload.thrift
+++ b/module/remote/thriftbackend/pyload.thrift
@@ -98,25 +98,22 @@ enum Role {
User = 1
}
-// TODO: progress vs Download progress ?!
+struct DownloadProgress {
+ 1: FileID fid,
+ 2: PackageID pid,
+ 3: ByteCount speed,
+ 4: DownloadStatus status,
+}
struct ProgressInfo {
- 1: FileID fid,
+ 1: PluginName plugin,
2: string name,
- 3: ByteCount speed,
- 4: i32 eta,
+ 3: string statusmsg,
+ 4: i32 eta, // in seconds
5: string format_eta,
- 6: ByteCount bleft,
- 7: ByteCount size,
- 8: string format_size,
- 9: i16 percent,
- 10: DownloadStatus status,
- 11: string statusmsg,
- 12: string format_wait,
- 13: UTCDate wait_until,
- 14: PackageID packageID,
- 15: string packageName,
- 16: PluginName plugin,
+ 6: ByteCount done,
+ 7: ByteCount total, // arbitary number, size in case of files
+ 8: optional DownloadProgress download
}
struct ServerStatus {
@@ -328,6 +325,8 @@ service Pyload {
// TODO
//void scanDownloadFolder(),
+ list<ProgressInfo> getProgressInfo(),
+
///////////////////////
// Configuration
///////////////////////
@@ -338,7 +337,7 @@ service Pyload {
ConfigHolder configurePlugin(1: PluginName plugin),
void saveConfig(1: ConfigHolder config),
- void deleteConfig(1: ConfigHolder config),
+ void deleteConfig(1: PluginName plugin),
void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: JSONString value),
///////////////////////
@@ -387,8 +386,6 @@ service Pyload {
// Collector
///////////////////////
- // TODO: reasonable link collector concept
-
list<LinkStatus> getCollector(),
void addToCollector(1: LinkList links),
@@ -423,13 +420,13 @@ service Pyload {
void restartFile(1: FileID fid),
void recheckPackage(1: PackageID pid),
void restartFailed(),
+ void stopDownloads(1: list<FileID> fids),
+ void stopAllDownloads(),
/////////////////////////
// Modify Files/Packages
/////////////////////////
- void setFilePaused(1: FileID fid, 2: bool paused) throws (1: FileDoesNotExists e),
-
// moving package while downloading is not possible, so they will return bool to indicate success
void setPackagePaused(1: PackageID pid, 2: bool paused) throws (1: PackageDoesNotExists e),
bool setPackageFolder(1: PackageID pid, 2: string path) throws (1: PackageDoesNotExists e),
@@ -443,17 +440,6 @@ service Pyload {
void orderFiles(1: list<FileID> fids, 2: PackageID pid, 3: i16 position),
///////////////////////
- // Taks/Progress
- ///////////////////////
-
- // downloads - information
- list<ProgressInfo> getProgressInfo(),
- void stopDownloads(1: list<FileID> fids),
- void stopAllDownloads(),
-
- // TODO - progress methods and data type
-
- ///////////////////////
// User Interaction
///////////////////////
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
index 78d251501..20015ba43 100755
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
@@ -35,12 +35,13 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' bool isTimeDownload()'
print ' bool isTimeReconnect()'
print ' bool toggleReconnect()'
+ print ' getProgressInfo()'
print ' getConfig()'
print ' getGlobalPlugins()'
print ' getUserPlugins()'
print ' ConfigHolder configurePlugin(PluginName plugin)'
print ' void saveConfig(ConfigHolder config)'
- print ' void deleteConfig(ConfigHolder config)'
+ print ' void deleteConfig(PluginName plugin)'
print ' void setConfigHandler(PluginName plugin, InteractionID iid, JSONString value)'
print ' checkURLs(LinkList urls)'
print ' parseURLs(string html, string url)'
@@ -76,7 +77,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' void restartFile(FileID fid)'
print ' void recheckPackage(PackageID pid)'
print ' void restartFailed()'
- print ' void setFilePaused(FileID fid, bool paused)'
+ print ' void stopDownloads( fids)'
+ print ' void stopAllDownloads()'
print ' void setPackagePaused(PackageID pid, bool paused)'
print ' bool setPackageFolder(PackageID pid, string path)'
print ' void setPackageData(PackageID pid, data)'
@@ -84,9 +86,6 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' bool moveFiles( fids, PackageID pid)'
print ' void orderPackage( pids, i16 position)'
print ' void orderFiles( fids, PackageID pid, i16 position)'
- print ' getProgressInfo()'
- print ' void stopDownloads( fids)'
- print ' void stopAllDownloads()'
print ' bool isInteractionWaiting(i16 mode)'
print ' InteractionTask getInteractionTask(i16 mode)'
print ' void setInteractionResult(InteractionID iid, JSONString result)'
@@ -234,6 +233,12 @@ elif cmd == 'toggleReconnect':
sys.exit(1)
pp.pprint(client.toggleReconnect())
+elif cmd == 'getProgressInfo':
+ if len(args) != 0:
+ print 'getProgressInfo requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.getProgressInfo())
+
elif cmd == 'getConfig':
if len(args) != 0:
print 'getConfig requires 0 args'
@@ -480,11 +485,17 @@ elif cmd == 'restartFailed':
sys.exit(1)
pp.pprint(client.restartFailed())
-elif cmd == 'setFilePaused':
- if len(args) != 2:
- print 'setFilePaused requires 2 args'
+elif cmd == 'stopDownloads':
+ if len(args) != 1:
+ print 'stopDownloads requires 1 args'
sys.exit(1)
- pp.pprint(client.setFilePaused(eval(args[0]),eval(args[1]),))
+ pp.pprint(client.stopDownloads(eval(args[0]),))
+
+elif cmd == 'stopAllDownloads':
+ if len(args) != 0:
+ print 'stopAllDownloads requires 0 args'
+ sys.exit(1)
+ pp.pprint(client.stopAllDownloads())
elif cmd == 'setPackagePaused':
if len(args) != 2:
@@ -528,24 +539,6 @@ elif cmd == 'orderFiles':
sys.exit(1)
pp.pprint(client.orderFiles(eval(args[0]),eval(args[1]),eval(args[2]),))
-elif cmd == 'getProgressInfo':
- if len(args) != 0:
- print 'getProgressInfo requires 0 args'
- sys.exit(1)
- pp.pprint(client.getProgressInfo())
-
-elif cmd == 'stopDownloads':
- if len(args) != 1:
- print 'stopDownloads requires 1 args'
- sys.exit(1)
- pp.pprint(client.stopDownloads(eval(args[0]),))
-
-elif cmd == 'stopAllDownloads':
- if len(args) != 0:
- print 'stopAllDownloads requires 0 args'
- sys.exit(1)
- pp.pprint(client.stopAllDownloads())
-
elif cmd == 'isInteractionWaiting':
if len(args) != 1:
print 'isInteractionWaiting requires 1 args'
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
index 4134a4d3e..157d5b87b 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -53,6 +53,9 @@ class Iface(object):
def toggleReconnect(self, ):
pass
+ def getProgressInfo(self, ):
+ pass
+
def getConfig(self, ):
pass
@@ -76,10 +79,10 @@ class Iface(object):
"""
pass
- def deleteConfig(self, config):
+ def deleteConfig(self, plugin):
"""
Parameters:
- - config
+ - plugin
"""
pass
@@ -341,14 +344,16 @@ class Iface(object):
def restartFailed(self, ):
pass
- def setFilePaused(self, fid, paused):
+ def stopDownloads(self, fids):
"""
Parameters:
- - fid
- - paused
+ - fids
"""
pass
+ def stopAllDownloads(self, ):
+ pass
+
def setPackagePaused(self, pid, paused):
"""
Parameters:
@@ -406,19 +411,6 @@ class Iface(object):
"""
pass
- def getProgressInfo(self, ):
- pass
-
- def stopDownloads(self, fids):
- """
- Parameters:
- - fids
- """
- pass
-
- def stopAllDownloads(self, ):
- pass
-
def isInteractionWaiting(self, mode):
"""
Parameters:
@@ -882,6 +874,31 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "toggleReconnect failed: unknown result");
+ def getProgressInfo(self, ):
+ self.send_getProgressInfo()
+ return self.recv_getProgressInfo()
+
+ def send_getProgressInfo(self, ):
+ self._oprot.writeMessageBegin('getProgressInfo', TMessageType.CALL, self._seqid)
+ args = getProgressInfo_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getProgressInfo(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getProgressInfo_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getProgressInfo failed: unknown result");
+
def getConfig(self, ):
self.send_getConfig()
return self.recv_getConfig()
@@ -1015,18 +1032,18 @@ class Client(Iface):
self._iprot.readMessageEnd()
return
- def deleteConfig(self, config):
+ def deleteConfig(self, plugin):
"""
Parameters:
- - config
+ - plugin
"""
- self.send_deleteConfig(config)
+ self.send_deleteConfig(plugin)
self.recv_deleteConfig()
- def send_deleteConfig(self, config):
+ def send_deleteConfig(self, plugin):
self._oprot.writeMessageBegin('deleteConfig', TMessageType.CALL, self._seqid)
args = deleteConfig_args()
- args.config = config
+ args.plugin = plugin
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -2113,36 +2130,55 @@ class Client(Iface):
self._iprot.readMessageEnd()
return
- def setFilePaused(self, fid, paused):
+ def stopDownloads(self, fids):
"""
Parameters:
- - fid
- - paused
+ - fids
"""
- self.send_setFilePaused(fid, paused)
- self.recv_setFilePaused()
+ self.send_stopDownloads(fids)
+ self.recv_stopDownloads()
- def send_setFilePaused(self, fid, paused):
- self._oprot.writeMessageBegin('setFilePaused', TMessageType.CALL, self._seqid)
- args = setFilePaused_args()
- args.fid = fid
- args.paused = paused
+ def send_stopDownloads(self, fids):
+ self._oprot.writeMessageBegin('stopDownloads', TMessageType.CALL, self._seqid)
+ args = stopDownloads_args()
+ args.fids = fids
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
- def recv_setFilePaused(self, ):
+ def recv_stopDownloads(self, ):
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(self._iprot)
self._iprot.readMessageEnd()
raise x
- result = setFilePaused_result()
+ result = stopDownloads_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ return
+
+ def stopAllDownloads(self, ):
+ self.send_stopAllDownloads()
+ self.recv_stopAllDownloads()
+
+ def send_stopAllDownloads(self, ):
+ self._oprot.writeMessageBegin('stopAllDownloads', TMessageType.CALL, self._seqid)
+ args = stopAllDownloads_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_stopAllDownloads(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = stopAllDownloads_result()
result.read(self._iprot)
self._iprot.readMessageEnd()
- if result.e is not None:
- raise result.e
return
def setPackagePaused(self, pid, paused):
@@ -2373,82 +2409,6 @@ class Client(Iface):
self._iprot.readMessageEnd()
return
- def getProgressInfo(self, ):
- self.send_getProgressInfo()
- return self.recv_getProgressInfo()
-
- def send_getProgressInfo(self, ):
- self._oprot.writeMessageBegin('getProgressInfo', TMessageType.CALL, self._seqid)
- args = getProgressInfo_args()
- args.write(self._oprot)
- self._oprot.writeMessageEnd()
- self._oprot.trans.flush()
-
- def recv_getProgressInfo(self, ):
- (fname, mtype, rseqid) = self._iprot.readMessageBegin()
- if mtype == TMessageType.EXCEPTION:
- x = TApplicationException()
- x.read(self._iprot)
- self._iprot.readMessageEnd()
- raise x
- result = getProgressInfo_result()
- result.read(self._iprot)
- self._iprot.readMessageEnd()
- if result.success is not None:
- return result.success
- raise TApplicationException(TApplicationException.MISSING_RESULT, "getProgressInfo failed: unknown result");
-
- def stopDownloads(self, fids):
- """
- Parameters:
- - fids
- """
- self.send_stopDownloads(fids)
- self.recv_stopDownloads()
-
- def send_stopDownloads(self, fids):
- self._oprot.writeMessageBegin('stopDownloads', TMessageType.CALL, self._seqid)
- args = stopDownloads_args()
- args.fids = fids
- args.write(self._oprot)
- self._oprot.writeMessageEnd()
- self._oprot.trans.flush()
-
- def recv_stopDownloads(self, ):
- (fname, mtype, rseqid) = self._iprot.readMessageBegin()
- if mtype == TMessageType.EXCEPTION:
- x = TApplicationException()
- x.read(self._iprot)
- self._iprot.readMessageEnd()
- raise x
- result = stopDownloads_result()
- result.read(self._iprot)
- self._iprot.readMessageEnd()
- return
-
- def stopAllDownloads(self, ):
- self.send_stopAllDownloads()
- self.recv_stopAllDownloads()
-
- def send_stopAllDownloads(self, ):
- self._oprot.writeMessageBegin('stopAllDownloads', TMessageType.CALL, self._seqid)
- args = stopAllDownloads_args()
- args.write(self._oprot)
- self._oprot.writeMessageEnd()
- self._oprot.trans.flush()
-
- def recv_stopAllDownloads(self, ):
- (fname, mtype, rseqid) = self._iprot.readMessageBegin()
- if mtype == TMessageType.EXCEPTION:
- x = TApplicationException()
- x.read(self._iprot)
- self._iprot.readMessageEnd()
- raise x
- result = stopAllDownloads_result()
- result.read(self._iprot)
- self._iprot.readMessageEnd()
- return
-
def isInteractionWaiting(self, mode):
"""
Parameters:
@@ -3176,6 +3136,7 @@ class Processor(Iface, TProcessor):
self._processMap["isTimeDownload"] = Processor.process_isTimeDownload
self._processMap["isTimeReconnect"] = Processor.process_isTimeReconnect
self._processMap["toggleReconnect"] = Processor.process_toggleReconnect
+ self._processMap["getProgressInfo"] = Processor.process_getProgressInfo
self._processMap["getConfig"] = Processor.process_getConfig
self._processMap["getGlobalPlugins"] = Processor.process_getGlobalPlugins
self._processMap["getUserPlugins"] = Processor.process_getUserPlugins
@@ -3217,7 +3178,8 @@ class Processor(Iface, TProcessor):
self._processMap["restartFile"] = Processor.process_restartFile
self._processMap["recheckPackage"] = Processor.process_recheckPackage
self._processMap["restartFailed"] = Processor.process_restartFailed
- self._processMap["setFilePaused"] = Processor.process_setFilePaused
+ self._processMap["stopDownloads"] = Processor.process_stopDownloads
+ self._processMap["stopAllDownloads"] = Processor.process_stopAllDownloads
self._processMap["setPackagePaused"] = Processor.process_setPackagePaused
self._processMap["setPackageFolder"] = Processor.process_setPackageFolder
self._processMap["setPackageData"] = Processor.process_setPackageData
@@ -3225,9 +3187,6 @@ class Processor(Iface, TProcessor):
self._processMap["moveFiles"] = Processor.process_moveFiles
self._processMap["orderPackage"] = Processor.process_orderPackage
self._processMap["orderFiles"] = Processor.process_orderFiles
- self._processMap["getProgressInfo"] = Processor.process_getProgressInfo
- self._processMap["stopDownloads"] = Processor.process_stopDownloads
- self._processMap["stopAllDownloads"] = Processor.process_stopAllDownloads
self._processMap["isInteractionWaiting"] = Processor.process_isInteractionWaiting
self._processMap["getInteractionTask"] = Processor.process_getInteractionTask
self._processMap["setInteractionResult"] = Processor.process_setInteractionResult
@@ -3400,6 +3359,17 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_getProgressInfo(self, seqid, iprot, oprot):
+ args = getProgressInfo_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getProgressInfo_result()
+ result.success = self._handler.getProgressInfo()
+ oprot.writeMessageBegin("getProgressInfo", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_getConfig(self, seqid, iprot, oprot):
args = getConfig_args()
args.read(iprot)
@@ -3460,7 +3430,7 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = deleteConfig_result()
- self._handler.deleteConfig(args.config)
+ self._handler.deleteConfig(args.plugin)
oprot.writeMessageBegin("deleteConfig", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
@@ -3863,16 +3833,24 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
- def process_setFilePaused(self, seqid, iprot, oprot):
- args = setFilePaused_args()
+ def process_stopDownloads(self, seqid, iprot, oprot):
+ args = stopDownloads_args()
args.read(iprot)
iprot.readMessageEnd()
- result = setFilePaused_result()
- try:
- self._handler.setFilePaused(args.fid, args.paused)
- except FileDoesNotExists, e:
- result.e = e
- oprot.writeMessageBegin("setFilePaused", TMessageType.REPLY, seqid)
+ result = stopDownloads_result()
+ self._handler.stopDownloads(args.fids)
+ oprot.writeMessageBegin("stopDownloads", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
+ def process_stopAllDownloads(self, seqid, iprot, oprot):
+ args = stopAllDownloads_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = stopAllDownloads_result()
+ self._handler.stopAllDownloads()
+ oprot.writeMessageBegin("stopAllDownloads", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
@@ -3969,39 +3947,6 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
- def process_getProgressInfo(self, seqid, iprot, oprot):
- args = getProgressInfo_args()
- args.read(iprot)
- iprot.readMessageEnd()
- result = getProgressInfo_result()
- result.success = self._handler.getProgressInfo()
- oprot.writeMessageBegin("getProgressInfo", TMessageType.REPLY, seqid)
- result.write(oprot)
- oprot.writeMessageEnd()
- oprot.trans.flush()
-
- def process_stopDownloads(self, seqid, iprot, oprot):
- args = stopDownloads_args()
- args.read(iprot)
- iprot.readMessageEnd()
- result = stopDownloads_result()
- self._handler.stopDownloads(args.fids)
- oprot.writeMessageBegin("stopDownloads", TMessageType.REPLY, seqid)
- result.write(oprot)
- oprot.writeMessageEnd()
- oprot.trans.flush()
-
- def process_stopAllDownloads(self, seqid, iprot, oprot):
- args = stopAllDownloads_args()
- args.read(iprot)
- iprot.readMessageEnd()
- result = stopAllDownloads_result()
- self._handler.stopAllDownloads()
- oprot.writeMessageBegin("stopAllDownloads", TMessageType.REPLY, seqid)
- result.write(oprot)
- oprot.writeMessageEnd()
- oprot.trans.flush()
-
def process_isInteractionWaiting(self, seqid, iprot, oprot):
args = isInteractionWaiting_args()
args.read(iprot)
@@ -4577,6 +4522,33 @@ class toggleReconnect_result(TBase):
self.success = success
+class getProgressInfo_args(TBase):
+
+ __slots__ = [
+ ]
+
+ thrift_spec = (
+ )
+
+
+class getProgressInfo_result(TBase):
+ """
+ Attributes:
+ - success
+ """
+
+ __slots__ = [
+ 'success',
+ ]
+
+ thrift_spec = (
+ (0, TType.LIST, 'success', (TType.STRUCT,(ProgressInfo, ProgressInfo.thrift_spec)), None, ), # 0
+ )
+
+ def __init__(self, success=None,):
+ self.success = success
+
+
class getConfig_args(TBase):
__slots__ = [
@@ -4726,20 +4698,20 @@ class saveConfig_result(TBase):
class deleteConfig_args(TBase):
"""
Attributes:
- - config
+ - plugin
"""
__slots__ = [
- 'config',
+ 'plugin',
]
thrift_spec = (
None, # 0
- (1, TType.STRUCT, 'config', (ConfigHolder, ConfigHolder.thrift_spec), None, ), # 1
+ (1, TType.STRING, 'plugin', None, None, ), # 1
)
- def __init__(self, config=None,):
- self.config = config
+ def __init__(self, plugin=None,):
+ self.plugin = plugin
class deleteConfig_result(TBase):
@@ -6033,46 +6005,50 @@ class restartFailed_result(TBase):
)
-class setFilePaused_args(TBase):
+class stopDownloads_args(TBase):
"""
Attributes:
- - fid
- - paused
+ - fids
"""
__slots__ = [
- 'fid',
- 'paused',
+ 'fids',
]
thrift_spec = (
None, # 0
- (1, TType.I32, 'fid', None, None, ), # 1
- (2, TType.BOOL, 'paused', None, None, ), # 2
+ (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1
)
- def __init__(self, fid=None, paused=None,):
- self.fid = fid
- self.paused = paused
+ def __init__(self, fids=None,):
+ self.fids = fids
-class setFilePaused_result(TBase):
- """
- Attributes:
- - e
- """
+class stopDownloads_result(TBase):
__slots__ = [
- 'e',
]
thrift_spec = (
- None, # 0
- (1, TType.STRUCT, 'e', (FileDoesNotExists, FileDoesNotExists.thrift_spec), None, ), # 1
)
- def __init__(self, e=None,):
- self.e = e
+
+class stopAllDownloads_args(TBase):
+
+ __slots__ = [
+ ]
+
+ thrift_spec = (
+ )
+
+
+class stopAllDownloads_result(TBase):
+
+ __slots__ = [
+ ]
+
+ thrift_spec = (
+ )
class setPackagePaused_args(TBase):
@@ -6362,79 +6338,6 @@ class orderFiles_result(TBase):
)
-class getProgressInfo_args(TBase):
-
- __slots__ = [
- ]
-
- thrift_spec = (
- )
-
-
-class getProgressInfo_result(TBase):
- """
- Attributes:
- - success
- """
-
- __slots__ = [
- 'success',
- ]
-
- thrift_spec = (
- (0, TType.LIST, 'success', (TType.STRUCT,(ProgressInfo, ProgressInfo.thrift_spec)), None, ), # 0
- )
-
- def __init__(self, success=None,):
- self.success = success
-
-
-class stopDownloads_args(TBase):
- """
- Attributes:
- - fids
- """
-
- __slots__ = [
- 'fids',
- ]
-
- thrift_spec = (
- None, # 0
- (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1
- )
-
- def __init__(self, fids=None,):
- self.fids = fids
-
-
-class stopDownloads_result(TBase):
-
- __slots__ = [
- ]
-
- thrift_spec = (
- )
-
-
-class stopAllDownloads_args(TBase):
-
- __slots__ = [
- ]
-
- thrift_spec = (
- )
-
-
-class stopAllDownloads_result(TBase):
-
- __slots__ = [
- ]
-
- thrift_spec = (
- )
-
-
class isInteractionWaiting_args(TBase):
"""
Attributes:
diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
index 815c80819..4b2f6497c 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
@@ -241,83 +241,82 @@ class Role(TBase):
}
-class ProgressInfo(TBase):
+class DownloadProgress(TBase):
"""
Attributes:
- fid
- - name
+ - pid
- speed
- - eta
- - format_eta
- - bleft
- - size
- - format_size
- - percent
- status
- - statusmsg
- - format_wait
- - wait_until
- - packageID
- - packageName
- - plugin
"""
__slots__ = [
'fid',
- 'name',
+ 'pid',
'speed',
- 'eta',
- 'format_eta',
- 'bleft',
- 'size',
- 'format_size',
- 'percent',
'status',
- 'statusmsg',
- 'format_wait',
- 'wait_until',
- 'packageID',
- 'packageName',
- 'plugin',
]
thrift_spec = (
None, # 0
(1, TType.I32, 'fid', None, None, ), # 1
- (2, TType.STRING, 'name', None, None, ), # 2
+ (2, TType.I32, 'pid', None, None, ), # 2
(3, TType.I64, 'speed', None, None, ), # 3
+ (4, TType.I32, 'status', None, None, ), # 4
+ )
+
+ def __init__(self, fid=None, pid=None, speed=None, status=None,):
+ self.fid = fid
+ self.pid = pid
+ self.speed = speed
+ self.status = status
+
+
+class ProgressInfo(TBase):
+ """
+ Attributes:
+ - plugin
+ - name
+ - statusmsg
+ - eta
+ - format_eta
+ - done
+ - total
+ - download
+ """
+
+ __slots__ = [
+ 'plugin',
+ 'name',
+ 'statusmsg',
+ 'eta',
+ 'format_eta',
+ 'done',
+ 'total',
+ 'download',
+ ]
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'plugin', None, None, ), # 1
+ (2, TType.STRING, 'name', None, None, ), # 2
+ (3, TType.STRING, 'statusmsg', None, None, ), # 3
(4, TType.I32, 'eta', None, None, ), # 4
(5, TType.STRING, 'format_eta', None, None, ), # 5
- (6, TType.I64, 'bleft', None, None, ), # 6
- (7, TType.I64, 'size', None, None, ), # 7
- (8, TType.STRING, 'format_size', None, None, ), # 8
- (9, TType.I16, 'percent', None, None, ), # 9
- (10, TType.I32, 'status', None, None, ), # 10
- (11, TType.STRING, 'statusmsg', None, None, ), # 11
- (12, TType.STRING, 'format_wait', None, None, ), # 12
- (13, TType.I64, 'wait_until', None, None, ), # 13
- (14, TType.I32, 'packageID', None, None, ), # 14
- (15, TType.STRING, 'packageName', None, None, ), # 15
- (16, TType.STRING, 'plugin', None, None, ), # 16
+ (6, TType.I64, 'done', None, None, ), # 6
+ (7, TType.I64, 'total', None, None, ), # 7
+ (8, TType.STRUCT, 'download', (DownloadProgress, DownloadProgress.thrift_spec), None, ), # 8
)
- def __init__(self, fid=None, name=None, speed=None, eta=None, format_eta=None, bleft=None, size=None, format_size=None, percent=None, status=None, statusmsg=None, format_wait=None, wait_until=None, packageID=None, packageName=None, plugin=None,):
- self.fid = fid
+ def __init__(self, plugin=None, name=None, statusmsg=None, eta=None, format_eta=None, done=None, total=None, download=None,):
+ self.plugin = plugin
self.name = name
- self.speed = speed
+ self.statusmsg = statusmsg
self.eta = eta
self.format_eta = format_eta
- self.bleft = bleft
- self.size = size
- self.format_size = format_size
- self.percent = percent
- self.status = status
- self.statusmsg = statusmsg
- self.format_wait = format_wait
- self.wait_until = wait_until
- self.packageID = packageID
- self.packageName = packageName
- self.plugin = plugin
+ self.done = done
+ self.total = total
+ self.download = download
class ServerStatus(TBase):