diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-03-08 22:15:45 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-03-08 22:15:45 +0100 |
commit | 88372d98619cb601cc41dfb226c71f9751b20d51 (patch) | |
tree | 3187b89c0e8b39bb511f9015f994f37f47d2bc6d /module/remote | |
parent | Youtube fix, thrift java fix (diff) | |
download | pyload-88372d98619cb601cc41dfb226c71f9751b20d51.tar.xz |
captcha manager fix, toggle reconnect
Diffstat (limited to 'module/remote')
-rw-r--r-- | module/remote/thriftbackend/Handler.py | 9 | ||||
-rwxr-xr-x | module/remote/thriftbackend/generateThrift.sh | 2 | ||||
-rw-r--r-- | module/remote/thriftbackend/pyload.thrift | 1 | ||||
-rwxr-xr-x | module/remote/thriftbackend/thriftgen/pyload/Pyload-remote | 7 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/Pyload.py | 139 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/ttypes.py | 16 |
6 files changed, 163 insertions, 11 deletions
diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py index 265d50fa3..d71b4337e 100644 --- a/module/remote/thriftbackend/Handler.py +++ b/module/remote/thriftbackend/Handler.py @@ -76,6 +76,9 @@ class Handler(Iface): def togglePause(self): return self.serverMethods.toggle_pause() + def toggleReconnect(self): + return self.serverMethods.toggle_reconnect() + def statusServer(self): status = self.serverMethods.status_server() serverStatus = ServerStatus() @@ -439,8 +442,10 @@ class Handler(Iface): Parameters: - exclusive """ - t = CaptchaTask() - t.tid, t.data, t.type = self.serverMethods.get_captcha_task(exclusive) + tid, data, type = self.serverMethods.get_captcha_task(exclusive) + tid = int(tid) + + t = CaptchaTask(tid, data, type) return t def getCaptchaTaskStatus(self, tid): diff --git a/module/remote/thriftbackend/generateThrift.sh b/module/remote/thriftbackend/generateThrift.sh index 833d0dec5..679eb68ed 100755 --- a/module/remote/thriftbackend/generateThrift.sh +++ b/module/remote/thriftbackend/generateThrift.sh @@ -1,4 +1,4 @@ #!/bin/sh rm -rf thriftgen -thrift --gen py pyload.thrift +thrift -strict -v --gen py --gen java pyload.thrift mv gen-py thriftgen diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index 122ab783f..a40cae7a5 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -181,6 +181,7 @@ service Pyload { map<string, string> checkURL(1: LinkList urls), bool isTimeDownload(), bool isTimeReconnect(), + bool toggleReconnect(), //downloads list<DownloadInfo> statusDownloads(), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index 92edffa14..2e597604e 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -37,6 +37,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' checkURL(LinkList urls)' print ' bool isTimeDownload()' print ' bool isTimeReconnect()' + print ' bool toggleReconnect()' print ' statusDownloads()' print ' PackageID addPackage(string name, LinkList links, Destination dest)' print ' PackageData getPackageData(PackageID pid)' @@ -223,6 +224,12 @@ elif cmd == 'isTimeReconnect': sys.exit(1) pp.pprint(client.isTimeReconnect()) +elif cmd == 'toggleReconnect': + if len(args) != 0: + print 'toggleReconnect requires 0 args' + sys.exit(1) + pp.pprint(client.toggleReconnect()) + elif cmd == 'statusDownloads': if len(args) != 0: print 'statusDownloads requires 0 args' diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index 92220471b..4a3a52cae 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -85,6 +85,9 @@ class Iface: def isTimeReconnect(self, ): pass + def toggleReconnect(self, ): + pass + def statusDownloads(self, ): pass @@ -762,6 +765,31 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "isTimeReconnect failed: unknown result"); + def toggleReconnect(self, ): + self.send_toggleReconnect() + return self.recv_toggleReconnect() + + def send_toggleReconnect(self, ): + self._oprot.writeMessageBegin('toggleReconnect', TMessageType.CALL, self._seqid) + args = toggleReconnect_args() + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_toggleReconnect(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = toggleReconnect_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "toggleReconnect failed: unknown result"); + def statusDownloads(self, ): self.send_statusDownloads() return self.recv_statusDownloads() @@ -1914,6 +1942,7 @@ class Processor(Iface, TProcessor): self._processMap["checkURL"] = Processor.process_checkURL self._processMap["isTimeDownload"] = Processor.process_isTimeDownload self._processMap["isTimeReconnect"] = Processor.process_isTimeReconnect + self._processMap["toggleReconnect"] = Processor.process_toggleReconnect self._processMap["statusDownloads"] = Processor.process_statusDownloads self._processMap["addPackage"] = Processor.process_addPackage self._processMap["getPackageData"] = Processor.process_getPackageData @@ -2146,6 +2175,17 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_toggleReconnect(self, seqid, iprot, oprot): + args = toggleReconnect_args() + args.read(iprot) + iprot.readMessageEnd() + result = toggleReconnect_result() + result.success = self._handler.toggleReconnect() + oprot.writeMessageBegin("toggleReconnect", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_statusDownloads(self, seqid, iprot, oprot): args = statusDownloads_args() args.read(iprot) @@ -4271,6 +4311,105 @@ class isTimeReconnect_result: def __ne__(self, other): return not (self == other) +class toggleReconnect_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('toggleReconnect_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 toggleReconnect_result: + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.BOOL, 'success', 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.BOOL: + self.success = iprot.readBool(); + 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('toggleReconnect_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.BOOL, 0) + oprot.writeBool(self.success) + 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 statusDownloads_args: thrift_spec = ( diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index 8af392d0a..82ed5bb9a 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -640,7 +640,7 @@ class FileData: - format_size - status - statusmsg - - package + - packageID - error - order - progress @@ -656,13 +656,13 @@ class FileData: (6, TType.STRING, 'format_size', None, None, ), # 6 (7, TType.I32, 'status', None, None, ), # 7 (8, TType.STRING, 'statusmsg', None, None, ), # 8 - (9, TType.I32, 'package', None, None, ), # 9 + (9, TType.I32, 'packageID', None, None, ), # 9 (10, TType.STRING, 'error', None, None, ), # 10 (11, TType.I16, 'order', None, None, ), # 11 (12, TType.BYTE, 'progress', None, None, ), # 12 ) - def __init__(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, package=None, error=None, order=None, progress=None,): + def __init__(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, packageID=None, error=None, order=None, progress=None,): self.fid = fid self.url = url self.name = name @@ -671,7 +671,7 @@ class FileData: self.format_size = format_size self.status = status self.statusmsg = statusmsg - self.package = package + self.packageID = packageID self.error = error self.order = order self.progress = progress @@ -727,7 +727,7 @@ class FileData: iprot.skip(ftype) elif fid == 9: if ftype == TType.I32: - self.package = iprot.readI32(); + self.packageID = iprot.readI32(); else: iprot.skip(ftype) elif fid == 10: @@ -787,9 +787,9 @@ class FileData: oprot.writeFieldBegin('statusmsg', TType.STRING, 8) oprot.writeString(self.statusmsg) oprot.writeFieldEnd() - if self.package != None: - oprot.writeFieldBegin('package', TType.I32, 9) - oprot.writeI32(self.package) + if self.packageID != None: + oprot.writeFieldBegin('packageID', TType.I32, 9) + oprot.writeI32(self.packageID) oprot.writeFieldEnd() if self.error != None: oprot.writeFieldBegin('error', TType.STRING, 10) |