summaryrefslogtreecommitdiffstats
path: root/module/remote/thriftbackend/thriftgen
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2011-02-12 18:04:24 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2011-02-12 18:04:24 +0100
commit5a6bcc04e4a0b0088b7ca08c2a782fbc1212d674 (patch)
treecdbdda06598c0f2dd85273b2f32642e1ab1a5405 /module/remote/thriftbackend/thriftgen
parentFileserveCom: Fixes download check (diff)
downloadpyload-5a6bcc04e4a0b0088b7ca08c2a782fbc1212d674.tar.xz
GUI refactoring (now Thrift powered), closes #233
please test!
Diffstat (limited to 'module/remote/thriftbackend/thriftgen')
-rwxr-xr-xmodule/remote/thriftbackend/thriftgen/pyload/Pyload-remote21
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/Pyload.py221
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/ttypes.py76
3 files changed, 257 insertions, 61 deletions
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
index bf52facff..f8e047e49 100755
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
@@ -68,8 +68,9 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print ' CaptchaTask getCaptchaTask(bool exclusive)'
print ' string getCaptchaTaskStatus(TaskID tid)'
print ' void setCaptchaResult(TaskID tid, string result)'
- print ' getEvents()'
- print ' getAccounts()'
+ print ' getEvents(string uuid)'
+ print ' getAccounts(bool refresh)'
+ print ' getAccountTypes()'
print ' void updateAccounts(AccountData data)'
print ' void removeAccount(string plugin, string account)'
print ' bool login(string username, string password)'
@@ -407,16 +408,22 @@ elif cmd == 'setCaptchaResult':
pp.pprint(client.setCaptchaResult(eval(args[0]),args[1],))
elif cmd == 'getEvents':
- if len(args) != 0:
- print 'getEvents requires 0 args'
+ if len(args) != 1:
+ print 'getEvents requires 1 args'
sys.exit(1)
- pp.pprint(client.getEvents())
+ pp.pprint(client.getEvents(args[0],))
elif cmd == 'getAccounts':
+ if len(args) != 1:
+ print 'getAccounts requires 1 args'
+ sys.exit(1)
+ pp.pprint(client.getAccounts(eval(args[0]),))
+
+elif cmd == 'getAccountTypes':
if len(args) != 0:
- print 'getAccounts requires 0 args'
+ print 'getAccountTypes requires 0 args'
sys.exit(1)
- pp.pprint(client.getAccounts())
+ pp.pprint(client.getAccountTypes())
elif cmd == 'updateAccounts':
if len(args) != 1:
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
index 51d76d46c..19e972559 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -285,10 +285,21 @@ class Iface:
"""
pass
- def getEvents(self, ):
+ def getEvents(self, uuid):
+ """
+ Parameters:
+ - uuid
+ """
+ pass
+
+ def getAccounts(self, refresh):
+ """
+ Parameters:
+ - refresh
+ """
pass
- def getAccounts(self, ):
+ def getAccountTypes(self, ):
pass
def updateAccounts(self, data):
@@ -1622,13 +1633,18 @@ class Client(Iface):
self._iprot.readMessageEnd()
return
- def getEvents(self, ):
- self.send_getEvents()
+ def getEvents(self, uuid):
+ """
+ Parameters:
+ - uuid
+ """
+ self.send_getEvents(uuid)
return self.recv_getEvents()
- def send_getEvents(self, ):
+ def send_getEvents(self, uuid):
self._oprot.writeMessageBegin('getEvents', TMessageType.CALL, self._seqid)
args = getEvents_args()
+ args.uuid = uuid
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -1647,13 +1663,18 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "getEvents failed: unknown result");
- def getAccounts(self, ):
- self.send_getAccounts()
+ def getAccounts(self, refresh):
+ """
+ Parameters:
+ - refresh
+ """
+ self.send_getAccounts(refresh)
return self.recv_getAccounts()
- def send_getAccounts(self, ):
+ def send_getAccounts(self, refresh):
self._oprot.writeMessageBegin('getAccounts', TMessageType.CALL, self._seqid)
args = getAccounts_args()
+ args.refresh = refresh
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -1672,6 +1693,31 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "getAccounts failed: unknown result");
+ def getAccountTypes(self, ):
+ self.send_getAccountTypes()
+ return self.recv_getAccountTypes()
+
+ def send_getAccountTypes(self, ):
+ self._oprot.writeMessageBegin('getAccountTypes', TMessageType.CALL, self._seqid)
+ args = getAccountTypes_args()
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_getAccountTypes(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = getAccountTypes_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success != None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "getAccountTypes failed: unknown result");
+
def updateAccounts(self, data):
"""
Parameters:
@@ -1841,6 +1887,7 @@ class Processor(Iface, TProcessor):
self._processMap["setCaptchaResult"] = Processor.process_setCaptchaResult
self._processMap["getEvents"] = Processor.process_getEvents
self._processMap["getAccounts"] = Processor.process_getAccounts
+ self._processMap["getAccountTypes"] = Processor.process_getAccountTypes
self._processMap["updateAccounts"] = Processor.process_updateAccounts
self._processMap["removeAccount"] = Processor.process_removeAccount
self._processMap["login"] = Processor.process_login
@@ -2383,7 +2430,7 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = getEvents_result()
- result.success = self._handler.getEvents()
+ result.success = self._handler.getEvents(args.uuid)
oprot.writeMessageBegin("getEvents", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
@@ -2394,12 +2441,23 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = getAccounts_result()
- result.success = self._handler.getAccounts()
+ result.success = self._handler.getAccounts(args.refresh)
oprot.writeMessageBegin("getAccounts", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_getAccountTypes(self, seqid, iprot, oprot):
+ args = getAccountTypes_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = getAccountTypes_result()
+ result.success = self._handler.getAccountTypes()
+ oprot.writeMessageBegin("getAccountTypes", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_updateAccounts(self, seqid, iprot, oprot):
args = updateAccounts_args()
args.read(iprot)
@@ -7517,10 +7575,19 @@ class setCaptchaResult_result:
return not (self == other)
class getEvents_args:
+ """
+ Attributes:
+ - uuid
+ """
thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'uuid', None, None, ), # 1
)
+ def __init__(self, uuid=None,):
+ self.uuid = uuid
+
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))
@@ -7530,6 +7597,11 @@ class getEvents_args:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
+ if fid == 1:
+ if ftype == TType.STRING:
+ self.uuid = iprot.readString();
+ else:
+ iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@ -7540,6 +7612,10 @@ class getEvents_args:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('getEvents_args')
+ if self.uuid != None:
+ oprot.writeFieldBegin('uuid', TType.STRING, 1)
+ oprot.writeString(self.uuid)
+ oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
@@ -7625,10 +7701,19 @@ class getEvents_result:
return not (self == other)
class getAccounts_args:
+ """
+ Attributes:
+ - refresh
+ """
thrift_spec = (
+ None, # 0
+ (1, TType.BOOL, 'refresh', None, None, ), # 1
)
+ def __init__(self, refresh=None,):
+ self.refresh = refresh
+
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))
@@ -7638,6 +7723,11 @@ class getAccounts_args:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
+ if fid == 1:
+ if ftype == TType.BOOL:
+ self.refresh = iprot.readBool();
+ else:
+ iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
@@ -7648,6 +7738,10 @@ class getAccounts_args:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('getAccounts_args')
+ if self.refresh != None:
+ oprot.writeFieldBegin('refresh', TType.BOOL, 1)
+ oprot.writeBool(self.refresh)
+ oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
@@ -7732,6 +7826,113 @@ class getAccounts_result:
def __ne__(self, other):
return not (self == other)
+class getAccountTypes_args:
+
+ thrift_spec = (
+ )
+
+ 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
+ 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('getAccountTypes_args')
+ 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 getAccountTypes_result:
+ """
+ Attributes:
+ - success
+ """
+
+ thrift_spec = (
+ (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0
+ )
+
+ def __init__(self, success=None,):
+ self.success = success
+
+ 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 == 0:
+ if ftype == TType.LIST:
+ self.success = []
+ (_etype176, _size173) = iprot.readListBegin()
+ for _i177 in xrange(_size173):
+ _elem178 = iprot.readString();
+ self.success.append(_elem178)
+ 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('getAccountTypes_result')
+ if self.success != None:
+ oprot.writeFieldBegin('success', TType.LIST, 0)
+ oprot.writeListBegin(TType.STRING, len(self.success))
+ for iter179 in self.success:
+ oprot.writeString(iter179)
+ 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 updateAccounts_args:
"""
Attributes:
diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
index 2b51e1467..10964d127 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
@@ -104,7 +104,6 @@ class DownloadInfo:
- speed
- eta
- format_eta
- - kbleft
- bleft
- size
- format_size
@@ -120,28 +119,26 @@ class DownloadInfo:
None, # 0
(1, TType.I32, 'id', None, None, ), # 1
(2, TType.STRING, 'name', None, None, ), # 2
- (3, TType.I32, 'speed', None, None, ), # 3
+ (3, TType.I64, 'speed', None, None, ), # 3
(4, TType.I32, 'eta', None, None, ), # 4
(5, TType.STRING, 'format_eta', None, None, ), # 5
- (6, TType.I64, 'kbleft', None, None, ), # 6
- (7, TType.I64, 'bleft', None, None, ), # 7
- (8, TType.I64, 'size', None, None, ), # 8
- (9, TType.STRING, 'format_size', None, None, ), # 9
- (10, TType.BYTE, 'percent', None, None, ), # 10
- (11, TType.I32, 'status', None, None, ), # 11
- (12, TType.STRING, 'statusmsg', None, None, ), # 12
- (13, TType.STRING, 'format_wait', None, None, ), # 13
- (14, TType.I64, 'wait_until', None, None, ), # 14
- (15, TType.I32, 'packageID', None, None, ), # 15
+ (6, TType.I64, 'bleft', None, None, ), # 6
+ (7, TType.I64, 'size', None, None, ), # 7
+ (8, TType.STRING, 'format_size', None, None, ), # 8
+ (9, TType.BYTE, '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
)
- def __init__(self, id=None, name=None, speed=None, eta=None, format_eta=None, kbleft=None, bleft=None, size=None, format_size=None, percent=None, status=None, statusmsg=None, format_wait=None, wait_until=None, packageID=None,):
+ def __init__(self, id=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,):
self.id = id
self.name = name
self.speed = speed
self.eta = eta
self.format_eta = format_eta
- self.kbleft = kbleft
self.bleft = bleft
self.size = size
self.format_size = format_size
@@ -172,8 +169,8 @@ class DownloadInfo:
else:
iprot.skip(ftype)
elif fid == 3:
- if ftype == TType.I32:
- self.speed = iprot.readI32();
+ if ftype == TType.I64:
+ self.speed = iprot.readI64();
else:
iprot.skip(ftype)
elif fid == 4:
@@ -188,50 +185,45 @@ class DownloadInfo:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I64:
- self.kbleft = iprot.readI64();
- else:
- iprot.skip(ftype)
- elif fid == 7:
- if ftype == TType.I64:
self.bleft = iprot.readI64();
else:
iprot.skip(ftype)
- elif fid == 8:
+ elif fid == 7:
if ftype == TType.I64:
self.size = iprot.readI64();
else:
iprot.skip(ftype)
- elif fid == 9:
+ elif fid == 8:
if ftype == TType.STRING:
self.format_size = iprot.readString();
else:
iprot.skip(ftype)
- elif fid == 10:
+ elif fid == 9:
if ftype == TType.BYTE:
self.percent = iprot.readByte();
else:
iprot.skip(ftype)
- elif fid == 11:
+ elif fid == 10:
if ftype == TType.I32:
self.status = iprot.readI32();
else:
iprot.skip(ftype)
- elif fid == 12:
+ elif fid == 11:
if ftype == TType.STRING:
self.statusmsg = iprot.readString();
else:
iprot.skip(ftype)
- elif fid == 13:
+ elif fid == 12:
if ftype == TType.STRING:
self.format_wait = iprot.readString();
else:
iprot.skip(ftype)
- elif fid == 14:
+ elif fid == 13:
if ftype == TType.I64:
self.wait_until = iprot.readI64();
else:
iprot.skip(ftype)
- elif fid == 15:
+ elif fid == 14:
if ftype == TType.I32:
self.packageID = iprot.readI32();
else:
@@ -255,8 +247,8 @@ class DownloadInfo:
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.speed != None:
- oprot.writeFieldBegin('speed', TType.I32, 3)
- oprot.writeI32(self.speed)
+ oprot.writeFieldBegin('speed', TType.I64, 3)
+ oprot.writeI64(self.speed)
oprot.writeFieldEnd()
if self.eta != None:
oprot.writeFieldBegin('eta', TType.I32, 4)
@@ -266,44 +258,40 @@ class DownloadInfo:
oprot.writeFieldBegin('format_eta', TType.STRING, 5)
oprot.writeString(self.format_eta)
oprot.writeFieldEnd()
- if self.kbleft != None:
- oprot.writeFieldBegin('kbleft', TType.I64, 6)
- oprot.writeI64(self.kbleft)
- oprot.writeFieldEnd()
if self.bleft != None:
- oprot.writeFieldBegin('bleft', TType.I64, 7)
+ oprot.writeFieldBegin('bleft', TType.I64, 6)
oprot.writeI64(self.bleft)
oprot.writeFieldEnd()
if self.size != None:
- oprot.writeFieldBegin('size', TType.I64, 8)
+ oprot.writeFieldBegin('size', TType.I64, 7)
oprot.writeI64(self.size)
oprot.writeFieldEnd()
if self.format_size != None:
- oprot.writeFieldBegin('format_size', TType.STRING, 9)
+ oprot.writeFieldBegin('format_size', TType.STRING, 8)
oprot.writeString(self.format_size)
oprot.writeFieldEnd()
if self.percent != None:
- oprot.writeFieldBegin('percent', TType.BYTE, 10)
+ oprot.writeFieldBegin('percent', TType.BYTE, 9)
oprot.writeByte(self.percent)
oprot.writeFieldEnd()
if self.status != None:
- oprot.writeFieldBegin('status', TType.I32, 11)
+ oprot.writeFieldBegin('status', TType.I32, 10)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.statusmsg != None:
- oprot.writeFieldBegin('statusmsg', TType.STRING, 12)
+ oprot.writeFieldBegin('statusmsg', TType.STRING, 11)
oprot.writeString(self.statusmsg)
oprot.writeFieldEnd()
if self.format_wait != None:
- oprot.writeFieldBegin('format_wait', TType.STRING, 13)
+ oprot.writeFieldBegin('format_wait', TType.STRING, 12)
oprot.writeString(self.format_wait)
oprot.writeFieldEnd()
if self.wait_until != None:
- oprot.writeFieldBegin('wait_until', TType.I64, 14)
+ oprot.writeFieldBegin('wait_until', TType.I64, 13)
oprot.writeI64(self.wait_until)
oprot.writeFieldEnd()
if self.packageID != None:
- oprot.writeFieldBegin('packageID', TType.I32, 15)
+ oprot.writeFieldBegin('packageID', TType.I32, 14)
oprot.writeI32(self.packageID)
oprot.writeFieldEnd()
oprot.writeFieldStop()