diff options
Diffstat (limited to 'module/remote/thriftbackend/thriftgen/pyload/Pyload-remote')
-rwxr-xr-x | module/remote/thriftbackend/thriftgen/pyload/Pyload-remote | 449 |
1 files changed, 449 insertions, 0 deletions
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote new file mode 100755 index 000000000..cd8a1d703 --- /dev/null +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -0,0 +1,449 @@ +#!/usr/bin/env python +# +# Autogenerated by Thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# + +import sys +import pprint +from urlparse import urlparse +from thrift.transport import TTransport +from thrift.transport import TSocket +from thrift.transport import THttpClient +from thrift.protocol import TBinaryProtocol + +import Pyload +from ttypes import * + +if len(sys.argv) <= 1 or sys.argv[1] == '--help': + print '' + print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]' + print '' + print 'Functions:' + print ' string getConfigValue(string category, string option, string section)' + print ' void setConfigValue(string category, string option, string value, string section)' + print ' getConfig()' + print ' getPluginConfig()' + print ' void pauseServer()' + print ' void unpauseServer()' + print ' bool togglePause()' + print ' ServerStatus statusServer()' + print ' i64 freeSpace()' + print ' string getServerVersion()' + print ' void kill()' + print ' void restart()' + print ' getLog(i32 offset)' + print ' checkURL(LinkList urls)' + print ' bool isTimeDownload()' + print ' bool isTimeReconnect()' + print ' statusDownloads()' + print ' PackageID addPackage(string name, LinkList links, Destination dest)' + print ' PackageData getPackageData(PackageID pid)' + print ' FileData getFileData(FileID fid)' + print ' void deleteFiles( fids)' + print ' void deletePackages( pids)' + print ' getQueue()' + print ' getCollector()' + print ' void addFiles(PackageID pid, LinkList links)' + print ' void pushToQueue(PackageID pid)' + print ' void pullFromQueue(PackageID pid)' + print ' void restartPackage(PackageID pid)' + print ' void restartFile(FileID fid)' + print ' void recheckPackage(PackageID pid)' + print ' void stopAllDownloads()' + print ' void stopDownloads( fids)' + print ' void setPackageName(PackageID pid, string name)' + print ' void movePackage(Destination destination, PackageID pid)' + print ' void uploadContainer(string filename, string data)' + 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 deleteFinished()' + print ' void restartFailed()' + print ' getPackageOrder(Destination destination)' + print ' getFileOrder(PackageID pid)' + print ' bool isCaptchaWaiting()' + print ' CaptchaTask getCaptchaTask(bool exclusive)' + print ' string getCaptchaTaskStatus(TaskID tid)' + print ' void setCaptchaResult(TaskID tid, string result)' + print ' getEvents()' + print ' getAccounts()' + print ' void updateAccounts(AccountData data)' + print ' void removeAccount(string plugin, string account)' + print ' bool login(string username, string password)' + print ' UserData getUserData()' + print '' + sys.exit(0) + +pp = pprint.PrettyPrinter(indent = 2) +host = 'localhost' +port = 9090 +uri = '' +framed = False +http = False +argi = 1 + +if sys.argv[argi] == '-h': + parts = sys.argv[argi+1].split(':') + host = parts[0] + port = int(parts[1]) + argi += 2 + +if sys.argv[argi] == '-u': + url = urlparse(sys.argv[argi+1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + if url[4]: + uri += '?%s' % url[4] + http = True + argi += 2 + +if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': + framed = True + argi += 1 + +cmd = sys.argv[argi] +args = sys.argv[argi+1:] + +if http: + transport = THttpClient.THttpClient(host, port, uri) +else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol.TBinaryProtocol(transport) +client = Pyload.Client(protocol) +transport.open() + +if cmd == 'getConfigValue': + if len(args) != 3: + print 'getConfigValue requires 3 args' + sys.exit(1) + pp.pprint(client.getConfigValue(args[0],args[1],args[2],)) + +elif cmd == 'setConfigValue': + if len(args) != 4: + print 'setConfigValue requires 4 args' + sys.exit(1) + pp.pprint(client.setConfigValue(args[0],args[1],args[2],args[3],)) + +elif cmd == 'getConfig': + if len(args) != 0: + print 'getConfig requires 0 args' + sys.exit(1) + pp.pprint(client.getConfig()) + +elif cmd == 'getPluginConfig': + if len(args) != 0: + print 'getPluginConfig requires 0 args' + sys.exit(1) + pp.pprint(client.getPluginConfig()) + +elif cmd == 'pauseServer': + if len(args) != 0: + print 'pauseServer requires 0 args' + sys.exit(1) + pp.pprint(client.pauseServer()) + +elif cmd == 'unpauseServer': + if len(args) != 0: + print 'unpauseServer requires 0 args' + sys.exit(1) + pp.pprint(client.unpauseServer()) + +elif cmd == 'togglePause': + if len(args) != 0: + print 'togglePause requires 0 args' + sys.exit(1) + pp.pprint(client.togglePause()) + +elif cmd == 'statusServer': + if len(args) != 0: + print 'statusServer requires 0 args' + sys.exit(1) + pp.pprint(client.statusServer()) + +elif cmd == 'freeSpace': + if len(args) != 0: + print 'freeSpace requires 0 args' + sys.exit(1) + pp.pprint(client.freeSpace()) + +elif cmd == 'getServerVersion': + if len(args) != 0: + print 'getServerVersion requires 0 args' + sys.exit(1) + pp.pprint(client.getServerVersion()) + +elif cmd == 'kill': + if len(args) != 0: + print 'kill requires 0 args' + sys.exit(1) + pp.pprint(client.kill()) + +elif cmd == 'restart': + if len(args) != 0: + print 'restart requires 0 args' + sys.exit(1) + pp.pprint(client.restart()) + +elif cmd == 'getLog': + if len(args) != 1: + print 'getLog requires 1 args' + sys.exit(1) + pp.pprint(client.getLog(eval(args[0]),)) + +elif cmd == 'checkURL': + if len(args) != 1: + print 'checkURL requires 1 args' + sys.exit(1) + pp.pprint(client.checkURL(eval(args[0]),)) + +elif cmd == 'isTimeDownload': + if len(args) != 0: + print 'isTimeDownload requires 0 args' + sys.exit(1) + pp.pprint(client.isTimeDownload()) + +elif cmd == 'isTimeReconnect': + if len(args) != 0: + print 'isTimeReconnect requires 0 args' + sys.exit(1) + pp.pprint(client.isTimeReconnect()) + +elif cmd == 'statusDownloads': + if len(args) != 0: + print 'statusDownloads requires 0 args' + sys.exit(1) + pp.pprint(client.statusDownloads()) + +elif cmd == 'addPackage': + if len(args) != 3: + print 'addPackage requires 3 args' + sys.exit(1) + pp.pprint(client.addPackage(args[0],eval(args[1]),eval(args[2]),)) + +elif cmd == 'getPackageData': + if len(args) != 1: + print 'getPackageData requires 1 args' + sys.exit(1) + pp.pprint(client.getPackageData(eval(args[0]),)) + +elif cmd == 'getFileData': + if len(args) != 1: + print 'getFileData requires 1 args' + sys.exit(1) + pp.pprint(client.getFileData(eval(args[0]),)) + +elif cmd == 'deleteFiles': + if len(args) != 1: + print 'deleteFiles requires 1 args' + sys.exit(1) + pp.pprint(client.deleteFiles(eval(args[0]),)) + +elif cmd == 'deletePackages': + if len(args) != 1: + print 'deletePackages requires 1 args' + sys.exit(1) + pp.pprint(client.deletePackages(eval(args[0]),)) + +elif cmd == 'getQueue': + if len(args) != 0: + print 'getQueue requires 0 args' + sys.exit(1) + pp.pprint(client.getQueue()) + +elif cmd == 'getCollector': + if len(args) != 0: + print 'getCollector requires 0 args' + sys.exit(1) + pp.pprint(client.getCollector()) + +elif cmd == 'addFiles': + if len(args) != 2: + print 'addFiles requires 2 args' + sys.exit(1) + pp.pprint(client.addFiles(eval(args[0]),eval(args[1]),)) + +elif cmd == 'pushToQueue': + if len(args) != 1: + print 'pushToQueue requires 1 args' + sys.exit(1) + pp.pprint(client.pushToQueue(eval(args[0]),)) + +elif cmd == 'pullFromQueue': + if len(args) != 1: + print 'pullFromQueue requires 1 args' + sys.exit(1) + pp.pprint(client.pullFromQueue(eval(args[0]),)) + +elif cmd == 'restartPackage': + if len(args) != 1: + print 'restartPackage requires 1 args' + sys.exit(1) + pp.pprint(client.restartPackage(eval(args[0]),)) + +elif cmd == 'restartFile': + if len(args) != 1: + print 'restartFile requires 1 args' + sys.exit(1) + pp.pprint(client.restartFile(eval(args[0]),)) + +elif cmd == 'recheckPackage': + if len(args) != 1: + print 'recheckPackage requires 1 args' + sys.exit(1) + pp.pprint(client.recheckPackage(eval(args[0]),)) + +elif cmd == 'stopAllDownloads': + if len(args) != 0: + print 'stopAllDownloads requires 0 args' + sys.exit(1) + pp.pprint(client.stopAllDownloads()) + +elif cmd == 'stopDownloads': + if len(args) != 1: + print 'stopDownloads requires 1 args' + sys.exit(1) + pp.pprint(client.stopDownloads(eval(args[0]),)) + +elif cmd == 'setPackageName': + if len(args) != 2: + print 'setPackageName requires 2 args' + sys.exit(1) + pp.pprint(client.setPackageName(eval(args[0]),args[1],)) + +elif cmd == 'movePackage': + if len(args) != 2: + print 'movePackage requires 2 args' + sys.exit(1) + pp.pprint(client.movePackage(eval(args[0]),eval(args[1]),)) + +elif cmd == 'uploadContainer': + if len(args) != 2: + print 'uploadContainer requires 2 args' + sys.exit(1) + pp.pprint(client.uploadContainer(args[0],args[1],)) + +elif cmd == 'setPriority': + if len(args) != 2: + print 'setPriority requires 2 args' + sys.exit(1) + pp.pprint(client.setPriority(eval(args[0]),eval(args[1]),)) + +elif cmd == 'orderPackage': + if len(args) != 2: + print 'orderPackage requires 2 args' + sys.exit(1) + pp.pprint(client.orderPackage(eval(args[0]),eval(args[1]),)) + +elif cmd == 'orderFile': + if len(args) != 2: + print 'orderFile requires 2 args' + sys.exit(1) + pp.pprint(client.orderFile(eval(args[0]),eval(args[1]),)) + +elif cmd == 'setPackageData': + if len(args) != 2: + print 'setPackageData requires 2 args' + sys.exit(1) + pp.pprint(client.setPackageData(eval(args[0]),eval(args[1]),)) + +elif cmd == 'deleteFinished': + if len(args) != 0: + print 'deleteFinished requires 0 args' + sys.exit(1) + pp.pprint(client.deleteFinished()) + +elif cmd == 'restartFailed': + if len(args) != 0: + print 'restartFailed requires 0 args' + sys.exit(1) + pp.pprint(client.restartFailed()) + +elif cmd == 'getPackageOrder': + if len(args) != 1: + print 'getPackageOrder requires 1 args' + sys.exit(1) + pp.pprint(client.getPackageOrder(eval(args[0]),)) + +elif cmd == 'getFileOrder': + if len(args) != 1: + print 'getFileOrder requires 1 args' + sys.exit(1) + pp.pprint(client.getFileOrder(eval(args[0]),)) + +elif cmd == 'isCaptchaWaiting': + if len(args) != 0: + print 'isCaptchaWaiting requires 0 args' + sys.exit(1) + pp.pprint(client.isCaptchaWaiting()) + +elif cmd == 'getCaptchaTask': + if len(args) != 1: + print 'getCaptchaTask requires 1 args' + sys.exit(1) + pp.pprint(client.getCaptchaTask(eval(args[0]),)) + +elif cmd == 'getCaptchaTaskStatus': + if len(args) != 1: + print 'getCaptchaTaskStatus requires 1 args' + sys.exit(1) + pp.pprint(client.getCaptchaTaskStatus(eval(args[0]),)) + +elif cmd == 'setCaptchaResult': + if len(args) != 2: + print 'setCaptchaResult requires 2 args' + sys.exit(1) + pp.pprint(client.setCaptchaResult(eval(args[0]),args[1],)) + +elif cmd == 'getEvents': + if len(args) != 0: + print 'getEvents requires 0 args' + sys.exit(1) + pp.pprint(client.getEvents()) + +elif cmd == 'getAccounts': + if len(args) != 0: + print 'getAccounts requires 0 args' + sys.exit(1) + pp.pprint(client.getAccounts()) + +elif cmd == 'updateAccounts': + if len(args) != 1: + print 'updateAccounts requires 1 args' + sys.exit(1) + pp.pprint(client.updateAccounts(eval(args[0]),)) + +elif cmd == 'removeAccount': + if len(args) != 2: + print 'removeAccount requires 2 args' + sys.exit(1) + pp.pprint(client.removeAccount(args[0],args[1],)) + +elif cmd == 'login': + if len(args) != 2: + print 'login requires 2 args' + sys.exit(1) + pp.pprint(client.login(args[0],args[1],)) + +elif cmd == 'getUserData': + if len(args) != 0: + print 'getUserData requires 0 args' + sys.exit(1) + pp.pprint(client.getUserData()) + +else: + print 'Unrecognized method %s' % cmd + sys.exit(1) + +transport.close() |