diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-10 22:22:49 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-10 22:22:49 +0100 |
commit | 55a9946145b172d21c917a6ae68f3676cdd3345b (patch) | |
tree | 1a8a655834eaf2bdade8348a562d4822a108e08f /module/remote | |
parent | thriftbackend cleanup (diff) | |
download | pyload-55a9946145b172d21c917a6ae68f3676cdd3345b.tar.xz |
thrift + setup fixes
Diffstat (limited to 'module/remote')
-rw-r--r-- | module/remote/ThriftBackend.py | 1 | ||||
-rw-r--r-- | module/remote/thriftbackend/Handler.py | 83 | ||||
-rw-r--r-- | module/remote/thriftbackend/ThriftTest.py | 22 | ||||
-rw-r--r-- | module/remote/thriftbackend/pyload.thrift | 22 | ||||
-rwxr-xr-x | module/remote/thriftbackend/thriftgen/pyload/Pyload-remote | 2 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/Pyload.py | 255 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/ttypes.py | 204 |
7 files changed, 391 insertions, 198 deletions
diff --git a/module/remote/ThriftBackend.py b/module/remote/ThriftBackend.py index 07da88447..bbad7e7d6 100644 --- a/module/remote/ThriftBackend.py +++ b/module/remote/ThriftBackend.py @@ -30,6 +30,7 @@ class ThriftBackend(BackendBase): handler = Handler(self) processor = Processor(handler) transport = TSocket.TServerSocket(7228) + #@TODO unicode encoding tfactory = TTransport.TBufferedTransportFactory() pfactory = TBinaryProtocol.TBinaryProtocolFactory() diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py index 941efbcce..de7232758 100644 --- a/module/remote/thriftbackend/Handler.py +++ b/module/remote/thriftbackend/Handler.py @@ -1,32 +1,20 @@ from thriftgen.pyload.ttypes import * +from thriftgen.pyload.Pyload import Iface from module.PyFile import PyFile -class Handler: +class Handler(Iface): 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 _convertPyFile(self, p): + f = FileData(p["id"], p["url"], p["name"], p["plugin"], p["size"], + p["format_size"], p["status"], p["statusmsg"], + p["package"], p["error"], p["order"]) + return f def _convertConfigFormat(self, c): sections = [] @@ -48,6 +36,26 @@ class Handler: sections.append(section) return sections + #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 getConfig(self): c = self.serverMethods.get_config() return self._convertConfigFormat(c) @@ -157,6 +165,8 @@ class Handler: """ pdata = PackageData() rawData = self.serverMethods.get_package_data(pid) + print rawData + pdata.pid = rawData["id"] pdata.name = rawData["name"] pdata.folder = rawData["folder"] @@ -166,8 +176,8 @@ class Handler: pdata.order = rawData["order"] pdata.priority = rawData["priority"] pdata.links = [] - for pyfile in rawData["links"]: - pdata.links.append(pyfile["id"]) + for id, pyfile in rawData["links"].iteritems(): + pdata.links.append(self._convertPyFile(pyfile)) return pdata def getFileData(self, fid): @@ -175,19 +185,8 @@ class Handler: 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 = self._convertPyFile(rawData) fdata.progress = rawData["progress"] return fdata @@ -210,7 +209,7 @@ class Handler: ret = [] for pid in packs: pack = self.serverMethods.get_package_data(pid) - pdata = PackageData() + pdata = PackageInfo() pdata.pid = pack["id"] pdata.name = pack["name"] pdata.folder = pack["folder"] @@ -219,7 +218,7 @@ class Handler: pdata.queue = pack["queue"] pdata.order = pack["order"] pdata.priority = pack["priority"] - pdata.fileids = [int(x) for x in pack["links"].keys()] + pdata.links = [int(x) for x in pack["links"].keys()] ret.append(pdata) return ret @@ -228,7 +227,7 @@ class Handler: ret = [] for pid in packs: pack = self.serverMethods.get_package_data(pid) - pdata = PackageData() + pdata = PackageInfo() pdata.pid = pack["id"] pdata.name = pack["name"] pdata.folder = pack["folder"] @@ -237,7 +236,7 @@ class Handler: pdata.queue = pack["queue"] pdata.order = pack["order"] pdata.priority = pack["priority"] - pdata.fileids = [int(x) for x in pack["links"].keys()] + pdata.links = [int(x) for x in pack["links"].keys()] ret.append(pdata) return ret @@ -348,15 +347,7 @@ class Handler: - 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) + self.serverMethods.set_package_data(pid, data) def deleteFinished(self): self.serverMethods.delete_finished() diff --git a/module/remote/thriftbackend/ThriftTest.py b/module/remote/thriftbackend/ThriftTest.py index d73f04ade..9bbb8cbb9 100644 --- a/module/remote/thriftbackend/ThriftTest.py +++ b/module/remote/thriftbackend/ThriftTest.py @@ -20,9 +20,12 @@ import xmlrpclib def bench(f, *args, **kwargs): s = time() - ret = [f(*args, **kwargs) for i in range(0,200)] + ret = [f(*args, **kwargs) for i in range(0,250)] e = time() - print "time", e-s + try: + print "%s: %f s" % (f._Method__name, e-s) + except : + print "%s: %f s" % (f.__name__, e-s) return ret server_url = "http%s://%s:%s@%s:%s/" % ( @@ -35,6 +38,8 @@ server_url = "http%s://%s:%s@%s:%s/" % ( proxy = xmlrpclib.ServerProxy(server_url, allow_none=True) bench(proxy.get_server_version) +bench(proxy.status_server) +bench(proxy.status_downloads) bench(proxy.get_queue) bench(proxy.get_collector) print @@ -55,12 +60,23 @@ try: # Connect! transport.open() - print "Login", client.login("User", "password") + print "Login", client.login("User", "pyloadweb") bench(client.getServerVersion) + bench(client.statusServer) + bench(client.statusDownloads) bench(client.getQueue) bench(client.getCollector) + print + print client.getServerVersion() + print client.statusServer() + print client.statusDownloads() + q = client.getQueue() + + for p in q: + print client.getPackageData(p.pid) + # Close! transport.close() diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index 106256e40..7bbdaffd0 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -86,7 +86,7 @@ struct FileData { 9: PackageID package, 10: string error, 11: i16 order, - 12: Progress progress + 12: optional Progress progress } struct PackageData { @@ -98,7 +98,19 @@ struct PackageData { 6: Destination destination, 7: i16 order, 8: Priority priority, - 9: optional list<FileID> links + 9: list<FileData> links +} + +struct PackageInfo { + 1: PackageID pid, + 2: string name, + 3: string folder, + 4: string site, + 5: string password, + 6: Destination destination, + 7: i16 order, + 8: Priority priority, + 9: list<FileID> links } struct CaptchaTask { @@ -166,8 +178,8 @@ service Pyload { FileData getFileData(1: FileID fid), void deleteFiles(1: list<FileID> fids), void deletePackages(1: list<PackageID> pids), - list<PackageData> getQueue(), - list<PackageData> getCollector(), + list<PackageInfo> getQueue(), + list<PackageInfo> getCollector(), void addFiles(1: PackageID pid, 2: LinkList links), void pushToQueue(1: PackageID pid), void pullFromQueue(1: PackageID pid), @@ -182,7 +194,7 @@ service Pyload { void setPriority(1: PackageID pid, 2: Priority priority) void orderPackage(1: PackageID pid, 2: i16 position), void orderFile(1: FileID fid, 2: i16 position), - void setPackageData(1: PackageID pid, 2: PackageData data), + void setPackageData(1: PackageID pid, 2: map<string, string> data), void deleteFinished(), void restartFailed(), map<i16, PackageID> getPackageOrder(1: Destination destination), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index cd8a1d703..bf52facff 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -59,7 +59,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' void setPriority(PackageID pid, Priority priority)' print ' void orderPackage(PackageID pid, i16 position)' print ' void orderFile(FileID fid, i16 position)' - print ' void setPackageData(PackageID pid, PackageData data)' + print ' void setPackageData(PackageID pid, data)' print ' void deleteFinished()' print ' void restartFailed()' print ' getPackageOrder(Destination destination)' diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index 2456531cb..0f7e0297f 100644 --- a/module/remote/thriftbackend/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 = [] - (_etype35, _size32) = iprot.readListBegin() - for _i36 in xrange(_size32): - _elem37 = ConfigSection() - _elem37.read(iprot) - self.success.append(_elem37) + (_etype42, _size39) = iprot.readListBegin() + for _i43 in xrange(_size39): + _elem44 = ConfigSection() + _elem44.read(iprot) + self.success.append(_elem44) 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 iter38 in self.success: - iter38.write(oprot) + for iter45 in self.success: + iter45.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -2898,11 +2898,11 @@ class getPluginConfig_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) + (_etype49, _size46) = iprot.readListBegin() + for _i50 in xrange(_size46): + _elem51 = ConfigSection() + _elem51.read(iprot) + self.success.append(_elem51) 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 iter45 in self.success: - iter45.write(oprot) + for iter52 in self.success: + iter52.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -3749,10 +3749,10 @@ class getLog_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype49, _size46) = iprot.readListBegin() - for _i50 in xrange(_size46): - _elem51 = iprot.readString(); - self.success.append(_elem51) + (_etype56, _size53) = iprot.readListBegin() + for _i57 in xrange(_size53): + _elem58 = iprot.readString(); + self.success.append(_elem58) 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 iter52 in self.success: - oprot.writeString(iter52) + for iter59 in self.success: + oprot.writeString(iter59) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -3816,10 +3816,10 @@ class checkURL_args: if fid == 1: if ftype == TType.LIST: self.urls = [] - (_etype56, _size53) = iprot.readListBegin() - for _i57 in xrange(_size53): - _elem58 = iprot.readString(); - self.urls.append(_elem58) + (_etype63, _size60) = iprot.readListBegin() + for _i64 in xrange(_size60): + _elem65 = iprot.readString(); + self.urls.append(_elem65) 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 iter59 in self.urls: - oprot.writeString(iter59) + for iter66 in self.urls: + oprot.writeString(iter66) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -3882,11 +3882,11 @@ class checkURL_result: if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype61, _vtype62, _size60 ) = iprot.readMapBegin() - for _i64 in xrange(_size60): - _key65 = iprot.readString(); - _val66 = iprot.readString(); - self.success[_key65] = _val66 + (_ktype68, _vtype69, _size67 ) = iprot.readMapBegin() + for _i71 in xrange(_size67): + _key72 = iprot.readString(); + _val73 = iprot.readString(); + self.success[_key72] = _val73 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 kiter67,viter68 in self.success.items(): - oprot.writeString(kiter67) - oprot.writeString(viter68) + for kiter74,viter75 in self.success.items(): + oprot.writeString(kiter74) + oprot.writeString(viter75) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -4189,11 +4189,11 @@ class statusDownloads_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype72, _size69) = iprot.readListBegin() - for _i73 in xrange(_size69): - _elem74 = DownloadStatus() - _elem74.read(iprot) - self.success.append(_elem74) + (_etype79, _size76) = iprot.readListBegin() + for _i80 in xrange(_size76): + _elem81 = DownloadStatus() + _elem81.read(iprot) + self.success.append(_elem81) 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 iter75 in self.success: - iter75.write(oprot) + for iter82 in self.success: + iter82.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -4268,10 +4268,10 @@ class addPackage_args: elif fid == 2: if ftype == TType.LIST: self.links = [] - (_etype79, _size76) = iprot.readListBegin() - for _i80 in xrange(_size76): - _elem81 = iprot.readString(); - self.links.append(_elem81) + (_etype86, _size83) = iprot.readListBegin() + for _i87 in xrange(_size83): + _elem88 = iprot.readString(); + self.links.append(_elem88) 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 iter82 in self.links: - oprot.writeString(iter82) + for iter89 in self.links: + oprot.writeString(iter89) oprot.writeListEnd() oprot.writeFieldEnd() if self.dest != None: @@ -4642,10 +4642,10 @@ class deleteFiles_args: if fid == 1: if ftype == TType.LIST: self.fids = [] - (_etype86, _size83) = iprot.readListBegin() - for _i87 in xrange(_size83): - _elem88 = iprot.readI32(); - self.fids.append(_elem88) + (_etype93, _size90) = iprot.readListBegin() + for _i94 in xrange(_size90): + _elem95 = iprot.readI32(); + self.fids.append(_elem95) 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 iter89 in self.fids: - oprot.writeI32(iter89) + for iter96 in self.fids: + oprot.writeI32(iter96) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -4750,10 +4750,10 @@ class deletePackages_args: if fid == 1: if ftype == TType.LIST: self.pids = [] - (_etype93, _size90) = iprot.readListBegin() - for _i94 in xrange(_size90): - _elem95 = iprot.readI32(); - self.pids.append(_elem95) + (_etype100, _size97) = iprot.readListBegin() + for _i101 in xrange(_size97): + _elem102 = iprot.readI32(); + self.pids.append(_elem102) 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 iter96 in self.pids: - oprot.writeI32(iter96) + for iter103 in self.pids: + oprot.writeI32(iter103) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -4880,7 +4880,7 @@ class getQueue_result: """ thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(PackageData, PackageData.thrift_spec)), None, ), # 0 + (0, TType.LIST, 'success', (TType.STRUCT,(PackageInfo, PackageInfo.thrift_spec)), None, ), # 0 ) def __init__(self, success=None,): @@ -4898,11 +4898,11 @@ class getQueue_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype100, _size97) = iprot.readListBegin() - for _i101 in xrange(_size97): - _elem102 = PackageData() - _elem102.read(iprot) - self.success.append(_elem102) + (_etype107, _size104) = iprot.readListBegin() + for _i108 in xrange(_size104): + _elem109 = PackageInfo() + _elem109.read(iprot) + self.success.append(_elem109) 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 iter103 in self.success: - iter103.write(oprot) + for iter110 in self.success: + iter110.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -4988,7 +4988,7 @@ class getCollector_result: """ thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(PackageData, PackageData.thrift_spec)), None, ), # 0 + (0, TType.LIST, 'success', (TType.STRUCT,(PackageInfo, PackageInfo.thrift_spec)), None, ), # 0 ) def __init__(self, success=None,): @@ -5006,11 +5006,11 @@ class getCollector_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) + (_etype114, _size111) = iprot.readListBegin() + for _i115 in xrange(_size111): + _elem116 = PackageInfo() + _elem116.read(iprot) + self.success.append(_elem116) 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 iter110 in self.success: - iter110.write(oprot) + for iter117 in self.success: + iter117.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -5082,10 +5082,10 @@ class addFiles_args: elif fid == 2: if ftype == TType.LIST: self.links = [] - (_etype114, _size111) = iprot.readListBegin() - for _i115 in xrange(_size111): - _elem116 = iprot.readString(); - self.links.append(_elem116) + (_etype121, _size118) = iprot.readListBegin() + for _i122 in xrange(_size118): + _elem123 = iprot.readString(); + self.links.append(_elem123) 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 iter117 in self.links: - oprot.writeString(iter117) + for iter124 in self.links: + oprot.writeString(iter124) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -5776,10 +5776,10 @@ class stopDownloads_args: if fid == 1: if ftype == TType.LIST: self.fids = [] - (_etype121, _size118) = iprot.readListBegin() - for _i122 in xrange(_size118): - _elem123 = iprot.readI32(); - self.fids.append(_elem123) + (_etype128, _size125) = iprot.readListBegin() + for _i129 in xrange(_size125): + _elem130 = iprot.readI32(); + self.fids.append(_elem130) 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 iter124 in self.fids: - oprot.writeI32(iter124) + for iter131 in self.fids: + oprot.writeI32(iter131) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -6540,7 +6540,7 @@ class setPackageData_args: thrift_spec = ( None, # 0 (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.STRUCT, 'data', (PackageData, PackageData.thrift_spec), None, ), # 2 + (2, TType.MAP, 'data', (TType.STRING,None,TType.STRING,None), None, ), # 2 ) def __init__(self, pid=None, data=None,): @@ -6562,9 +6562,14 @@ class setPackageData_args: else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.STRUCT: - self.data = PackageData() - self.data.read(iprot) + if ftype == TType.MAP: + self.data = {} + (_ktype133, _vtype134, _size132 ) = iprot.readMapBegin() + for _i136 in xrange(_size132): + _key137 = iprot.readString(); + _val138 = iprot.readString(); + self.data[_key137] = _val138 + iprot.readMapEnd() else: iprot.skip(ftype) else: @@ -6582,8 +6587,12 @@ class setPackageData_args: oprot.writeI32(self.pid) oprot.writeFieldEnd() if self.data != None: - oprot.writeFieldBegin('data', TType.STRUCT, 2) - self.data.write(oprot) + oprot.writeFieldBegin('data', TType.MAP, 2) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.data)) + for kiter139,viter140 in self.data.items(): + oprot.writeString(kiter139) + oprot.writeString(viter140) + oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -6891,11 +6900,11 @@ class getPackageOrder_result: if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype126, _vtype127, _size125 ) = iprot.readMapBegin() - for _i129 in xrange(_size125): - _key130 = iprot.readI16(); - _val131 = iprot.readI32(); - self.success[_key130] = _val131 + (_ktype142, _vtype143, _size141 ) = iprot.readMapBegin() + for _i145 in xrange(_size141): + _key146 = iprot.readI16(); + _val147 = iprot.readI32(); + self.success[_key146] = _val147 iprot.readMapEnd() else: iprot.skip(ftype) @@ -6912,9 +6921,9 @@ class getPackageOrder_result: if self.success != None: oprot.writeFieldBegin('success', TType.MAP, 0) oprot.writeMapBegin(TType.I16, TType.I32, len(self.success)) - for kiter132,viter133 in self.success.items(): - oprot.writeI16(kiter132) - oprot.writeI32(viter133) + for kiter148,viter149 in self.success.items(): + oprot.writeI16(kiter148) + oprot.writeI32(viter149) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -7018,11 +7027,11 @@ class getFileOrder_result: if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype135, _vtype136, _size134 ) = iprot.readMapBegin() - for _i138 in xrange(_size134): - _key139 = iprot.readI16(); - _val140 = iprot.readI32(); - self.success[_key139] = _val140 + (_ktype151, _vtype152, _size150 ) = iprot.readMapBegin() + for _i154 in xrange(_size150): + _key155 = iprot.readI16(); + _val156 = iprot.readI32(); + self.success[_key155] = _val156 iprot.readMapEnd() else: iprot.skip(ftype) @@ -7039,9 +7048,9 @@ class getFileOrder_result: if self.success != None: oprot.writeFieldBegin('success', TType.MAP, 0) oprot.writeMapBegin(TType.I16, TType.I32, len(self.success)) - for kiter141,viter142 in self.success.items(): - oprot.writeI16(kiter141) - oprot.writeI32(viter142) + for kiter157,viter158 in self.success.items(): + oprot.writeI16(kiter157) + oprot.writeI32(viter158) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -7573,11 +7582,11 @@ class getEvents_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype146, _size143) = iprot.readListBegin() - for _i147 in xrange(_size143): - _elem148 = Event() - _elem148.read(iprot) - self.success.append(_elem148) + (_etype162, _size159) = iprot.readListBegin() + for _i163 in xrange(_size159): + _elem164 = Event() + _elem164.read(iprot) + self.success.append(_elem164) iprot.readListEnd() else: iprot.skip(ftype) @@ -7594,8 +7603,8 @@ class getEvents_result: if self.success != None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter149 in self.success: - iter149.write(oprot) + for iter165 in self.success: + iter165.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -7681,11 +7690,11 @@ class getAccounts_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype153, _size150) = iprot.readListBegin() - for _i154 in xrange(_size150): - _elem155 = AccountInfo() - _elem155.read(iprot) - self.success.append(_elem155) + (_etype169, _size166) = iprot.readListBegin() + for _i170 in xrange(_size166): + _elem171 = AccountInfo() + _elem171.read(iprot) + self.success.append(_elem171) iprot.readListEnd() else: iprot.skip(ftype) @@ -7702,8 +7711,8 @@ class getAccounts_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 iter172 in self.success: + iter172.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index acef55ef3..91062df33 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -857,7 +857,7 @@ 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, 'links', (TType.I32,None), None, ), # 9 + (9, TType.LIST, 'links', (TType.STRUCT,(FileData, FileData.thrift_spec)), None, ), # 9 ) def __init__(self, pid=None, name=None, folder=None, site=None, password=None, destination=None, order=None, priority=None, links=None,): @@ -925,7 +925,8 @@ class PackageData: self.links = [] (_etype10, _size7) = iprot.readListBegin() for _i11 in xrange(_size7): - _elem12 = iprot.readI32(); + _elem12 = FileData() + _elem12.read(iprot) self.links.append(_elem12) iprot.readListEnd() else: @@ -974,9 +975,172 @@ class PackageData: oprot.writeFieldEnd() if self.links != None: oprot.writeFieldBegin('links', TType.LIST, 9) - oprot.writeListBegin(TType.I32, len(self.links)) + oprot.writeListBegin(TType.STRUCT, len(self.links)) for iter13 in self.links: - oprot.writeI32(iter13) + iter13.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class PackageInfo: + """ + Attributes: + - pid + - name + - folder + - site + - password + - destination + - order + - priority + - links + """ + + thrift_spec = ( + None, # 0 + (1, TType.I32, 'pid', None, None, ), # 1 + (2, TType.STRING, 'name', None, None, ), # 2 + (3, TType.STRING, 'folder', None, None, ), # 3 + (4, TType.STRING, 'site', None, None, ), # 4 + (5, TType.STRING, 'password', None, None, ), # 5 + (6, TType.I32, 'destination', None, None, ), # 6 + (7, TType.I16, 'order', None, None, ), # 7 + (8, TType.BYTE, 'priority', None, None, ), # 8 + (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, links=None,): + self.pid = pid + self.name = name + self.folder = folder + self.site = site + self.password = password + self.destination = destination + self.order = order + self.priority = priority + 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: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.pid = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.folder = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.site = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.password = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.I32: + self.destination = iprot.readI32(); + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I16: + self.order = iprot.readI16(); + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.BYTE: + self.priority = iprot.readByte(); + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.LIST: + self.links = [] + (_etype17, _size14) = iprot.readListBegin() + for _i18 in xrange(_size14): + _elem19 = iprot.readI32(); + self.links.append(_elem19) + iprot.readListEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('PackageInfo') + if self.pid != None: + oprot.writeFieldBegin('pid', TType.I32, 1) + oprot.writeI32(self.pid) + oprot.writeFieldEnd() + if self.name != None: + oprot.writeFieldBegin('name', TType.STRING, 2) + oprot.writeString(self.name) + oprot.writeFieldEnd() + if self.folder != None: + oprot.writeFieldBegin('folder', TType.STRING, 3) + oprot.writeString(self.folder) + oprot.writeFieldEnd() + if self.site != None: + oprot.writeFieldBegin('site', TType.STRING, 4) + oprot.writeString(self.site) + oprot.writeFieldEnd() + if self.password != None: + oprot.writeFieldBegin('password', TType.STRING, 5) + oprot.writeString(self.password) + oprot.writeFieldEnd() + if self.destination != None: + oprot.writeFieldBegin('destination', TType.I32, 6) + oprot.writeI32(self.destination) + oprot.writeFieldEnd() + if self.order != None: + oprot.writeFieldBegin('order', TType.I16, 7) + oprot.writeI16(self.order) + oprot.writeFieldEnd() + if self.priority != None: + oprot.writeFieldBegin('priority', TType.BYTE, 8) + oprot.writeByte(self.priority) + oprot.writeFieldEnd() + if self.links != None: + oprot.writeFieldBegin('links', TType.LIST, 9) + oprot.writeListBegin(TType.I32, len(self.links)) + for iter20 in self.links: + oprot.writeI32(iter20) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -1338,11 +1502,11 @@ class AccountInfo: elif fid == 3: if ftype == TType.MAP: self.options = {} - (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin() - for _i18 in xrange(_size14): - _key19 = iprot.readString(); - _val20 = iprot.readString(); - self.options[_key19] = _val20 + (_ktype22, _vtype23, _size21 ) = iprot.readMapBegin() + for _i25 in xrange(_size21): + _key26 = iprot.readString(); + _val27 = iprot.readString(); + self.options[_key26] = _val27 iprot.readMapEnd() else: iprot.skip(ftype) @@ -1392,9 +1556,9 @@ class AccountInfo: if self.options != None: oprot.writeFieldBegin('options', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.options)) - for kiter21,viter22 in self.options.items(): - oprot.writeString(kiter21) - oprot.writeString(viter22) + for kiter28,viter29 in self.options.items(): + oprot.writeString(kiter28) + oprot.writeString(viter29) oprot.writeMapEnd() oprot.writeFieldEnd() if self.valid != None: @@ -1484,11 +1648,11 @@ class AccountData: elif fid == 4: if ftype == TType.MAP: self.options = {} - (_ktype24, _vtype25, _size23 ) = iprot.readMapBegin() - for _i27 in xrange(_size23): - _key28 = iprot.readString(); - _val29 = iprot.readString(); - self.options[_key28] = _val29 + (_ktype31, _vtype32, _size30 ) = iprot.readMapBegin() + for _i34 in xrange(_size30): + _key35 = iprot.readString(); + _val36 = iprot.readString(); + self.options[_key35] = _val36 iprot.readMapEnd() else: iprot.skip(ftype) @@ -1517,9 +1681,9 @@ class AccountData: if self.options != None: oprot.writeFieldBegin('options', TType.MAP, 4) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.options)) - for kiter30,viter31 in self.options.items(): - oprot.writeString(kiter30) - oprot.writeString(viter31) + for kiter37,viter38 in self.options.items(): + oprot.writeString(kiter37) + oprot.writeString(viter38) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() |