diff options
Diffstat (limited to 'module/remote/thriftbackend')
-rw-r--r-- | module/remote/thriftbackend/pyload.thrift | 13 | ||||
-rwxr-xr-x | module/remote/thriftbackend/thriftgen/pyload/Pyload-remote | 14 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/Pyload.py | 181 | ||||
-rw-r--r-- | module/remote/thriftbackend/thriftgen/pyload/ttypes.py | 12 |
4 files changed, 210 insertions, 10 deletions
diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index eff697d05..2995ce207 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -158,8 +158,8 @@ struct ServiceCall { } struct OnlineStatus { - 1: string url, - 2: string name, + 1: string name, + 2: PluginName plugin, 3: DownloadStatus status, 4: i64 size, // size <= 0 : unknown } @@ -206,10 +206,16 @@ service Pyload { bool toggleReconnect(), // download preparing + + // packagename - urls + map<string, LinkList> generatePackages(1: LinkList links), map<PluginName, LinkList> checkURLs(1: LinkList urls), map<PluginName, LinkList> parseURLs(1: string html), + + // parses results and generates packages ResultID checkOnlineStatus(1: LinkList urls), - map<PluginName, list<OnlineStatus>> pollResults(1: ResultID rid), + // poll results from previosly started online check , packagename - url - status + map<string, map<string, OnlineStatus>> pollResults(1: ResultID rid), // downloads - information list<DownloadInfo> statusDownloads(), @@ -224,6 +230,7 @@ service Pyload { map<i16, FileID> getFileOrder(1: PackageID pid) // downloads - adding/deleting + list<PackageID> generateAndAddPackages(1: LinkList links, 2: Destination dest), PackageID addPackage(1: string name, 2: LinkList links, 3: Destination dest), void addFiles(1: PackageID pid, 2: LinkList links), void uploadContainer(1: string filename, 2: binary data), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index 2b055321b..0c0e70bd4 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -39,6 +39,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' bool isTimeDownload()' print ' bool isTimeReconnect()' print ' bool toggleReconnect()' + print ' generatePackages(LinkList links)' print ' checkURLs(LinkList urls)' print ' parseURLs(string html)' print ' ResultID checkOnlineStatus(LinkList urls)' @@ -53,6 +54,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' getCollectorData()' print ' getPackageOrder(Destination destination)' print ' getFileOrder(PackageID pid)' + print ' generateAndAddPackages(LinkList links, Destination dest)' print ' PackageID addPackage(string name, LinkList links, Destination dest)' print ' void addFiles(PackageID pid, LinkList links)' print ' void uploadContainer(string filename, string data)' @@ -235,6 +237,12 @@ elif cmd == 'toggleReconnect': sys.exit(1) pp.pprint(client.toggleReconnect()) +elif cmd == 'generatePackages': + if len(args) != 1: + print 'generatePackages requires 1 args' + sys.exit(1) + pp.pprint(client.generatePackages(eval(args[0]),)) + elif cmd == 'checkURLs': if len(args) != 1: print 'checkURLs requires 1 args' @@ -319,6 +327,12 @@ elif cmd == 'getFileOrder': sys.exit(1) pp.pprint(client.getFileOrder(eval(args[0]),)) +elif cmd == 'generateAndAddPackages': + if len(args) != 2: + print 'generateAndAddPackages requires 2 args' + sys.exit(1) + pp.pprint(client.generateAndAddPackages(eval(args[0]),eval(args[1]),)) + elif cmd == 'addPackage': if len(args) != 3: print 'addPackage requires 3 args' diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index de3611b6d..009d850c2 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -78,6 +78,13 @@ class Iface(object): def toggleReconnect(self, ): pass + def generatePackages(self, links): + """ + Parameters: + - links + """ + pass + def checkURLs(self, urls): """ Parameters: @@ -156,6 +163,14 @@ class Iface(object): """ pass + def generateAndAddPackages(self, links, dest): + """ + Parameters: + - links + - dest + """ + pass + def addPackage(self, name, links, dest): """ Parameters: @@ -821,6 +836,36 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "toggleReconnect failed: unknown result"); + def generatePackages(self, links): + """ + Parameters: + - links + """ + self.send_generatePackages(links) + return self.recv_generatePackages() + + def send_generatePackages(self, links): + self._oprot.writeMessageBegin('generatePackages', TMessageType.CALL, self._seqid) + args = generatePackages_args() + args.links = links + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_generatePackages(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = generatePackages_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "generatePackages failed: unknown result"); + def checkURLs(self, urls): """ Parameters: @@ -1222,6 +1267,38 @@ class Client(Iface): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "getFileOrder failed: unknown result"); + def generateAndAddPackages(self, links, dest): + """ + Parameters: + - links + - dest + """ + self.send_generateAndAddPackages(links, dest) + return self.recv_generateAndAddPackages() + + def send_generateAndAddPackages(self, links, dest): + self._oprot.writeMessageBegin('generateAndAddPackages', TMessageType.CALL, self._seqid) + args = generateAndAddPackages_args() + args.links = links + args.dest = dest + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_generateAndAddPackages(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = generateAndAddPackages_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "generateAndAddPackages failed: unknown result"); + def addPackage(self, name, links, dest): """ Parameters: @@ -2286,6 +2363,7 @@ class Processor(Iface, TProcessor): self._processMap["isTimeDownload"] = Processor.process_isTimeDownload self._processMap["isTimeReconnect"] = Processor.process_isTimeReconnect self._processMap["toggleReconnect"] = Processor.process_toggleReconnect + self._processMap["generatePackages"] = Processor.process_generatePackages self._processMap["checkURLs"] = Processor.process_checkURLs self._processMap["parseURLs"] = Processor.process_parseURLs self._processMap["checkOnlineStatus"] = Processor.process_checkOnlineStatus @@ -2300,6 +2378,7 @@ class Processor(Iface, TProcessor): self._processMap["getCollectorData"] = Processor.process_getCollectorData self._processMap["getPackageOrder"] = Processor.process_getPackageOrder self._processMap["getFileOrder"] = Processor.process_getFileOrder + self._processMap["generateAndAddPackages"] = Processor.process_generateAndAddPackages self._processMap["addPackage"] = Processor.process_addPackage self._processMap["addFiles"] = Processor.process_addFiles self._processMap["uploadContainer"] = Processor.process_uploadContainer @@ -2528,6 +2607,17 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_generatePackages(self, seqid, iprot, oprot): + args = generatePackages_args() + args.read(iprot) + iprot.readMessageEnd() + result = generatePackages_result() + result.success = self._handler.generatePackages(args.links) + oprot.writeMessageBegin("generatePackages", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_checkURLs(self, seqid, iprot, oprot): args = checkURLs_args() args.read(iprot) @@ -2691,6 +2781,17 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_generateAndAddPackages(self, seqid, iprot, oprot): + args = generateAndAddPackages_args() + args.read(iprot) + iprot.readMessageEnd() + result = generateAndAddPackages_result() + result.success = self._handler.generateAndAddPackages(args.links, args.dest) + oprot.writeMessageBegin("generateAndAddPackages", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_addPackage(self, seqid, iprot, oprot): args = addPackage_args() args.read(iprot) @@ -3535,6 +3636,43 @@ class toggleReconnect_result(TBase): self.success = success +class generatePackages_args(TBase): + """ + Attributes: + - links + """ + + __slots__ = [ + 'links', + ] + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'links', (TType.STRING,None), None, ), # 1 + ) + + def __init__(self, links=None,): + self.links = links + + +class generatePackages_result(TBase): + """ + Attributes: + - success + """ + + __slots__ = [ + 'success', + ] + + thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING,None,TType.LIST,(TType.STRING,None)), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + class checkURLs_args(TBase): """ Attributes: @@ -3676,7 +3814,7 @@ class pollResults_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING,None,TType.LIST,(TType.STRUCT,(OnlineStatus, OnlineStatus.thrift_spec))), None, ), # 0 + (0, TType.MAP, 'success', (TType.STRING,None,TType.MAP,(TType.STRING,None,TType.STRUCT,(OnlineStatus, OnlineStatus.thrift_spec))), None, ), # 0 ) def __init__(self, success=None,): @@ -4015,6 +4153,47 @@ class getFileOrder_result(TBase): self.success = success +class generateAndAddPackages_args(TBase): + """ + Attributes: + - links + - dest + """ + + __slots__ = [ + 'links', + 'dest', + ] + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'links', (TType.STRING,None), None, ), # 1 + (2, TType.I32, 'dest', None, None, ), # 2 + ) + + def __init__(self, links=None, dest=None,): + self.links = links + self.dest = dest + + +class generateAndAddPackages_result(TBase): + """ + Attributes: + - success + """ + + __slots__ = [ + 'success', + ] + + thrift_spec = ( + (0, TType.LIST, 'success', (TType.I32,None), None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + class addPackage_args(TBase): """ Attributes: diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index fcff55ed8..f7052bc28 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -604,30 +604,30 @@ class ServiceCall(TBase): class OnlineStatus(TBase): """ Attributes: - - url - name + - plugin - status - size """ __slots__ = [ - 'url', 'name', + 'plugin', 'status', 'size', ] thrift_spec = ( None, # 0 - (1, TType.STRING, 'url', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 + (1, TType.STRING, 'name', None, None, ), # 1 + (2, TType.STRING, 'plugin', None, None, ), # 2 (3, TType.I32, 'status', None, None, ), # 3 (4, TType.I64, 'size', None, None, ), # 4 ) - def __init__(self, url=None, name=None, status=None, size=None,): - self.url = url + def __init__(self, name=None, plugin=None, status=None, size=None,): self.name = name + self.plugin = plugin self.status = status self.size = size |