summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/remote/ThriftBackend.py573
-rw-r--r--module/remote/thriftbackend/Handler.py482
-rw-r--r--module/remote/thriftbackend/Processor.py41
-rw-r--r--module/remote/thriftbackend/ThriftTest.py (renamed from module/remote/ThriftTest.py)14
-rw-r--r--module/remote/thriftbackend/__init__.py (renamed from module/remote/thriftgen/__init__.py)0
-rwxr-xr-xmodule/remote/thriftbackend/generateThrift.sh (renamed from module/remote/generateThrift.sh)0
-rw-r--r--module/remote/thriftbackend/pyload.thrift (renamed from module/remote/pyload.thrift)15
-rw-r--r--module/remote/thriftbackend/thriftgen/__init__.py0
-rwxr-xr-xmodule/remote/thriftbackend/thriftgen/pyload/Pyload-remote (renamed from module/remote/thriftgen/pyload/Pyload-remote)0
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/Pyload.py (renamed from module/remote/thriftgen/pyload/Pyload.py)230
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/__init__.py (renamed from module/remote/thriftgen/pyload/__init__.py)0
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/constants.py (renamed from module/remote/thriftgen/pyload/constants.py)0
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/ttypes.py (renamed from module/remote/thriftgen/pyload/ttypes.py)135
13 files changed, 697 insertions, 793 deletions
diff --git a/module/remote/ThriftBackend.py b/module/remote/ThriftBackend.py
index eee2d6d80..07da88447 100644
--- a/module/remote/ThriftBackend.py
+++ b/module/remote/ThriftBackend.py
@@ -16,585 +16,20 @@
@author: mkaay
"""
from module.remote.RemoteManager import BackendBase
-from module.PyFile import PyFile
-from module.remote.thriftgen.pyload import Pyload
-from module.remote.thriftgen.pyload.ttypes import *
+from thriftbackend.Handler import Handler
+from thriftbackend.Processor import Processor
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
-import threading
-import logging
-
-class Processor(Pyload.Processor):
- def __init__(self, *args, **kwargs):
- Pyload.Processor.__init__(self, *args, **kwargs)
- self.authenticated = {}
-
- def process(self, iprot, oprot):
- trans = oprot.trans
- if not self.authenticated.has_key(trans):
- self.authenticated[trans] = False
- oldclose = trans.close
- def wrap():
- del self.authenticated[trans]
- oldclose()
- trans.close = wrap
- authenticated = self.authenticated[trans]
- (name, type, seqid) = iprot.readMessageBegin()
- if name not in self._processMap or (not authenticated and not name == "login"):
- iprot.skip(Pyload.TType.STRUCT)
- iprot.readMessageEnd()
- x = Pyload.TApplicationException(Pyload.TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
- oprot.writeMessageBegin(name, Pyload.TMessageType.EXCEPTION, seqid)
- x.write(oprot)
- oprot.writeMessageEnd()
- oprot.trans.flush()
- return
- elif not authenticated and name == "login":
- args = Pyload.login_args()
- args.read(iprot)
- iprot.readMessageEnd()
- result = Pyload.login_result()
- self.authenticated[trans] = self._handler.login(args.username, args.password)
- result.success = self.authenticated[trans]
- oprot.writeMessageBegin("login", Pyload.TMessageType.REPLY, seqid)
- result.write(oprot)
- oprot.writeMessageEnd()
- oprot.trans.flush()
- else:
- self._processMap[name](self, seqid, iprot, oprot)
- return True
-
-class PyloadHandler:
- def __init__(self, backend):
- self.backend = backend
- self.core = backend.core
- self.serverMethods = self.core.server_methods
-
- #general
- def getConfigValue(self, category, option, section):
- """
- Parameters:
- - category
- - option
- - section
- """
- self.serverMethods.get_conf_val(category, option, section)
-
- def setConfigValue(self, category, option, value, section):
- """
- Parameters:
- - category
- - option
- - value
- - section
- """
- self.serverMethods.set_conf_val(category, option, value, section)
-
- def _convertConfigFormat(self, c):
- sections = []
- for sectionName, sub in c.iteritems():
- section = ConfigSection()
- section.name = sectionName
- section.decription = sub["desc"]
- items = []
- for key, data in sub.iteritems():
- if key == "desc":
- continue
- item = ConfigItem()
- item.name = key
- item.decription = data["desc"]
- item.value = str(data["value"])
- if data["type"] == "str":
- item.type = ConfigItemType.String
- elif data["type"] == "int":
- item.type = ConfigItemType.Integer
- elif data["type"] == "bool":
- item.type = ConfigItemType.Bool
- elif data["type"] == "password":
- item.type = ConfigItemType.Password
- elif data["type"] == "ip":
- item.type = ConfigItemType.IP
- elif data["type"] == "file":
- item.type = ConfigItemType.File
- elif data["type"] == "folder":
- item.type = ConfigItemType.Folder
- elif data["type"] == "time":
- item.type = ConfigItemType.Time
- else:
- item.type = ConfigItemType.Choice
- item.choice = set([x.strip() for x in data["type"].split(";")])
- items.append(item)
- section.items = items
- sections.append(section)
- return sections
-
- def getConfig(self):
- c = self.serverMethods.get_config()
- return self._convertConfigFormat(c)
-
- def getPluginConfig(self):
- c = self.serverMethods.get_plugin_config()
- return self._convertConfigFormat(c)
-
- def pauseServer(self):
- self.serverMethods.pause_server()
-
- def unpauseServer(self):
- self.serverMethods.unpause_server()
-
- def togglePause(self):
- return self.serverMethods.toggle_server()
-
- def statusServer(self):
- status = self.serverMethods.status_server()
- serverStatus = ServerStatus()
- serverStatus.pause = status["pause"]
- serverStatus.active = status["activ"]
- serverStatus.queue = status["queue"]
- serverStatus.total = status["total"]
- serverStatus.speed = status["speed"]
- serverStatus.download = status["download"]
- serverStatus.reconnect = status["reconnect"]
- return serverStatus
-
- def freeSpace(self):
- return self.serverMethods.free_space()
-
- def getServerVersion(self):
- return self.serverMethods.get_server_version()
-
- def kill(self):
- self.serverMethods.kill()
-
- def restart(self):
- self.serverMethods.restart()
-
- def getLog(self, offset):
- """
- Parameters:
- - offset
- """
- return list(self.serverMethods.restart(offset))
-
- def checkURL(self, urls):
- """
- Parameters:
- - urls
- """
- checked = {}
- for u, p in self.core.pluginManager.parseUrls(urls):
- if p == "BasePlugin":
- checked[u] = ""
- else:
- checked[u] = p
- return checked
-
- def isTimeDownload(self):
- return self.serverMethods.is_time_download()
-
- def isTimeReconnect(self):
- return self.serverMethods.is_time_reconnect()
-
- #downloads
- def statusDownloads(self):
- data = []
- for pyfile in [x.active for x in self.core.threadManager.threads + self.core.threadManager.localThreads if x.active and x.active != "quit"]:
- if not isinstance(pyfile, PyFile):
- continue
- status = DownloadStatus()
- status.id = pyfile.id
- status.name = pyfile.name
- status.speed = pyfile.getSpeed()/1024
- status.eta = pyfile.getETA()
- status.format_eta = pyfile.formatETA()
- status.kbleft = pyfile.getBytesLeft() #holded for backward comp.
- status.bleft = pyfile.getBytesLeft()
- status.size = pyfile.getSize()
- status.format_size = pyfile.formatSize()
- status.percent = pyfile.getPercent()
- status.status = pyfile.status
- status.statusmsg = pyfile.m.statusMsg[pyfile.status]
- status.format_wait = pyfile.formatWait()
- status.wait_until = pyfile.waitUntil
- status.package = pyfile.package().name
- data.append(status)
- return data
-
- def addPackage(self, name, links, dest):
- """
- Parameters:
- - name
- - links
- - dest
- """
- return self.serverMethods.add_package(name, links, dest)
-
- def getPackageData(self, pid):
- """
- Parameters:
- - pid
- """
- pdata = PackageData()
- rawData = self.serverMethods.get_package_data(pid)
- pdata.pid = rawData["id"]
- pdata.name = rawData["name"]
- pdata.folder = rawData["folder"]
- pdata.site = rawData["site"]
- pdata.password = rawData["password"]
- pdata.queue = rawData["queue"]
- pdata.order = rawData["order"]
- pdata.priority = rawData["priority"]
- pdata.links = []
- for pyfile in rawData["links"]:
- pdata.links.append(pyfile["id"])
- return pdata
-
- def getFileData(self, fid):
- """
- Parameters:
- - fid
- """
- fdata = FileData()
- rawData = self.serverMethods.get_file_data(pid)
- fdata.pid = rawData["id"]
- fdata.url = rawData["url"]
- fdata.name = rawData["name"]
- fdata.plugin = rawData["plugin"]
- fdata.size = rawData["size"]
- fdata.format_size = rawData["format_size"]
- fdata.status = rawData["status"]
- fdata.statusmsg = rawData["statusmsg"]
- fdata.package = rawData["package"]
- fdata.error = rawData["error"]
- fdata.order = rawData["order"]
- fdata.progress = rawData["progress"]
- return fdata
-
- def deleteFiles(self, fids):
- """
- Parameters:
- - fids
- """
- self.serverMethods.del_links(fids)
-
- def deletePackages(self, pids):
- """
- Parameters:
- - pids
- """
- self.serverMethods.del_packages(pids)
-
- def getQueue(self):
- packs = self.serverMethods.get_queue()
- ret = []
- for pid in packs:
- pack = self.serverMethods.get_package_data(pid)
- pdata = PackageData()
- pdata.pid = pack["id"]
- pdata.name = pack["name"]
- pdata.folder = pack["folder"]
- pdata.site = pack["site"]
- pdata.password = pack["password"]
- pdata.queue = pack["queue"]
- pdata.order = pack["order"]
- pdata.priority = pack["priority"]
- pdata.fileids = [int(x) for x in pack["links"].keys()]
- ret.append(pdata)
- return ret
-
- def getCollector(self):
- packs = self.serverMethods.get_queue()
- ret = []
- for pid in packs:
- pack = self.serverMethods.get_package_data(pid)
- pdata = PackageData()
- pdata.pid = pack["id"]
- pdata.name = pack["name"]
- pdata.folder = pack["folder"]
- pdata.site = pack["site"]
- pdata.password = pack["password"]
- pdata.queue = pack["queue"]
- pdata.order = pack["order"]
- pdata.priority = pack["priority"]
- pdata.fileids = [int(x) for x in pack["links"].keys()]
- ret.append(pdata)
- return ret
-
- def addFiles(self, pid, links):
- """
- Parameters:
- - pid
- - links
- """
- self.serverMethods.add_files(pid, links)
-
- def pushToQueue(self, pid):
- """
- Parameters:
- - pid
- """
- self.serverMethods.push_package_to_queue(pid)
-
- def pullFromQueue(self, pid):
- """
- Parameters:
- - pid
- """
- self.serverMethods.pull_out_package(pid)
-
- def restartPackage(self, pid):
- """
- Parameters:
- - pid
- """
- self.serverMethods.restart_package(pid)
-
- def restartFile(self, fid):
- """
- Parameters:
- - fid
- """
- self.serverMethods.restart_file(fid)
-
- def recheckPackage(self, pid):
- """
- Parameters:
- - pid
- """
- self.serverMethods.recheck_package(pid)
-
- def stopAllDownloads(self):
- self.serverMethods.stop_downloads()
-
- def stopDownloads(self, fids):
- """
- Parameters:
- - fids
- """
- self.serverMethods.abort_files(fids)
-
- def setPackageName(self, pid, name):
- """
- Parameters:
- - pid
- - name
- """
- self.serverMethods.set_package_name(pid, name)
-
- def movePackage(self, destination, pid):
- """
- Parameters:
- - destination
- - pid
- """
- self.serverMethods.move_package(destination, pid)
-
- def uploadContainer(self, filename, data):
- """
- Parameters:
- - filename
- - data
- """
- self.serverMethods.upload_container(filename, data)
-
- def setPriority(self, pid, priority):
- """
- Parameters:
- - pid
- - priority
- """
- self.serverMethods.set_priority(pid, priority)
-
- def orderPackage(self, pid, position):
- """
- Parameters:
- - pid
- - position
- """
- self.serverMethods.order_package(pid, position)
-
- def orderFile(self, fid, position):
- """
- Parameters:
- - fid
- - position
- """
- self.serverMethods.order_file(fid, position)
-
- def setPackageData(self, pid, data):
- """
- Parameters:
- - pid
- - data
- """
- packdata = {}
- packdata["id"] = data.pid
- packdata["name"] = data.name
- packdata["folder"] = data.folder
- packdata["site"] = data.site
- packdata["password"] = data.password
- packdata["queue"] = data.queue
- packdata["order"] = data.order
- packdata["priority"] = data.priority
- self.serverMethods.set_package_data(pid, packdata)
-
- def deleteFinished(self):
- self.serverMethods.delete_finished()
-
- def restartFailed(self):
- self.serverMethods.restart_failed()
-
- def getPackageOrder(self, destination):
- """
- Parameters:
- - destination
- """
- order = {}
- if destination == Destination.Queue:
- packs = self.serverMethods.get_queue()
- else:
- packs = self.serverMethods.get_collector()
- for pid in packs:
- pack = self.serverMethods.get_package_data(pid)
- order[pack["order"]] = pack["id"]
- return order
-
- def getFileOrder(self, pid):
- """
- Parameters:
- - pid
- """
- rawData = self.serverMethods.get_package_data(pid)
- order = {}
- for pyfile in rawData["links"]:
- order[pyfile["order"]] = pyfile["id"]
- return order
-
- #captcha
- def isCaptchaWaiting(self):
- return self.serverMethods.is_captcha_waiting()
-
- def getCaptchaTask(self, exclusive):
- """
- Parameters:
- - exclusive
- """
- t = CaptchaTask()
- t.tid, t.data, t.type = self.serverMethods.get_captcha_task(exclusive)
- return t
-
- def getCaptchaTaskStatus(self, tid):
- """
- Parameters:
- - tid
- """
- status = self.serverMethods.get_task_status(tid)
- if status == "init":
- return CaptchaStatus.Init
- elif status == "waiting":
- return CaptchaStatus.Waiting
- elif status == "user":
- return CaptchaStatus.User
- elif status == "shared-user":
- return CaptchaStatus.SharedUser
- elif status == "done":
- return CaptchaStatus.Done
-
- def setCaptchaResult(self, tid, result):
- """
- Parameters:
- - tid
- - result
- """
- self.serverMethods.set_captcha_result(tid, result)
-
- #events
- def getEvents(self):
- events = serverMethods.get_events()
- newEvents = []
- for e in events:
- e = Event()
- if e[0] in ("update", "remove", "insert"):
- event.id = e[3]
- event.type = ElementType.Package if e[2] == "pack" else ElementType.File
- event.destination = e[1]
- if e[0] == "update":
- event.event = EventType.Update
- elif e[0] == "remove":
- event.event = EventType.Remove
- elif e[0] == "insert":
- event.event = EventType.Insert
- elif e[0] == "reload":
- event.event = EventType.ReloadAll
- event.destination = e[1]
- elif e[0] == "account":
- event.event = EventType.ReloadAccounts
- elif e[0] == "config":
- event.event = EventType.ReloadConfig
- elif e[0] == "order":
- event.event = EventType.ReloadOrder
- if e[1]:
- event.id = e[1]
- event.type = ElementType.Package if e[2] == "pack" else ElementType.File
- event.destination = e[3]
- newEvents.append(event)
- return newEvents
-
- #accounts
- def getAccounts(self):
- accs = self.serverMethods.get_accounts()
- accounts = []
- for group in accs.values():
- for acc in group:
- account = AccountInfo()
- account.validuntil = acc["validuntil"]
- account.login = acc["login"]
- account.options = acc["options"]
- account.valid = acc["valid"]
- account.trafficleft = acc["trafficleft"]
- account.maxtraffic = acc["maxtraffic"]
- account.premium = acc["premium"]
- account.type = acc["type"]
- accounts.append(account)
- return accounts
-
- def updateAccounts(self, data):
- """
- Parameters:
- - data
- """
- self.serverMethods.update_account(data.type, data.login, data.password, data.options)
-
- def removeAccount(self, plugin, account):
- """
- Parameters:
- - plugin
- - account
- """
- self.serverMethods.remove_account(plugin, account)
-
- #auth
- def login(self, username, password):
- """
- Parameters:
- - username
- - password
- """
- return True if self.serverMethods.checkAuth(username, password) else False
-
- def getUserData(self):
- return self.serverMethods.checkAuth(username, password)
-
class ThriftBackend(BackendBase):
def setup(self):
- handler = PyloadHandler(self)
+ handler = Handler(self)
processor = Processor(handler)
- transport = TSocket.TServerSocket(9090)
+ transport = TSocket.TServerSocket(7228)
tfactory = TTransport.TBufferedTransportFactory()
pfactory = TBinaryProtocol.TBinaryProtocolFactory()
diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py
new file mode 100644
index 000000000..941efbcce
--- /dev/null
+++ b/module/remote/thriftbackend/Handler.py
@@ -0,0 +1,482 @@
+from thriftgen.pyload.ttypes import *
+
+from module.PyFile import PyFile
+
+class Handler:
+ def __init__(self, backend):
+ self.backend = backend
+ self.core = backend.core
+ self.serverMethods = self.core.server_methods
+
+ #general
+ def getConfigValue(self, category, option, section):
+ """
+ Parameters:
+ - category
+ - option
+ - section
+ """
+ self.serverMethods.get_conf_val(category, option, section)
+
+ def setConfigValue(self, category, option, value, section):
+ """
+ Parameters:
+ - category
+ - option
+ - value
+ - section
+ """
+ self.serverMethods.set_conf_val(category, option, value, section)
+
+ def _convertConfigFormat(self, c):
+ sections = []
+ for sectionName, sub in c.iteritems():
+ section = ConfigSection()
+ section.name = sectionName
+ section.decription = sub["desc"]
+ items = []
+ for key, data in sub.iteritems():
+ if key == "desc":
+ continue
+ item = ConfigItem()
+ item.name = key
+ item.decription = data["desc"]
+ item.value = str(data["value"])
+ item.type = data["type"]
+ items.append(item)
+ section.items = items
+ sections.append(section)
+ return sections
+
+ def getConfig(self):
+ c = self.serverMethods.get_config()
+ return self._convertConfigFormat(c)
+
+ def getPluginConfig(self):
+ c = self.serverMethods.get_plugin_config()
+ return self._convertConfigFormat(c)
+
+ def pauseServer(self):
+ self.serverMethods.pause_server()
+
+ def unpauseServer(self):
+ self.serverMethods.unpause_server()
+
+ def togglePause(self):
+ return self.serverMethods.toggle_server()
+
+ def statusServer(self):
+ status = self.serverMethods.status_server()
+ serverStatus = ServerStatus()
+ serverStatus.pause = status["pause"]
+ serverStatus.active = status["activ"]
+ serverStatus.queue = status["queue"]
+ serverStatus.total = status["total"]
+ serverStatus.speed = status["speed"]
+ serverStatus.download = status["download"]
+ serverStatus.reconnect = status["reconnect"]
+ return serverStatus
+
+ def freeSpace(self):
+ return self.serverMethods.free_space()
+
+ def getServerVersion(self):
+ return self.serverMethods.get_server_version()
+
+ def kill(self):
+ self.serverMethods.kill()
+
+ def restart(self):
+ self.serverMethods.restart()
+
+ def getLog(self, offset):
+ """
+ Parameters:
+ - offset
+ """
+ return list(self.serverMethods.restart(offset))
+
+ def checkURL(self, urls):
+ """
+ Parameters:
+ - urls
+ """
+ checked = {}
+ for u, p in self.core.pluginManager.parseUrls(urls):
+ if p == "BasePlugin":
+ checked[u] = ""
+ else:
+ checked[u] = p
+ return checked
+
+ def isTimeDownload(self):
+ return self.serverMethods.is_time_download()
+
+ def isTimeReconnect(self):
+ return self.serverMethods.is_time_reconnect()
+
+ #downloads
+ def statusDownloads(self):
+ data = []
+ for pyfile in [x.active for x in self.core.threadManager.threads + self.core.threadManager.localThreads if
+ x.active and x.active != "quit"]:
+ if not isinstance(pyfile, PyFile):
+ continue
+ status = DownloadStatus()
+ status.id = pyfile.id
+ status.name = pyfile.name
+ status.speed = pyfile.getSpeed() / 1024
+ status.eta = pyfile.getETA()
+ status.format_eta = pyfile.formatETA()
+ status.kbleft = pyfile.getBytesLeft() #holded for backward comp.
+ status.bleft = pyfile.getBytesLeft()
+ status.size = pyfile.getSize()
+ status.format_size = pyfile.formatSize()
+ status.percent = pyfile.getPercent()
+ status.status = pyfile.status
+ status.statusmsg = pyfile.m.statusMsg[pyfile.status]
+ status.format_wait = pyfile.formatWait()
+ status.wait_until = pyfile.waitUntil
+ status.package = pyfile.package().name
+ data.append(status)
+ return data
+
+ def addPackage(self, name, links, dest):
+ """
+ Parameters:
+ - name
+ - links
+ - dest
+ """
+ return self.serverMethods.add_package(name, links, dest)
+
+ def getPackageData(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ pdata = PackageData()
+ rawData = self.serverMethods.get_package_data(pid)
+ pdata.pid = rawData["id"]
+ pdata.name = rawData["name"]
+ pdata.folder = rawData["folder"]
+ pdata.site = rawData["site"]
+ pdata.password = rawData["password"]
+ pdata.queue = rawData["queue"]
+ pdata.order = rawData["order"]
+ pdata.priority = rawData["priority"]
+ pdata.links = []
+ for pyfile in rawData["links"]:
+ pdata.links.append(pyfile["id"])
+ return pdata
+
+ def getFileData(self, fid):
+ """
+ Parameters:
+ - fid
+ """
+ fdata = FileData()
+ rawData = self.serverMethods.get_file_data(fid)
+ fdata.pid = rawData["id"]
+ fdata.url = rawData["url"]
+ fdata.name = rawData["name"]
+ fdata.plugin = rawData["plugin"]
+ fdata.size = rawData["size"]
+ fdata.format_size = rawData["format_size"]
+ fdata.status = rawData["status"]
+ fdata.statusmsg = rawData["statusmsg"]
+ fdata.package = rawData["package"]
+ fdata.error = rawData["error"]
+ fdata.order = rawData["order"]
+ fdata.progress = rawData["progress"]
+ return fdata
+
+ def deleteFiles(self, fids):
+ """
+ Parameters:
+ - fids
+ """
+ self.serverMethods.del_links(fids)
+
+ def deletePackages(self, pids):
+ """
+ Parameters:
+ - pids
+ """
+ self.serverMethods.del_packages(pids)
+
+ def getQueue(self):
+ packs = self.serverMethods.get_queue()
+ ret = []
+ for pid in packs:
+ pack = self.serverMethods.get_package_data(pid)
+ pdata = PackageData()
+ pdata.pid = pack["id"]
+ pdata.name = pack["name"]
+ pdata.folder = pack["folder"]
+ pdata.site = pack["site"]
+ pdata.password = pack["password"]
+ pdata.queue = pack["queue"]
+ pdata.order = pack["order"]
+ pdata.priority = pack["priority"]
+ pdata.fileids = [int(x) for x in pack["links"].keys()]
+ ret.append(pdata)
+ return ret
+
+ def getCollector(self):
+ packs = self.serverMethods.get_queue()
+ ret = []
+ for pid in packs:
+ pack = self.serverMethods.get_package_data(pid)
+ pdata = PackageData()
+ pdata.pid = pack["id"]
+ pdata.name = pack["name"]
+ pdata.folder = pack["folder"]
+ pdata.site = pack["site"]
+ pdata.password = pack["password"]
+ pdata.queue = pack["queue"]
+ pdata.order = pack["order"]
+ pdata.priority = pack["priority"]
+ pdata.fileids = [int(x) for x in pack["links"].keys()]
+ ret.append(pdata)
+ return ret
+
+ def addFiles(self, pid, links):
+ """
+ Parameters:
+ - pid
+ - links
+ """
+ self.serverMethods.add_files(pid, links)
+
+ def pushToQueue(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ self.serverMethods.push_package_to_queue(pid)
+
+ def pullFromQueue(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ self.serverMethods.pull_out_package(pid)
+
+ def restartPackage(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ self.serverMethods.restart_package(pid)
+
+ def restartFile(self, fid):
+ """
+ Parameters:
+ - fid
+ """
+ self.serverMethods.restart_file(fid)
+
+ def recheckPackage(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ self.serverMethods.recheck_package(pid)
+
+ def stopAllDownloads(self):
+ self.serverMethods.stop_downloads()
+
+ def stopDownloads(self, fids):
+ """
+ Parameters:
+ - fids
+ """
+ self.serverMethods.abort_files(fids)
+
+ def setPackageName(self, pid, name):
+ """
+ Parameters:
+ - pid
+ - name
+ """
+ self.serverMethods.set_package_name(pid, name)
+
+ def movePackage(self, destination, pid):
+ """
+ Parameters:
+ - destination
+ - pid
+ """
+ self.serverMethods.move_package(destination, pid)
+
+ def uploadContainer(self, filename, data):
+ """
+ Parameters:
+ - filename
+ - data
+ """
+ self.serverMethods.upload_container(filename, data)
+
+ def setPriority(self, pid, priority):
+ """
+ Parameters:
+ - pid
+ - priority
+ """
+ self.serverMethods.set_priority(pid, priority)
+
+ def orderPackage(self, pid, position):
+ """
+ Parameters:
+ - pid
+ - position
+ """
+ self.serverMethods.order_package(pid, position)
+
+ def orderFile(self, fid, position):
+ """
+ Parameters:
+ - fid
+ - position
+ """
+ self.serverMethods.order_file(fid, position)
+
+ def setPackageData(self, pid, data):
+ """
+ Parameters:
+ - pid
+ - data
+ """
+ packdata = {"id": data.pid,
+ "name": data.name,
+ "folder": data.folder,
+ "site": data.site,
+ "password": data.password,
+ "queue": data.queue,
+ "order": data.order,
+ "priority": data.priority}
+ self.serverMethods.set_package_data(pid, packdata)
+
+ def deleteFinished(self):
+ self.serverMethods.delete_finished()
+
+ def restartFailed(self):
+ self.serverMethods.restart_failed()
+
+ def getPackageOrder(self, destination):
+ """
+ Parameters:
+ - destination
+ """
+ order = {}
+ if destination == Destination.Queue:
+ packs = self.serverMethods.get_queue()
+ else:
+ packs = self.serverMethods.get_collector()
+ for pid in packs:
+ pack = self.serverMethods.get_package_data(pid)
+ order[pack["order"]] = pack["id"]
+ return order
+
+ def getFileOrder(self, pid):
+ """
+ Parameters:
+ - pid
+ """
+ rawData = self.serverMethods.get_package_data(pid)
+ order = {}
+ for pyfile in rawData["links"]:
+ order[pyfile["order"]] = pyfile["id"]
+ return order
+
+ #captcha
+ def isCaptchaWaiting(self):
+ return self.serverMethods.is_captcha_waiting()
+
+ def getCaptchaTask(self, exclusive):
+ """
+ Parameters:
+ - exclusive
+ """
+ t = CaptchaTask()
+ t.tid, t.data, t.type = self.serverMethods.get_captcha_task(exclusive)
+ return t
+
+ def getCaptchaTaskStatus(self, tid):
+ """
+ Parameters:
+ - tid
+ """
+ return self.serverMethods.get_task_status(tid)
+
+ def setCaptchaResult(self, tid, result):
+ """
+ Parameters:
+ - tid
+ - result
+ """
+ self.serverMethods.set_captcha_result(tid, result)
+
+ #events
+ def getEvents(self):
+ events = self.serverMethods.get_events()
+ newEvents = []
+ for e in events:
+ event = Event()
+ if e[0] in ("update", "remove", "insert"):
+ event.id = e[3]
+ event.type = ElementType.Package if e[2] == "pack" else ElementType.File
+ event.destination = e[1]
+ elif e[0] == "order":
+ if e[1]:
+ event.id = e[1]
+ event.type = ElementType.Package if e[2] == "pack" else ElementType.File
+ event.destination = e[3]
+ newEvents.append(event)
+ return newEvents
+
+ #accounts
+ def getAccounts(self):
+ accs = self.serverMethods.get_accounts()
+ accounts = []
+ for group in accs.values():
+ for acc in group:
+ account = AccountInfo()
+ account.validuntil = acc["validuntil"]
+ account.login = acc["login"]
+ account.options = acc["options"]
+ account.valid = acc["valid"]
+ account.trafficleft = acc["trafficleft"]
+ account.maxtraffic = acc["maxtraffic"]
+ account.premium = acc["premium"]
+ account.type = acc["type"]
+ accounts.append(account)
+ return accounts
+
+ def updateAccounts(self, data):
+ """
+ Parameters:
+ - data
+ """
+ self.serverMethods.update_account(data.type, data.login, data.password, data.options)
+
+ def removeAccount(self, plugin, account):
+ """
+ Parameters:
+ - plugin
+ - account
+ """
+ self.serverMethods.remove_account(plugin, account)
+
+ #auth
+ def login(self, username, password):
+ """
+ Parameters:
+ - username
+ - password
+ """
+ return True if self.serverMethods.checkAuth(username, password) else False
+
+ def getUserData(self):
+ return self.serverMethods.checkAuth(username, password)
diff --git a/module/remote/thriftbackend/Processor.py b/module/remote/thriftbackend/Processor.py
new file mode 100644
index 000000000..b3a0991dd
--- /dev/null
+++ b/module/remote/thriftbackend/Processor.py
@@ -0,0 +1,41 @@
+from thriftgen.pyload import Pyload
+
+class Processor(Pyload.Processor):
+ def __init__(self, *args, **kwargs):
+ Pyload.Processor.__init__(self, *args, **kwargs)
+ self.authenticated = {}
+
+ def process(self, iprot, oprot):
+ trans = oprot.trans
+ if not self.authenticated.has_key(trans):
+ self.authenticated[trans] = False
+ oldclose = trans.close
+ def wrap():
+ del self.authenticated[trans]
+ oldclose()
+ trans.close = wrap
+ authenticated = self.authenticated[trans]
+ (name, type, seqid) = iprot.readMessageBegin()
+ if name not in self._processMap or (not authenticated and not name == "login"):
+ iprot.skip(Pyload.TType.STRUCT)
+ iprot.readMessageEnd()
+ x = Pyload.TApplicationException(Pyload.TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
+ oprot.writeMessageBegin(name, Pyload.TMessageType.EXCEPTION, seqid)
+ x.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+ return
+ elif not authenticated and name == "login":
+ args = Pyload.login_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = Pyload.login_result()
+ self.authenticated[trans] = self._handler.login(args.username, args.password)
+ result.success = self.authenticated[trans]
+ oprot.writeMessageBegin("login", Pyload.TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+ else:
+ self._processMap[name](self, seqid, iprot, oprot)
+ return True \ No newline at end of file
diff --git a/module/remote/ThriftTest.py b/module/remote/thriftbackend/ThriftTest.py
index fe24c1031..d73f04ade 100644
--- a/module/remote/ThriftTest.py
+++ b/module/remote/thriftbackend/ThriftTest.py
@@ -1,5 +1,11 @@
#!/usr/bin/env python
+import sys
+from os.path import join,abspath,dirname
+
+path = join((abspath(dirname(__file__))), "..","..", "lib")
+sys.path.append(path)
+
from thriftgen.pyload import Pyload
from thriftgen.pyload.ttypes import *
@@ -14,7 +20,7 @@ import xmlrpclib
def bench(f, *args, **kwargs):
s = time()
- ret = f(*args, **kwargs)
+ ret = [f(*args, **kwargs) for i in range(0,200)]
e = time()
print "time", e-s
return ret
@@ -35,7 +41,7 @@ print
try:
# Make socket
- transport = TSocket.TSocket('localhost', 9090)
+ transport = TSocket.TSocket('localhost', 7228)
# Buffering is critical. Raw sockets are very slow
transport = TTransport.TBufferedTransport(transport)
@@ -49,7 +55,7 @@ try:
# Connect!
transport.open()
- client.login("user", "password")
+ print "Login", client.login("User", "password")
bench(client.getServerVersion)
bench(client.getQueue)
@@ -59,4 +65,4 @@ try:
transport.close()
except Thrift.TException, tx:
- print '%s' % (tx.message)
+ print 'ThriftExpection: %s' % (tx.message)
diff --git a/module/remote/thriftgen/__init__.py b/module/remote/thriftbackend/__init__.py
index e69de29bb..e69de29bb 100644
--- a/module/remote/thriftgen/__init__.py
+++ b/module/remote/thriftbackend/__init__.py
diff --git a/module/remote/generateThrift.sh b/module/remote/thriftbackend/generateThrift.sh
index 833d0dec5..833d0dec5 100755
--- a/module/remote/generateThrift.sh
+++ b/module/remote/thriftbackend/generateThrift.sh
diff --git a/module/remote/pyload.thrift b/module/remote/thriftbackend/pyload.thrift
index 4fb054cd1..106256e40 100644
--- a/module/remote/pyload.thrift
+++ b/module/remote/thriftbackend/pyload.thrift
@@ -33,16 +33,6 @@ enum ElementType {
File
}
-enum EventType {
- ReloadAll,
- ReloadAccounts,
- ReloadConfig,
- ReloadOrder,
- Update,
- Remove,
- Insert
-}
-
struct DownloadStatus {
1: FileID id,
2: string name,
@@ -76,7 +66,6 @@ struct ConfigItem {
2: string description,
3: string value,
4: string type,
- 5: optional set<string> choice
}
struct ConfigSection {
@@ -109,7 +98,7 @@ struct PackageData {
6: Destination destination,
7: i16 order,
8: Priority priority,
- 9: optional list<FileID> fileids
+ 9: optional list<FileID> links
}
struct CaptchaTask {
@@ -119,7 +108,7 @@ struct CaptchaTask {
}
struct Event {
- 1: EventType event,
+ 1: string event,
2: optional i32 id,
3: optional ElementType type,
4: optional Destination destination
diff --git a/module/remote/thriftbackend/thriftgen/__init__.py b/module/remote/thriftbackend/thriftgen/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/module/remote/thriftbackend/thriftgen/__init__.py
diff --git a/module/remote/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
index cd8a1d703..cd8a1d703 100755
--- a/module/remote/thriftgen/pyload/Pyload-remote
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
diff --git a/module/remote/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
index 032c1baaa..2456531cb 100644
--- a/module/remote/thriftgen/pyload/Pyload.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -2790,11 +2790,11 @@ class getConfig_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype42, _size39) = iprot.readListBegin()
- for _i43 in xrange(_size39):
- _elem44 = ConfigSection()
- _elem44.read(iprot)
- self.success.append(_elem44)
+ (_etype35, _size32) = iprot.readListBegin()
+ for _i36 in xrange(_size32):
+ _elem37 = ConfigSection()
+ _elem37.read(iprot)
+ self.success.append(_elem37)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -2811,8 +2811,8 @@ class getConfig_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter45 in self.success:
- iter45.write(oprot)
+ for iter38 in self.success:
+ iter38.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -2898,11 +2898,11 @@ class getPluginConfig_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype49, _size46) = iprot.readListBegin()
- for _i50 in xrange(_size46):
- _elem51 = ConfigSection()
- _elem51.read(iprot)
- self.success.append(_elem51)
+ (_etype42, _size39) = iprot.readListBegin()
+ for _i43 in xrange(_size39):
+ _elem44 = ConfigSection()
+ _elem44.read(iprot)
+ self.success.append(_elem44)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -2919,8 +2919,8 @@ class getPluginConfig_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter52 in self.success:
- iter52.write(oprot)
+ for iter45 in self.success:
+ iter45.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -3749,10 +3749,10 @@ class getLog_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype56, _size53) = iprot.readListBegin()
- for _i57 in xrange(_size53):
- _elem58 = iprot.readString();
- self.success.append(_elem58)
+ (_etype49, _size46) = iprot.readListBegin()
+ for _i50 in xrange(_size46):
+ _elem51 = iprot.readString();
+ self.success.append(_elem51)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -3769,8 +3769,8 @@ class getLog_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRING, len(self.success))
- for iter59 in self.success:
- oprot.writeString(iter59)
+ for iter52 in self.success:
+ oprot.writeString(iter52)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -3816,10 +3816,10 @@ class checkURL_args:
if fid == 1:
if ftype == TType.LIST:
self.urls = []
- (_etype63, _size60) = iprot.readListBegin()
- for _i64 in xrange(_size60):
- _elem65 = iprot.readString();
- self.urls.append(_elem65)
+ (_etype56, _size53) = iprot.readListBegin()
+ for _i57 in xrange(_size53):
+ _elem58 = iprot.readString();
+ self.urls.append(_elem58)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -3836,8 +3836,8 @@ class checkURL_args:
if self.urls != None:
oprot.writeFieldBegin('urls', TType.LIST, 1)
oprot.writeListBegin(TType.STRING, len(self.urls))
- for iter66 in self.urls:
- oprot.writeString(iter66)
+ for iter59 in self.urls:
+ oprot.writeString(iter59)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -3882,11 +3882,11 @@ class checkURL_result:
if fid == 0:
if ftype == TType.MAP:
self.success = {}
- (_ktype68, _vtype69, _size67 ) = iprot.readMapBegin()
- for _i71 in xrange(_size67):
- _key72 = iprot.readString();
- _val73 = iprot.readString();
- self.success[_key72] = _val73
+ (_ktype61, _vtype62, _size60 ) = iprot.readMapBegin()
+ for _i64 in xrange(_size60):
+ _key65 = iprot.readString();
+ _val66 = iprot.readString();
+ self.success[_key65] = _val66
iprot.readMapEnd()
else:
iprot.skip(ftype)
@@ -3903,9 +3903,9 @@ class checkURL_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.MAP, 0)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success))
- for kiter74,viter75 in self.success.items():
- oprot.writeString(kiter74)
- oprot.writeString(viter75)
+ for kiter67,viter68 in self.success.items():
+ oprot.writeString(kiter67)
+ oprot.writeString(viter68)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -4189,11 +4189,11 @@ class statusDownloads_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype79, _size76) = iprot.readListBegin()
- for _i80 in xrange(_size76):
- _elem81 = DownloadStatus()
- _elem81.read(iprot)
- self.success.append(_elem81)
+ (_etype72, _size69) = iprot.readListBegin()
+ for _i73 in xrange(_size69):
+ _elem74 = DownloadStatus()
+ _elem74.read(iprot)
+ self.success.append(_elem74)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -4210,8 +4210,8 @@ class statusDownloads_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter82 in self.success:
- iter82.write(oprot)
+ for iter75 in self.success:
+ iter75.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -4268,10 +4268,10 @@ class addPackage_args:
elif fid == 2:
if ftype == TType.LIST:
self.links = []
- (_etype86, _size83) = iprot.readListBegin()
- for _i87 in xrange(_size83):
- _elem88 = iprot.readString();
- self.links.append(_elem88)
+ (_etype79, _size76) = iprot.readListBegin()
+ for _i80 in xrange(_size76):
+ _elem81 = iprot.readString();
+ self.links.append(_elem81)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -4297,8 +4297,8 @@ class addPackage_args:
if self.links != None:
oprot.writeFieldBegin('links', TType.LIST, 2)
oprot.writeListBegin(TType.STRING, len(self.links))
- for iter89 in self.links:
- oprot.writeString(iter89)
+ for iter82 in self.links:
+ oprot.writeString(iter82)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.dest != None:
@@ -4642,10 +4642,10 @@ class deleteFiles_args:
if fid == 1:
if ftype == TType.LIST:
self.fids = []
- (_etype93, _size90) = iprot.readListBegin()
- for _i94 in xrange(_size90):
- _elem95 = iprot.readI32();
- self.fids.append(_elem95)
+ (_etype86, _size83) = iprot.readListBegin()
+ for _i87 in xrange(_size83):
+ _elem88 = iprot.readI32();
+ self.fids.append(_elem88)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -4662,8 +4662,8 @@ class deleteFiles_args:
if self.fids != None:
oprot.writeFieldBegin('fids', TType.LIST, 1)
oprot.writeListBegin(TType.I32, len(self.fids))
- for iter96 in self.fids:
- oprot.writeI32(iter96)
+ for iter89 in self.fids:
+ oprot.writeI32(iter89)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -4750,10 +4750,10 @@ class deletePackages_args:
if fid == 1:
if ftype == TType.LIST:
self.pids = []
- (_etype100, _size97) = iprot.readListBegin()
- for _i101 in xrange(_size97):
- _elem102 = iprot.readI32();
- self.pids.append(_elem102)
+ (_etype93, _size90) = iprot.readListBegin()
+ for _i94 in xrange(_size90):
+ _elem95 = iprot.readI32();
+ self.pids.append(_elem95)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -4770,8 +4770,8 @@ class deletePackages_args:
if self.pids != None:
oprot.writeFieldBegin('pids', TType.LIST, 1)
oprot.writeListBegin(TType.I32, len(self.pids))
- for iter103 in self.pids:
- oprot.writeI32(iter103)
+ for iter96 in self.pids:
+ oprot.writeI32(iter96)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -4898,11 +4898,11 @@ class getQueue_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype107, _size104) = iprot.readListBegin()
- for _i108 in xrange(_size104):
- _elem109 = PackageData()
- _elem109.read(iprot)
- self.success.append(_elem109)
+ (_etype100, _size97) = iprot.readListBegin()
+ for _i101 in xrange(_size97):
+ _elem102 = PackageData()
+ _elem102.read(iprot)
+ self.success.append(_elem102)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -4919,8 +4919,8 @@ class getQueue_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter110 in self.success:
- iter110.write(oprot)
+ for iter103 in self.success:
+ iter103.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -5006,11 +5006,11 @@ class getCollector_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype114, _size111) = iprot.readListBegin()
- for _i115 in xrange(_size111):
- _elem116 = PackageData()
- _elem116.read(iprot)
- self.success.append(_elem116)
+ (_etype107, _size104) = iprot.readListBegin()
+ for _i108 in xrange(_size104):
+ _elem109 = PackageData()
+ _elem109.read(iprot)
+ self.success.append(_elem109)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -5027,8 +5027,8 @@ class getCollector_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter117 in self.success:
- iter117.write(oprot)
+ for iter110 in self.success:
+ iter110.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -5082,10 +5082,10 @@ class addFiles_args:
elif fid == 2:
if ftype == TType.LIST:
self.links = []
- (_etype121, _size118) = iprot.readListBegin()
- for _i122 in xrange(_size118):
- _elem123 = iprot.readString();
- self.links.append(_elem123)
+ (_etype114, _size111) = iprot.readListBegin()
+ for _i115 in xrange(_size111):
+ _elem116 = iprot.readString();
+ self.links.append(_elem116)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -5106,8 +5106,8 @@ class addFiles_args:
if self.links != None:
oprot.writeFieldBegin('links', TType.LIST, 2)
oprot.writeListBegin(TType.STRING, len(self.links))
- for iter124 in self.links:
- oprot.writeString(iter124)
+ for iter117 in self.links:
+ oprot.writeString(iter117)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -5776,10 +5776,10 @@ class stopDownloads_args:
if fid == 1:
if ftype == TType.LIST:
self.fids = []
- (_etype128, _size125) = iprot.readListBegin()
- for _i129 in xrange(_size125):
- _elem130 = iprot.readI32();
- self.fids.append(_elem130)
+ (_etype121, _size118) = iprot.readListBegin()
+ for _i122 in xrange(_size118):
+ _elem123 = iprot.readI32();
+ self.fids.append(_elem123)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -5796,8 +5796,8 @@ class stopDownloads_args:
if self.fids != None:
oprot.writeFieldBegin('fids', TType.LIST, 1)
oprot.writeListBegin(TType.I32, len(self.fids))
- for iter131 in self.fids:
- oprot.writeI32(iter131)
+ for iter124 in self.fids:
+ oprot.writeI32(iter124)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -6891,11 +6891,11 @@ class getPackageOrder_result:
if fid == 0:
if ftype == TType.MAP:
self.success = {}
- (_ktype133, _vtype134, _size132 ) = iprot.readMapBegin()
- for _i136 in xrange(_size132):
- _key137 = iprot.readI16();
- _val138 = iprot.readI32();
- self.success[_key137] = _val138
+ (_ktype126, _vtype127, _size125 ) = iprot.readMapBegin()
+ for _i129 in xrange(_size125):
+ _key130 = iprot.readI16();
+ _val131 = iprot.readI32();
+ self.success[_key130] = _val131
iprot.readMapEnd()
else:
iprot.skip(ftype)
@@ -6912,9 +6912,9 @@ class getPackageOrder_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.MAP, 0)
oprot.writeMapBegin(TType.I16, TType.I32, len(self.success))
- for kiter139,viter140 in self.success.items():
- oprot.writeI16(kiter139)
- oprot.writeI32(viter140)
+ for kiter132,viter133 in self.success.items():
+ oprot.writeI16(kiter132)
+ oprot.writeI32(viter133)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -7018,11 +7018,11 @@ class getFileOrder_result:
if fid == 0:
if ftype == TType.MAP:
self.success = {}
- (_ktype142, _vtype143, _size141 ) = iprot.readMapBegin()
- for _i145 in xrange(_size141):
- _key146 = iprot.readI16();
- _val147 = iprot.readI32();
- self.success[_key146] = _val147
+ (_ktype135, _vtype136, _size134 ) = iprot.readMapBegin()
+ for _i138 in xrange(_size134):
+ _key139 = iprot.readI16();
+ _val140 = iprot.readI32();
+ self.success[_key139] = _val140
iprot.readMapEnd()
else:
iprot.skip(ftype)
@@ -7039,9 +7039,9 @@ class getFileOrder_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.MAP, 0)
oprot.writeMapBegin(TType.I16, TType.I32, len(self.success))
- for kiter148,viter149 in self.success.items():
- oprot.writeI16(kiter148)
- oprot.writeI32(viter149)
+ for kiter141,viter142 in self.success.items():
+ oprot.writeI16(kiter141)
+ oprot.writeI32(viter142)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -7573,11 +7573,11 @@ class getEvents_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype153, _size150) = iprot.readListBegin()
- for _i154 in xrange(_size150):
- _elem155 = Event()
- _elem155.read(iprot)
- self.success.append(_elem155)
+ (_etype146, _size143) = iprot.readListBegin()
+ for _i147 in xrange(_size143):
+ _elem148 = Event()
+ _elem148.read(iprot)
+ self.success.append(_elem148)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -7594,8 +7594,8 @@ class getEvents_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter156 in self.success:
- iter156.write(oprot)
+ for iter149 in self.success:
+ iter149.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -7681,11 +7681,11 @@ class getAccounts_result:
if fid == 0:
if ftype == TType.LIST:
self.success = []
- (_etype160, _size157) = iprot.readListBegin()
- for _i161 in xrange(_size157):
- _elem162 = AccountInfo()
- _elem162.read(iprot)
- self.success.append(_elem162)
+ (_etype153, _size150) = iprot.readListBegin()
+ for _i154 in xrange(_size150):
+ _elem155 = AccountInfo()
+ _elem155.read(iprot)
+ self.success.append(_elem155)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -7702,8 +7702,8 @@ class getAccounts_result:
if self.success != None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
- for iter163 in self.success:
- iter163.write(oprot)
+ for iter156 in self.success:
+ iter156.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
diff --git a/module/remote/thriftgen/pyload/__init__.py b/module/remote/thriftbackend/thriftgen/pyload/__init__.py
index ce7f52598..ce7f52598 100644
--- a/module/remote/thriftgen/pyload/__init__.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/__init__.py
diff --git a/module/remote/thriftgen/pyload/constants.py b/module/remote/thriftbackend/thriftgen/pyload/constants.py
index 2f17ec34f..2f17ec34f 100644
--- a/module/remote/thriftgen/pyload/constants.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/constants.py
diff --git a/module/remote/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
index 6c5642e60..acef55ef3 100644
--- a/module/remote/thriftgen/pyload/ttypes.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
@@ -95,35 +95,6 @@ class ElementType:
"File": 1,
}
-class EventType:
- ReloadAll = 0
- ReloadAccounts = 1
- ReloadConfig = 2
- ReloadOrder = 3
- Update = 4
- Remove = 5
- Insert = 6
-
- _VALUES_TO_NAMES = {
- 0: "ReloadAll",
- 1: "ReloadAccounts",
- 2: "ReloadConfig",
- 3: "ReloadOrder",
- 4: "Update",
- 5: "Remove",
- 6: "Insert",
- }
-
- _NAMES_TO_VALUES = {
- "ReloadAll": 0,
- "ReloadAccounts": 1,
- "ReloadConfig": 2,
- "ReloadOrder": 3,
- "Update": 4,
- "Remove": 5,
- "Insert": 6,
- }
-
class DownloadStatus:
"""
@@ -490,7 +461,6 @@ class ConfigItem:
- description
- value
- type
- - choice
"""
thrift_spec = (
@@ -499,15 +469,13 @@ class ConfigItem:
(2, TType.STRING, 'description', None, None, ), # 2
(3, TType.STRING, 'value', None, None, ), # 3
(4, TType.STRING, 'type', None, None, ), # 4
- (5, TType.SET, 'choice', (TType.STRING,None), None, ), # 5
)
- def __init__(self, name=None, description=None, value=None, type=None, choice=None,):
+ def __init__(self, name=None, description=None, value=None, type=None,):
self.name = name
self.description = description
self.value = value
self.type = type
- self.choice = choice
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -538,16 +506,6 @@ class ConfigItem:
self.type = iprot.readString();
else:
iprot.skip(ftype)
- elif fid == 5:
- if ftype == TType.SET:
- self.choice = set()
- (_etype3, _size0) = iprot.readSetBegin()
- for _i4 in xrange(_size0):
- _elem5 = iprot.readString();
- self.choice.add(_elem5)
- iprot.readSetEnd()
- else:
- iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@ -574,13 +532,6 @@ class ConfigItem:
oprot.writeFieldBegin('type', TType.STRING, 4)
oprot.writeString(self.type)
oprot.writeFieldEnd()
- if self.choice != None:
- oprot.writeFieldBegin('choice', TType.SET, 5)
- oprot.writeSetBegin(TType.STRING, len(self.choice))
- for iter6 in self.choice:
- oprot.writeString(iter6)
- oprot.writeSetEnd()
- oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
@@ -640,11 +591,11 @@ class ConfigSection:
elif fid == 3:
if ftype == TType.LIST:
self.items = []
- (_etype10, _size7) = iprot.readListBegin()
- for _i11 in xrange(_size7):
- _elem12 = ConfigItem()
- _elem12.read(iprot)
- self.items.append(_elem12)
+ (_etype3, _size0) = iprot.readListBegin()
+ for _i4 in xrange(_size0):
+ _elem5 = ConfigItem()
+ _elem5.read(iprot)
+ self.items.append(_elem5)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -669,8 +620,8 @@ class ConfigSection:
if self.items != None:
oprot.writeFieldBegin('items', TType.LIST, 3)
oprot.writeListBegin(TType.STRUCT, len(self.items))
- for iter13 in self.items:
- iter13.write(oprot)
+ for iter6 in self.items:
+ iter6.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -893,7 +844,7 @@ class PackageData:
- destination
- order
- priority
- - fileids
+ - links
"""
thrift_spec = (
@@ -906,10 +857,10 @@ class PackageData:
(6, TType.I32, 'destination', None, None, ), # 6
(7, TType.I16, 'order', None, None, ), # 7
(8, TType.BYTE, 'priority', None, None, ), # 8
- (9, TType.LIST, 'fileids', (TType.I32,None), None, ), # 9
+ (9, TType.LIST, 'links', (TType.I32,None), None, ), # 9
)
- def __init__(self, pid=None, name=None, folder=None, site=None, password=None, destination=None, order=None, priority=None, fileids=None,):
+ def __init__(self, pid=None, name=None, folder=None, site=None, password=None, destination=None, order=None, priority=None, links=None,):
self.pid = pid
self.name = name
self.folder = folder
@@ -918,7 +869,7 @@ class PackageData:
self.destination = destination
self.order = order
self.priority = priority
- self.fileids = fileids
+ self.links = links
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -971,11 +922,11 @@ class PackageData:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.LIST:
- self.fileids = []
- (_etype17, _size14) = iprot.readListBegin()
- for _i18 in xrange(_size14):
- _elem19 = iprot.readI32();
- self.fileids.append(_elem19)
+ self.links = []
+ (_etype10, _size7) = iprot.readListBegin()
+ for _i11 in xrange(_size7):
+ _elem12 = iprot.readI32();
+ self.links.append(_elem12)
iprot.readListEnd()
else:
iprot.skip(ftype)
@@ -1021,11 +972,11 @@ class PackageData:
oprot.writeFieldBegin('priority', TType.BYTE, 8)
oprot.writeByte(self.priority)
oprot.writeFieldEnd()
- if self.fileids != None:
- oprot.writeFieldBegin('fileids', TType.LIST, 9)
- oprot.writeListBegin(TType.I32, len(self.fileids))
- for iter20 in self.fileids:
- oprot.writeI32(iter20)
+ if self.links != None:
+ oprot.writeFieldBegin('links', TType.LIST, 9)
+ oprot.writeListBegin(TType.I32, len(self.links))
+ for iter13 in self.links:
+ oprot.writeI32(iter13)
oprot.writeListEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
@@ -1139,7 +1090,7 @@ class Event:
thrift_spec = (
None, # 0
- (1, TType.I32, 'event', None, None, ), # 1
+ (1, TType.STRING, 'event', None, None, ), # 1
(2, TType.I32, 'id', None, None, ), # 2
(3, TType.I32, 'type', None, None, ), # 3
(4, TType.I32, 'destination', None, None, ), # 4
@@ -1161,8 +1112,8 @@ class Event:
if ftype == TType.STOP:
break
if fid == 1:
- if ftype == TType.I32:
- self.event = iprot.readI32();
+ if ftype == TType.STRING:
+ self.event = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
@@ -1191,8 +1142,8 @@ class Event:
return
oprot.writeStructBegin('Event')
if self.event != None:
- oprot.writeFieldBegin('event', TType.I32, 1)
- oprot.writeI32(self.event)
+ oprot.writeFieldBegin('event', TType.STRING, 1)
+ oprot.writeString(self.event)
oprot.writeFieldEnd()
if self.id != None:
oprot.writeFieldBegin('id', TType.I32, 2)
@@ -1387,11 +1338,11 @@ class AccountInfo:
elif fid == 3:
if ftype == TType.MAP:
self.options = {}
- (_ktype22, _vtype23, _size21 ) = iprot.readMapBegin()
- for _i25 in xrange(_size21):
- _key26 = iprot.readString();
- _val27 = iprot.readString();
- self.options[_key26] = _val27
+ (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin()
+ for _i18 in xrange(_size14):
+ _key19 = iprot.readString();
+ _val20 = iprot.readString();
+ self.options[_key19] = _val20
iprot.readMapEnd()
else:
iprot.skip(ftype)
@@ -1441,9 +1392,9 @@ class AccountInfo:
if self.options != None:
oprot.writeFieldBegin('options', TType.MAP, 3)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.options))
- for kiter28,viter29 in self.options.items():
- oprot.writeString(kiter28)
- oprot.writeString(viter29)
+ for kiter21,viter22 in self.options.items():
+ oprot.writeString(kiter21)
+ oprot.writeString(viter22)
oprot.writeMapEnd()
oprot.writeFieldEnd()
if self.valid != None:
@@ -1533,11 +1484,11 @@ class AccountData:
elif fid == 4:
if ftype == TType.MAP:
self.options = {}
- (_ktype31, _vtype32, _size30 ) = iprot.readMapBegin()
- for _i34 in xrange(_size30):
- _key35 = iprot.readString();
- _val36 = iprot.readString();
- self.options[_key35] = _val36
+ (_ktype24, _vtype25, _size23 ) = iprot.readMapBegin()
+ for _i27 in xrange(_size23):
+ _key28 = iprot.readString();
+ _val29 = iprot.readString();
+ self.options[_key28] = _val29
iprot.readMapEnd()
else:
iprot.skip(ftype)
@@ -1566,9 +1517,9 @@ class AccountData:
if self.options != None:
oprot.writeFieldBegin('options', TType.MAP, 4)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.options))
- for kiter37,viter38 in self.options.items():
- oprot.writeString(kiter37)
- oprot.writeString(viter38)
+ for kiter30,viter31 in self.options.items():
+ oprot.writeString(kiter30)
+ oprot.writeString(viter31)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()