From 7007ebe7710d29f26696de16407beced6dbacb6c Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 21 Sep 2012 23:27:12 +0200 Subject: added websocket backend, removed thrift --- module/remote/RemoteManager.py | 4 +- module/remote/SocketBackend.py | 25 - module/remote/ThriftBackend.py | 56 - module/remote/WebSocketBackend.py | 47 + module/remote/__init__.py | 2 - module/remote/create_ttypes.py | 91 + module/remote/pyload.thrift | 514 ++ module/remote/socketbackend/__init__.py | 2 - module/remote/socketbackend/create_ttypes.py | 91 - module/remote/socketbackend/ttypes.py | 503 -- module/remote/thriftbackend/Processor.py | 78 - module/remote/thriftbackend/Protocol.py | 30 - module/remote/thriftbackend/Socket.py | 135 - module/remote/thriftbackend/ThriftClient.py | 109 - module/remote/thriftbackend/ThriftTest.py | 92 - module/remote/thriftbackend/Transport.py | 37 - module/remote/thriftbackend/__init__.py | 0 module/remote/thriftbackend/pyload.thrift | 514 -- module/remote/thriftbackend/thriftgen/__init__.py | 0 .../thriftbackend/thriftgen/pyload/Pyload-remote | 690 -- .../thriftbackend/thriftgen/pyload/Pyload.py | 7179 -------------------- .../thriftbackend/thriftgen/pyload/__init__.py | 1 - .../thriftbackend/thriftgen/pyload/constants.py | 11 - .../thriftbackend/thriftgen/pyload/ttypes.py | 1129 --- module/remote/ttypes.py | 503 ++ module/remote/wsbackend/Dispatcher.py | 53 + module/remote/wsbackend/Server.py | 670 ++ module/remote/wsbackend/__init__.py | 2 + 28 files changed, 1881 insertions(+), 10687 deletions(-) delete mode 100644 module/remote/SocketBackend.py delete mode 100644 module/remote/ThriftBackend.py create mode 100644 module/remote/WebSocketBackend.py create mode 100644 module/remote/create_ttypes.py create mode 100644 module/remote/pyload.thrift delete mode 100644 module/remote/socketbackend/__init__.py delete mode 100644 module/remote/socketbackend/create_ttypes.py delete mode 100644 module/remote/socketbackend/ttypes.py delete mode 100644 module/remote/thriftbackend/Processor.py delete mode 100644 module/remote/thriftbackend/Protocol.py delete mode 100644 module/remote/thriftbackend/Socket.py delete mode 100644 module/remote/thriftbackend/ThriftClient.py delete mode 100644 module/remote/thriftbackend/ThriftTest.py delete mode 100644 module/remote/thriftbackend/Transport.py delete mode 100644 module/remote/thriftbackend/__init__.py delete mode 100644 module/remote/thriftbackend/pyload.thrift delete mode 100644 module/remote/thriftbackend/thriftgen/__init__.py delete mode 100755 module/remote/thriftbackend/thriftgen/pyload/Pyload-remote delete mode 100644 module/remote/thriftbackend/thriftgen/pyload/Pyload.py delete mode 100644 module/remote/thriftbackend/thriftgen/pyload/__init__.py delete mode 100644 module/remote/thriftbackend/thriftgen/pyload/constants.py delete mode 100644 module/remote/thriftbackend/thriftgen/pyload/ttypes.py create mode 100644 module/remote/ttypes.py create mode 100644 module/remote/wsbackend/Dispatcher.py create mode 100644 module/remote/wsbackend/Server.py create mode 100644 module/remote/wsbackend/__init__.py (limited to 'module/remote') diff --git a/module/remote/RemoteManager.py b/module/remote/RemoteManager.py index 36eb52a4a..dd567653b 100644 --- a/module/remote/RemoteManager.py +++ b/module/remote/RemoteManager.py @@ -63,9 +63,7 @@ class RemoteManager(): self.backends = [] if self.core.remote: - self.available.append("ThriftBackend") -# else: -# self.available.append("SocketBackend") + self.available.append("WebSocketBackend") def startBackends(self): diff --git a/module/remote/SocketBackend.py b/module/remote/SocketBackend.py deleted file mode 100644 index 1a157cf1d..000000000 --- a/module/remote/SocketBackend.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -import SocketServer - -from RemoteManager import BackendBase - -class RequestHandler(SocketServer.BaseRequestHandler): - - def setup(self): - pass - - def handle(self): - - print self.request.recv(1024) - - - -class SocketBackend(BackendBase): - - def setup(self, host, port): - #local only - self.server = SocketServer.ThreadingTCPServer(("localhost", port), RequestHandler) - - def serve(self): - self.server.serve_forever() diff --git a/module/remote/ThriftBackend.py b/module/remote/ThriftBackend.py deleted file mode 100644 index b4a2bb25e..000000000 --- a/module/remote/ThriftBackend.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: mkaay, RaNaN -""" -from os.path import exists - -from module.remote.RemoteManager import BackendBase - -from thriftbackend.Processor import Processor -from thriftbackend.Protocol import ProtocolFactory -from thriftbackend.Socket import ServerSocket -from thriftbackend.Transport import TransportFactory -#from thriftbackend.Transport import TransportFactoryCompressed - -from thrift.server import TServer - -class ThriftBackend(BackendBase): - def setup(self, host, port): - processor = Processor(self.core.api) - - key = None - cert = None - - if self.core.config['ssl']['activated']: - if exists(self.core.config['ssl']['cert']) and exists(self.core.config['ssl']['key']): - self.core.log.info(_("Using SSL ThriftBackend")) - key = self.core.config['ssl']['key'] - cert = self.core.config['ssl']['cert'] - - transport = ServerSocket(port, host, key, cert) - - -# tfactory = TransportFactoryCompressed() - tfactory = TransportFactory() - pfactory = ProtocolFactory() - - self.server = TServer.TThreadedServer(processor, transport, tfactory, pfactory) - #self.server = TNonblockingServer.TNonblockingServer(processor, transport, tfactory, pfactory) - - #server = TServer.TThreadPoolServer(processor, transport, tfactory, pfactory) - - def serve(self): - self.server.serve() diff --git a/module/remote/WebSocketBackend.py b/module/remote/WebSocketBackend.py new file mode 100644 index 000000000..7af927d8f --- /dev/null +++ b/module/remote/WebSocketBackend.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +############################################################################### +# Copyright(c) 2008-2012 pyLoad Team +# http://www.pyload.org +# +# This file is part of pyLoad. +# pyLoad is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Subjected to the terms and conditions in LICENSE +# +# @author: RaNaN +############################################################################### + +import logging + +from module.remote.RemoteManager import BackendBase + +from mod_pywebsocket import util +def get_class_logger(o): + return logging.getLogger('log') + +# Monkey patch for our logger +util.get_class_logger = get_class_logger + +class WebSocketBackend(BackendBase): + def setup(self, host, port): + + + from wsbackend.Server import WebSocketServer, DefaultOptions + from wsbackend.Dispatcher import Dispatcher, ApiHandler + + options = DefaultOptions() + options.server_host = host + options.port = port + options.dispatcher = Dispatcher() + options.dispatcher.addHandler('/api', ApiHandler()) + + self.server = WebSocketServer(options) + + + def serve(self): + self.server.serve_forever() diff --git a/module/remote/__init__.py b/module/remote/__init__.py index 9298f5337..e69de29bb 100644 --- a/module/remote/__init__.py +++ b/module/remote/__init__.py @@ -1,2 +0,0 @@ -# -*- coding: utf-8 -*- -activated = True diff --git a/module/remote/create_ttypes.py b/module/remote/create_ttypes.py new file mode 100644 index 000000000..ec4f07a7d --- /dev/null +++ b/module/remote/create_ttypes.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import inspect +import sys +from os.path import abspath, dirname, join + +path = dirname(abspath(__file__)) +module = join(path, "..", "..") + +sys.path.append(join(module, "lib")) +sys.path.append(join(module, "remote")) + +from thriftgen.pyload import ttypes +from thriftgen.pyload.Pyload import Iface + + +def main(): + + enums = [] + classes = [] + + print "generating lightweight ttypes.py" + + for name in dir(ttypes): + klass = getattr(ttypes, name) + + if name in ("TBase", "TExceptionBase") or name.startswith("_") or not (issubclass(klass, ttypes.TBase) or issubclass(klass, ttypes.TExceptionBase)): + continue + + if hasattr(klass, "thrift_spec"): + classes.append(klass) + else: + enums.append(klass) + + + f = open(join(path, "ttypes.py"), "wb") + + f.write( + """#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Autogenerated by pyload +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +class BaseObject(object): +\t__slots__ = [] + +""") + + ## generate enums + for enum in enums: + name = enum.__name__ + f.write("class %s:\n" % name) + + for attr in dir(enum): + if attr.startswith("_") or attr in ("read", "write"): continue + + f.write("\t%s = %s\n" % (attr, getattr(enum, attr))) + + f.write("\n") + + for klass in classes: + name = klass.__name__ + base = "Exception" if issubclass(klass, ttypes.TExceptionBase) else "BaseObject" + f.write("class %s(%s):\n" % (name, base)) + f.write("\t__slots__ = %s\n\n" % klass.__slots__) + + #create init + args = ["self"] + ["%s=None" % x for x in klass.__slots__] + + f.write("\tdef __init__(%s):\n" % ", ".join(args)) + for attr in klass.__slots__: + f.write("\t\tself.%s = %s\n" % (attr, attr)) + + f.write("\n") + + f.write("class Iface(object):\n") + + for name in dir(Iface): + if name.startswith("_"): continue + + func = inspect.getargspec(getattr(Iface, name)) + + f.write("\tdef %s(%s):\n\t\tpass\n" % (name, ", ".join(func.args))) + + f.write("\n") + + f.close() + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/module/remote/pyload.thrift b/module/remote/pyload.thrift new file mode 100644 index 000000000..8257107b4 --- /dev/null +++ b/module/remote/pyload.thrift @@ -0,0 +1,514 @@ +namespace java org.pyload.thrift + +typedef i32 FileID +typedef i32 PackageID +typedef i32 ResultID +typedef i32 InteractionID +typedef i32 UserID +typedef i64 UTCDate +typedef i64 ByteCount +typedef list LinkList +typedef string PluginName +typedef string JSONString + +// NA - Not Available +enum DownloadStatus { + NA, + Offline, + Online, + Queued, + Paused, + Finished, + Skipped, + Failed, + Starting, + Waiting, + Downloading, + TempOffline, + Aborted, + Decrypting, + Processing, + Custom, + Unknown +} + +enum MediaType { + All = 0 + Other = 1, + Audio = 2, + Image = 4, + Video = 8, + Document = 16, + Archive = 32, +} + +enum FileStatus { + Ok, + Missing, + Remote, // file is available at remote location +} + +enum PackageStatus { + Ok, + Paused, + Folder, + Remote, +} + +// types for user interaction +// some may only be place holder currently not supported +// also all input - output combination are not reasonable, see InteractionManager for further info +// Todo: how about: time, int, ip, file, s.o. +enum Input { + NA, + Text, + Textbox, + Password, + Bool, // confirm like, yes or no dialog + Click, // for positional captchas + Select, // select from list + Multiple, // multiple choice from list of elements + List, // arbitary list of elements + Table // table like data structure +} +// more can be implemented by need + +// this describes the type of the outgoing interaction +// ensure they can be logcial or'ed +enum Output { + All = 0, + Notification = 1, + Captcha = 2, + Query = 4, +} + +enum Permission { + All = 0, // requires no permission, but login + Add = 1, // can add packages + Delete = 2, // can delete packages + Modify = 4, // modify some attribute of downloads + Download = 8, // can download from webinterface + Accounts = 16, // can access accounts + Interaction = 32, // can interact with plugins + Plugins = 64 // user can configure plugins and activate addons +} + +enum Role { + Admin = 0, //admin has all permissions implicit + User = 1 +} + +struct DownloadProgress { + 1: FileID fid, + 2: PackageID pid, + 3: ByteCount speed, + 4: DownloadStatus status, +} + +struct ProgressInfo { + 1: PluginName plugin, + 2: string name, + 3: string statusmsg, + 4: i32 eta, // in seconds + 5: string format_eta, + 6: ByteCount done, + 7: ByteCount total, // arbitary number, size in case of files + 8: optional DownloadProgress download +} + +struct ServerStatus { + 1: bool pause, + 2: i16 active, + 3: i16 queue, + 4: i16 total, + 5: ByteCount speed, + 6: bool download, + 7: bool reconnect +} + +// download info for specific file +struct DownloadInfo { + 1: string url, + 2: PluginName plugin, + 3: string hash, + 4: DownloadStatus status, + 5: string statusmsg, + 6: string error, +} + +struct FileInfo { + 1: FileID fid, + 2: string name, + 3: PackageID package, + 4: UserID owner, + 5: ByteCount size, + 6: FileStatus status, + 7: MediaType media, + 8: UTCDate added, + 9: i16 fileorder, + 10: optional DownloadInfo download, +} + +struct PackageStats { + 1: i16 linkstotal, + 2: i16 linksdone, + 3: ByteCount sizetotal, + 4: ByteCount sizedone, +} + +struct PackageInfo { + 1: PackageID pid, + 2: string name, + 3: string folder, + 4: PackageID root, + 5: UserID owner, + 6: string site, + 7: string comment, + 8: string password, + 9: UTCDate added, + 10: PackageStatus status, + 11: i16 packageorder, + 12: PackageStats stats, + 13: list fids, + 14: list pids, +} + +// thrift does not allow recursive datatypes, so all data is accumulated and mapped with id +struct TreeCollection { + 1: PackageInfo root, + 2: map files, + 3: map packages +} + +// general info about link, used for collector and online results +struct LinkStatus { + 1: string url, + 2: string name, + 3: PluginName plugin, + 4: ByteCount size, // size <= 0 : unknown + 5: DownloadStatus status, + 6: string packagename, +} + +struct InteractionTask { + 1: InteractionID iid, + 2: Input input, + 3: list data, + 4: Output output, + 5: optional JSONString default_value, + 6: string title, + 7: string description, + 8: PluginName plugin, +} + +struct AddonService { + 1: string func_name, + 2: string description, + 3: list arguments, + 4: optional i16 media, +} + +struct AddonInfo { + 1: string func_name, + 2: string description, + 3: JSONString value, +} + +struct ConfigItem { + 1: string name, + 2: string label, + 3: string description, + 4: string type, + 5: JSONString default_value, + 6: JSONString value, +} + +struct ConfigHolder { + 1: string name, + 2: string label, + 3: string description, + 4: string long_description, + 5: list items, + 6: optional list info, + 7: optional list handler, // if null plugin is not loaded +} + +struct ConfigInfo { + 1: string name, + 2: string label, + 3: string description, + 4: bool saved, + 5: bool activated, +} + +struct EventInfo { + 1: string eventname, + 2: list event_args, +} + +struct UserData { + 1: UserID uid, + 2: string name, + 3: string email, + 4: i16 role, + 5: i16 permission, + 6: string folder, + 7: ByteCount traffic + 8: i16 dllimit + 9: string dlquota, + 10: ByteCount hddquota, + 11: UserID user, + 12: string templateName +} + +struct AccountInfo { + 1: PluginName plugin, + 2: string loginname, + 3: UserID owner, + 4: bool valid, + 5: UTCDate validuntil, + 6: ByteCount trafficleft, + 7: ByteCount maxtraffic, + 8: bool premium, + 9: bool activated, + 10: bool shared, + 11: map options, +} + +struct OnlineCheck { + 1: ResultID rid, // -1 -> nothing more to get + 2: map data, // url to result +} + +// exceptions + +exception PackageDoesNotExists { + 1: PackageID pid +} + +exception FileDoesNotExists { + 1: FileID fid +} + +exception UserDoesNotExists { + 1: string user +} + +exception ServiceDoesNotExists { + 1: string plugin + 2: string func +} + +exception ServiceException { + 1: string msg +} + +service Pyload { + + /////////////////////// + // Server Status + /////////////////////// + + string getServerVersion(), + ServerStatus statusServer(), + void pauseServer(), + void unpauseServer(), + bool togglePause(), + ByteCount freeSpace(), + void kill(), + void restart(), + list getLog(1: i32 offset), + bool isTimeDownload(), + bool isTimeReconnect(), + bool toggleReconnect(), + + // TODO + //void scanDownloadFolder(), + + list getProgressInfo(), + + /////////////////////// + // Configuration + /////////////////////// + + map getConfig(), + list getGlobalPlugins(), + list getUserPlugins(), + + ConfigHolder configurePlugin(1: PluginName plugin), + void saveConfig(1: ConfigHolder config), + void deleteConfig(1: PluginName plugin), + void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: JSONString value), + + /////////////////////// + // Download Preparing + /////////////////////// + + map checkURLs(1: LinkList urls), + map parseURLs(1: string html, 2: string url), + + // parses results and generates packages + OnlineCheck checkOnlineStatus(1: LinkList urls), + OnlineCheck checkOnlineStatusContainer(1: LinkList urls, 2: string filename, 3: binary data) + + // poll results from previously started online check + OnlineCheck pollResults(1: ResultID rid), + + // packagename -> urls + map generatePackages(1: LinkList links), + + /////////////////////// + // Adding/Deleting + /////////////////////// + + list generateAndAddPackages(1: LinkList links, 2: bool paused), + + PackageID createPackage(1: string name, 2: string folder, 3: PackageID root, 4: string password, + 5: string site, 6: string comment, 7: bool paused), + + PackageID addPackage(1: string name, 2: LinkList links, 3: string password), + // same as above with paused attribute + PackageID addPackageP(1: string name, 2: LinkList links, 3: string password, 4: bool paused), + + // pid -1 is toplevel + PackageID addPackageChild(1: string name, 2: LinkList links, 3: string password, 4: PackageID root, 5: bool paused), + + PackageID uploadContainer(1: string filename, 2: binary data), + + void addLinks(1: PackageID pid, 2: LinkList links) throws (1: PackageDoesNotExists e), + void addLocalFile(1: PackageID pid, 2: string name, 3: string path) throws (1: PackageDoesNotExists e) + + // these are real file operations and WILL delete files on disk + void deleteFiles(1: list fids), + void deletePackages(1: list pids), // delete the whole folder recursive + + /////////////////////// + // Collector + /////////////////////// + + list getCollector(), + + void addToCollector(1: LinkList links), + PackageID addFromCollector(1: string name, 2: bool paused), + void renameCollPack(1: string name, 2: string new_name), + void deleteCollPack(1: string name), + void deleteCollLink(1: string url), + + //////////////////////////// + // File Information retrival + //////////////////////////// + + TreeCollection getAllFiles(), + TreeCollection getAllUnfinishedFiles(), + + // pid -1 for root, full=False only delivers first level in tree + TreeCollection getFileTree(1: PackageID pid, 2: bool full), + TreeCollection getUnfinishedFileTree(1: PackageID pid, 2: bool full), + + // same as above with full=False + TreeCollection getPackageContent(1: PackageID pid), + + PackageInfo getPackageInfo(1: PackageID pid) throws (1: PackageDoesNotExists e), + FileInfo getFileInfo(1: FileID fid) throws (1: FileDoesNotExists e), + TreeCollection findFiles(1: string pattern), + + /////////////////////// + // Modify Downloads + /////////////////////// + + void restartPackage(1: PackageID pid), + void restartFile(1: FileID fid), + void recheckPackage(1: PackageID pid), + void restartFailed(), + void stopDownloads(1: list fids), + void stopAllDownloads(), + + ///////////////////////// + // Modify Files/Packages + ///////////////////////// + + // moving package while downloading is not possible, so they will return bool to indicate success + void setPackagePaused(1: PackageID pid, 2: bool paused) throws (1: PackageDoesNotExists e), + bool setPackageFolder(1: PackageID pid, 2: string path) throws (1: PackageDoesNotExists e), + void setPackageData(1: PackageID pid, 2: map data) throws (1: PackageDoesNotExists e), + + // as above, this will move files on disk + bool movePackage(1: PackageID pid, 2: PackageID root) throws (1: PackageDoesNotExists e), + bool moveFiles(1: list fids, 2: PackageID pid) throws (1: PackageDoesNotExists e), + + void orderPackage(1: list pids, 2: i16 position), + void orderFiles(1: list fids, 2: PackageID pid, 3: i16 position), + + /////////////////////// + // User Interaction + /////////////////////// + + // mode = Output types binary ORed + bool isInteractionWaiting(1: i16 mode), + InteractionTask getInteractionTask(1: i16 mode), + void setInteractionResult(1: InteractionID iid, 2: JSONString result), + + // generate a download link, everybody can download the file until timeout reached + string generateDownloadLink(1: FileID fid, 2: i16 timeout), + + list getNotifications(), + + /////////////////////// + // Event Handling + /////////////////////// + + list getEvents(1: string uuid), + + /////////////////////// + // Account Methods + /////////////////////// + + list getAccounts(1: bool refresh), + list getAccountTypes(), + void updateAccount(1: PluginName plugin, 2: string account, 3: string password), + void updateAccountInfo(1: AccountInfo account), + void removeAccount(1: PluginName plugin, 2: string account), + + ///////////////////////// + // Auth+User Information + ///////////////////////// + + bool login(1: string username, 2: string password), + // returns own user data + UserData getUserData(), + + // all user, for admins only + map getAllUserData(), + + UserData addUser(1: string username, 2:string password), + + // normal user can only update their own userdata and not all attributes + void updateUserData(1: UserData data), + void removeUser(1: UserID uid), + + // works contextual, admin can change every password + bool setPassword(1: string username, 2: string old_password, 3: string new_password), + + /////////////////////// + // Addon Methods + /////////////////////// + + map> getAllInfo(), + list getInfoByPlugin(1: PluginName plugin), + + map> getAddonHandler(), + bool hasAddonHandler(1: PluginName plugin, 2: string func), + + void callAddon(1: PluginName plugin, 2: string func, 3: list arguments) + throws (1: ServiceDoesNotExists e, 2: ServiceException ex), + + // special variant of callAddon that works on the media types, acccepting integer + void callAddonHandler(1: PluginName plugin, 2: string func, 3: PackageID pid_or_fid) + throws (1: ServiceDoesNotExists e, 2: ServiceException ex), + + + //scheduler + + // TODO + +} diff --git a/module/remote/socketbackend/__init__.py b/module/remote/socketbackend/__init__.py deleted file mode 100644 index de6d13128..000000000 --- a/module/remote/socketbackend/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__author__ = 'christian' - \ No newline at end of file diff --git a/module/remote/socketbackend/create_ttypes.py b/module/remote/socketbackend/create_ttypes.py deleted file mode 100644 index 8fd59f194..000000000 --- a/module/remote/socketbackend/create_ttypes.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import inspect -import sys -from os.path import abspath, dirname, join - -path = dirname(abspath(__file__)) -module = join(path, "..", "..") - -sys.path.append(join(module, "lib")) -sys.path.append(join(module, "remote")) - -from thriftbackend.thriftgen.pyload import ttypes -from thriftbackend.thriftgen.pyload.Pyload import Iface - - -def main(): - - enums = [] - classes = [] - - print "generating lightweight ttypes.py" - - for name in dir(ttypes): - klass = getattr(ttypes, name) - - if name in ("TBase", "TExceptionBase") or name.startswith("_") or not (issubclass(klass, ttypes.TBase) or issubclass(klass, ttypes.TExceptionBase)): - continue - - if hasattr(klass, "thrift_spec"): - classes.append(klass) - else: - enums.append(klass) - - - f = open(join(path, "ttypes.py"), "wb") - - f.write( - """#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Autogenerated by pyload -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -class BaseObject(object): -\t__slots__ = [] - -""") - - ## generate enums - for enum in enums: - name = enum.__name__ - f.write("class %s:\n" % name) - - for attr in dir(enum): - if attr.startswith("_") or attr in ("read", "write"): continue - - f.write("\t%s = %s\n" % (attr, getattr(enum, attr))) - - f.write("\n") - - for klass in classes: - name = klass.__name__ - base = "Exception" if issubclass(klass, ttypes.TExceptionBase) else "BaseObject" - f.write("class %s(%s):\n" % (name, base)) - f.write("\t__slots__ = %s\n\n" % klass.__slots__) - - #create init - args = ["self"] + ["%s=None" % x for x in klass.__slots__] - - f.write("\tdef __init__(%s):\n" % ", ".join(args)) - for attr in klass.__slots__: - f.write("\t\tself.%s = %s\n" % (attr, attr)) - - f.write("\n") - - f.write("class Iface(object):\n") - - for name in dir(Iface): - if name.startswith("_"): continue - - func = inspect.getargspec(getattr(Iface, name)) - - f.write("\tdef %s(%s):\n\t\tpass\n" % (name, ", ".join(func.args))) - - f.write("\n") - - f.close() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/module/remote/socketbackend/ttypes.py b/module/remote/socketbackend/ttypes.py deleted file mode 100644 index 06f051fc7..000000000 --- a/module/remote/socketbackend/ttypes.py +++ /dev/null @@ -1,503 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Autogenerated by pyload -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -class BaseObject(object): - __slots__ = [] - -class DownloadStatus: - Aborted = 12 - Custom = 15 - Decrypting = 13 - Downloading = 10 - Failed = 7 - Finished = 5 - NA = 0 - Offline = 1 - Online = 2 - Paused = 4 - Processing = 14 - Queued = 3 - Skipped = 6 - Starting = 8 - TempOffline = 11 - Unknown = 16 - Waiting = 9 - -class FileStatus: - Missing = 1 - Ok = 0 - Remote = 2 - -class Input: - Bool = 4 - Click = 5 - List = 8 - Multiple = 7 - NA = 0 - Password = 3 - Select = 6 - Table = 9 - Text = 1 - Textbox = 2 - -class MediaType: - All = 0 - Archive = 32 - Audio = 2 - Document = 16 - Image = 4 - Other = 1 - Video = 8 - -class Output: - All = 0 - Captcha = 2 - Notification = 1 - Query = 4 - -class PackageStatus: - Folder = 2 - Ok = 0 - Paused = 1 - Remote = 3 - -class Permission: - Accounts = 16 - Add = 1 - All = 0 - Delete = 2 - Download = 8 - Interaction = 32 - Modify = 4 - Plugins = 64 - -class Role: - Admin = 0 - User = 1 - -class AccountInfo(BaseObject): - __slots__ = ['plugin', 'loginname', 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'shared', 'options'] - - def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, options=None): - self.plugin = plugin - self.loginname = loginname - self.owner = owner - self.valid = valid - self.validuntil = validuntil - self.trafficleft = trafficleft - self.maxtraffic = maxtraffic - self.premium = premium - self.activated = activated - self.shared = shared - self.options = options - -class AddonInfo(BaseObject): - __slots__ = ['func_name', 'description', 'value'] - - def __init__(self, func_name=None, description=None, value=None): - self.func_name = func_name - self.description = description - self.value = value - -class AddonService(BaseObject): - __slots__ = ['func_name', 'description', 'arguments', 'media'] - - def __init__(self, func_name=None, description=None, arguments=None, media=None): - self.func_name = func_name - self.description = description - self.arguments = arguments - self.media = media - -class ConfigHolder(BaseObject): - __slots__ = ['name', 'label', 'description', 'long_description', 'items', 'info', 'handler'] - - def __init__(self, name=None, label=None, description=None, long_description=None, items=None, info=None, handler=None): - self.name = name - self.label = label - self.description = description - self.long_description = long_description - self.items = items - self.info = info - self.handler = handler - -class ConfigInfo(BaseObject): - __slots__ = ['name', 'label', 'description', 'saved', 'activated'] - - def __init__(self, name=None, label=None, description=None, saved=None, activated=None): - self.name = name - self.label = label - self.description = description - self.saved = saved - self.activated = activated - -class ConfigItem(BaseObject): - __slots__ = ['name', 'label', 'description', 'type', 'default_value', 'value'] - - def __init__(self, name=None, label=None, description=None, type=None, default_value=None, value=None): - self.name = name - self.label = label - self.description = description - self.type = type - self.default_value = default_value - self.value = value - -class DownloadInfo(BaseObject): - __slots__ = ['url', 'plugin', 'hash', 'status', 'statusmsg', 'error'] - - def __init__(self, url=None, plugin=None, hash=None, status=None, statusmsg=None, error=None): - self.url = url - self.plugin = plugin - self.hash = hash - self.status = status - self.statusmsg = statusmsg - self.error = error - -class DownloadProgress(BaseObject): - __slots__ = ['fid', 'pid', 'speed', 'status'] - - def __init__(self, fid=None, pid=None, speed=None, status=None): - self.fid = fid - self.pid = pid - self.speed = speed - self.status = status - -class EventInfo(BaseObject): - __slots__ = ['eventname', 'event_args'] - - def __init__(self, eventname=None, event_args=None): - self.eventname = eventname - self.event_args = event_args - -class FileDoesNotExists(Exception): - __slots__ = ['fid'] - - def __init__(self, fid=None): - self.fid = fid - -class FileInfo(BaseObject): - __slots__ = ['fid', 'name', 'package', 'owner', 'size', 'status', 'media', 'added', 'fileorder', 'download'] - - def __init__(self, fid=None, name=None, package=None, owner=None, size=None, status=None, media=None, added=None, fileorder=None, download=None): - self.fid = fid - self.name = name - self.package = package - self.owner = owner - self.size = size - self.status = status - self.media = media - self.added = added - self.fileorder = fileorder - self.download = download - -class InteractionTask(BaseObject): - __slots__ = ['iid', 'input', 'data', 'output', 'default_value', 'title', 'description', 'plugin'] - - def __init__(self, iid=None, input=None, data=None, output=None, default_value=None, title=None, description=None, plugin=None): - self.iid = iid - self.input = input - self.data = data - self.output = output - self.default_value = default_value - self.title = title - self.description = description - self.plugin = plugin - -class LinkStatus(BaseObject): - __slots__ = ['url', 'name', 'plugin', 'size', 'status', 'packagename'] - - def __init__(self, url=None, name=None, plugin=None, size=None, status=None, packagename=None): - self.url = url - self.name = name - self.plugin = plugin - self.size = size - self.status = status - self.packagename = packagename - -class OnlineCheck(BaseObject): - __slots__ = ['rid', 'data'] - - def __init__(self, rid=None, data=None): - self.rid = rid - self.data = data - -class PackageDoesNotExists(Exception): - __slots__ = ['pid'] - - def __init__(self, pid=None): - self.pid = pid - -class PackageInfo(BaseObject): - __slots__ = ['pid', 'name', 'folder', 'root', 'owner', 'site', 'comment', 'password', 'added', 'status', 'packageorder', 'stats', 'fids', 'pids'] - - def __init__(self, pid=None, name=None, folder=None, root=None, owner=None, site=None, comment=None, password=None, added=None, status=None, packageorder=None, stats=None, fids=None, pids=None): - self.pid = pid - self.name = name - self.folder = folder - self.root = root - self.owner = owner - self.site = site - self.comment = comment - self.password = password - self.added = added - self.status = status - self.packageorder = packageorder - self.stats = stats - self.fids = fids - self.pids = pids - -class PackageStats(BaseObject): - __slots__ = ['linkstotal', 'linksdone', 'sizetotal', 'sizedone'] - - def __init__(self, linkstotal=None, linksdone=None, sizetotal=None, sizedone=None): - self.linkstotal = linkstotal - self.linksdone = linksdone - self.sizetotal = sizetotal - self.sizedone = sizedone - -class ProgressInfo(BaseObject): - __slots__ = ['plugin', 'name', 'statusmsg', 'eta', 'format_eta', 'done', 'total', 'download'] - - def __init__(self, plugin=None, name=None, statusmsg=None, eta=None, format_eta=None, done=None, total=None, download=None): - self.plugin = plugin - self.name = name - self.statusmsg = statusmsg - self.eta = eta - self.format_eta = format_eta - self.done = done - self.total = total - self.download = download - -class ServerStatus(BaseObject): - __slots__ = ['pause', 'active', 'queue', 'total', 'speed', 'download', 'reconnect'] - - def __init__(self, pause=None, active=None, queue=None, total=None, speed=None, download=None, reconnect=None): - self.pause = pause - self.active = active - self.queue = queue - self.total = total - self.speed = speed - self.download = download - self.reconnect = reconnect - -class ServiceDoesNotExists(Exception): - __slots__ = ['plugin', 'func'] - - def __init__(self, plugin=None, func=None): - self.plugin = plugin - self.func = func - -class ServiceException(Exception): - __slots__ = ['msg'] - - def __init__(self, msg=None): - self.msg = msg - -class TreeCollection(BaseObject): - __slots__ = ['root', 'files', 'packages'] - - def __init__(self, root=None, files=None, packages=None): - self.root = root - self.files = files - self.packages = packages - -class UserData(BaseObject): - __slots__ = ['uid', 'name', 'email', 'role', 'permission', 'folder', 'traffic', 'dllimit', 'dlquota', 'hddquota', 'user', 'templateName'] - - def __init__(self, uid=None, name=None, email=None, role=None, permission=None, folder=None, traffic=None, dllimit=None, dlquota=None, hddquota=None, user=None, templateName=None): - self.uid = uid - self.name = name - self.email = email - self.role = role - self.permission = permission - self.folder = folder - self.traffic = traffic - self.dllimit = dllimit - self.dlquota = dlquota - self.hddquota = hddquota - self.user = user - self.templateName = templateName - -class UserDoesNotExists(Exception): - __slots__ = ['user'] - - def __init__(self, user=None): - self.user = user - -class Iface(object): - def addFromCollector(self, name, paused): - pass - def addLinks(self, pid, links): - pass - def addLocalFile(self, pid, name, path): - pass - def addPackage(self, name, links, password): - pass - def addPackageChild(self, name, links, password, root, paused): - pass - def addPackageP(self, name, links, password, paused): - pass - def addToCollector(self, links): - pass - def addUser(self, username, password): - pass - def callAddon(self, plugin, func, arguments): - pass - def callAddonHandler(self, plugin, func, pid_or_fid): - pass - def checkOnlineStatus(self, urls): - pass - def checkOnlineStatusContainer(self, urls, filename, data): - pass - def checkURLs(self, urls): - pass - def configurePlugin(self, plugin): - pass - def createPackage(self, name, folder, root, password, site, comment, paused): - pass - def deleteCollLink(self, url): - pass - def deleteCollPack(self, name): - pass - def deleteConfig(self, plugin): - pass - def deleteFiles(self, fids): - pass - def deletePackages(self, pids): - pass - def findFiles(self, pattern): - pass - def freeSpace(self): - pass - def generateAndAddPackages(self, links, paused): - pass - def generateDownloadLink(self, fid, timeout): - pass - def generatePackages(self, links): - pass - def getAccountTypes(self): - pass - def getAccounts(self, refresh): - pass - def getAddonHandler(self): - pass - def getAllFiles(self): - pass - def getAllInfo(self): - pass - def getAllUnfinishedFiles(self): - pass - def getAllUserData(self): - pass - def getCollector(self): - pass - def getConfig(self): - pass - def getEvents(self, uuid): - pass - def getFileInfo(self, fid): - pass - def getFileTree(self, pid, full): - pass - def getGlobalPlugins(self): - pass - def getInfoByPlugin(self, plugin): - pass - def getInteractionTask(self, mode): - pass - def getLog(self, offset): - pass - def getNotifications(self): - pass - def getPackageContent(self, pid): - pass - def getPackageInfo(self, pid): - pass - def getProgressInfo(self): - pass - def getServerVersion(self): - pass - def getUnfinishedFileTree(self, pid, full): - pass - def getUserData(self): - pass - def getUserPlugins(self): - pass - def hasAddonHandler(self, plugin, func): - pass - def isInteractionWaiting(self, mode): - pass - def isTimeDownload(self): - pass - def isTimeReconnect(self): - pass - def kill(self): - pass - def login(self, username, password): - pass - def moveFiles(self, fids, pid): - pass - def movePackage(self, pid, root): - pass - def orderFiles(self, fids, pid, position): - pass - def orderPackage(self, pids, position): - pass - def parseURLs(self, html, url): - pass - def pauseServer(self): - pass - def pollResults(self, rid): - pass - def recheckPackage(self, pid): - pass - def removeAccount(self, plugin, account): - pass - def removeUser(self, uid): - pass - def renameCollPack(self, name, new_name): - pass - def restart(self): - pass - def restartFailed(self): - pass - def restartFile(self, fid): - pass - def restartPackage(self, pid): - pass - def saveConfig(self, config): - pass - def setConfigHandler(self, plugin, iid, value): - pass - def setInteractionResult(self, iid, result): - pass - def setPackageData(self, pid, data): - pass - def setPackageFolder(self, pid, path): - pass - def setPackagePaused(self, pid, paused): - pass - def setPassword(self, username, old_password, new_password): - pass - def statusServer(self): - pass - def stopAllDownloads(self): - pass - def stopDownloads(self, fids): - pass - def togglePause(self): - pass - def toggleReconnect(self): - pass - def unpauseServer(self): - pass - def updateAccount(self, plugin, account, password): - pass - def updateAccountInfo(self, account): - pass - def updateUserData(self, data): - pass - def uploadContainer(self, filename, data): - pass - diff --git a/module/remote/thriftbackend/Processor.py b/module/remote/thriftbackend/Processor.py deleted file mode 100644 index 6f822e98f..000000000 --- a/module/remote/thriftbackend/Processor.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- - -from thriftgen.pyload import Pyload - -#TODO: new login -class Processor(Pyload.Processor): - def __init__(self, *args, **kwargs): - Pyload.Processor.__init__(self, *args, **kwargs) - self.authenticated = {} - - def process(self, iprot, oprot): - trans = oprot.trans - if trans not in self.authenticated: - self.authenticated[trans] = False - oldclose = trans.close - - def wrap(): - if self in self.authenticated: - del self.authenticated[trans] - oldclose() - - trans.close = wrap - authenticated = self.authenticated[trans] - (name, type, seqid) = iprot.readMessageBegin() - - # unknown method - if name not in self._processMap: - iprot.skip(Pyload.TType.STRUCT) - iprot.readMessageEnd() - x = Pyload.TApplicationException(Pyload.TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % name) - oprot.writeMessageBegin(name, Pyload.TMessageType.EXCEPTION, seqid) - x.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - return - - # not logged in - elif not authenticated and not name == "login": - iprot.skip(Pyload.TType.STRUCT) - iprot.readMessageEnd() - # 20 - Not logged in (in situ declared error code) - x = Pyload.TApplicationException(20, 'Not logged in') - oprot.writeMessageBegin(name, Pyload.TMessageType.EXCEPTION, seqid) - x.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - return - - elif not authenticated and name == "login": - args = Pyload.login_args() - args.read(iprot) - iprot.readMessageEnd() - result = Pyload.login_result() - # api login - self.authenticated[trans] = self._handler.checkAuth(args.username, args.password, trans.remoteaddr[0]) - - result.success = True if self.authenticated[trans] else False - oprot.writeMessageBegin("login", Pyload.TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - elif self._handler.isAuthorized(name, authenticated): - self._processMap[name](self, seqid, iprot, oprot) - - else: - #no permission - iprot.skip(Pyload.TType.STRUCT) - iprot.readMessageEnd() - # 21 - Not authorized - x = Pyload.TApplicationException(21, 'Not authorized') - oprot.writeMessageBegin(name, Pyload.TMessageType.EXCEPTION, seqid) - x.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - return - - return True diff --git a/module/remote/thriftbackend/Protocol.py b/module/remote/thriftbackend/Protocol.py deleted file mode 100644 index c42d01459..000000000 --- a/module/remote/thriftbackend/Protocol.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -from thrift.protocol import TBinaryProtocol - -class Protocol(TBinaryProtocol.TBinaryProtocol): - def writeString(self, str): - try: - str = str.encode("utf8", "ignore") - except Exception, e: - pass - - self.writeI32(len(str)) - self.trans.write(str) - - def readString(self): - len = self.readI32() - str = self.trans.readAll(len) - try: - str = str.decode("utf8", "ignore") - except: - pass - - return str - - -class ProtocolFactory(TBinaryProtocol.TBinaryProtocolFactory): - - def getProtocol(self, trans): - prot = Protocol(trans, self.strictRead, self.strictWrite) - return prot \ No newline at end of file diff --git a/module/remote/thriftbackend/Socket.py b/module/remote/thriftbackend/Socket.py deleted file mode 100644 index 2a84004ea..000000000 --- a/module/remote/thriftbackend/Socket.py +++ /dev/null @@ -1,135 +0,0 @@ -# -*- coding: utf-8 -*- - -import sys -import socket -import errno - -from time import sleep - -from thrift.transport.TSocket import TSocket, TServerSocket, TTransportException - -#overwritten when ssl is used -WantReadError = None -WantWriteError = None - -class SecureSocketConnection: - def __init__(self, connection): - self.__dict__["connection"] = connection - - def __getattr__(self, name): - return getattr(self.__dict__["connection"], name) - - def __setattr__(self, name, value): - setattr(self.__dict__["connection"], name, value) - - def shutdown(self, how=1): - self.__dict__["connection"].shutdown() - - def accept(self): - connection, address = self.__dict__["connection"].accept() - return SecureSocketConnection(connection), address - - def send(self, buff): - try: - return self.__dict__["connection"].send(buff) - except (WantReadError, WantWriteError): - sleep(0.1) - return self.send(buff) - - def recv(self, buff): - try: - return self.__dict__["connection"].recv(buff) - except (WantReadError, WantWriteError): - sleep(0.1) - return self.recv(buff) - -class Socket(TSocket): - def __init__(self, host='localhost', port=7228, ssl=False): - TSocket.__init__(self, host, port) - self.ssl = ssl - - def open(self): - global WantReadError, WantWriteError - - if self.ssl: - SSL = __import__("OpenSSL", globals(), locals(), "SSL", -1).SSL - WantReadError = SSL.WantReadError - WantWriteError = SSL.WantWriteError - - ctx = SSL.Context(SSL.SSLv23_METHOD) - c = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) - c.set_connect_state() - self.handle = SecureSocketConnection(c) - else: - self.handle = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - #errno 104 connection reset - - self.handle.settimeout(self._timeout) - self.handle.connect((self.host, self.port)) - - def read(self, sz): - try: - buff = self.handle.recv(sz) - except socket.error, e: - if (e.args[0] == errno.ECONNRESET and - (sys.platform == 'darwin' or sys.platform.startswith('freebsd'))): - # freebsd and Mach don't follow POSIX semantics of recv - # and fail with ECONNRESET if peer performed shutdown. - # See corresponding comment and code in TSocket::read() - # in lib/cpp/src/transport/TSocket.cpp. - self.close() - # Trigger the check to raise the END_OF_FILE exception below. - buff = '' - else: - raise - except Exception, e: - # SSL connection was closed - if e.args == (-1, 'Unexpected EOF'): - buff = '' - elif e.args == ([('SSL routines', 'SSL23_GET_CLIENT_HELLO', 'unknown protocol')],): - #a socket not using ssl tried to connect - buff = '' - else: - raise - - if not len(buff): - raise TTransportException(type=TTransportException.END_OF_FILE, message='TSocket read 0 bytes') - return buff - - -class ServerSocket(TServerSocket, Socket): - def __init__(self, port=7228, host="0.0.0.0", key="", cert=""): - self.host = host - self.port = port - self.key = key - self.cert = cert - self.handle = None - - def listen(self): - if self.cert and self.key: - SSL = __import__("OpenSSL", globals(), locals(), "SSL", -1).SSL - WantReadError = SSL.WantReadError - ctx = SSL.Context(SSL.SSLv23_METHOD) - ctx.use_privatekey_file(self.key) - ctx.use_certificate_file(self.cert) - - tmpConnection = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) - tmpConnection.set_accept_state() - self.handle = SecureSocketConnection(tmpConnection) - - else: - self.handle = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - - self.handle.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - if hasattr(self.handle, 'set_timeout'): - self.handle.set_timeout(None) - self.handle.bind((self.host, self.port)) - self.handle.listen(128) - - def accept(self): - client, addr = self.handle.accept() - result = Socket() - result.setHandle(client) - return result diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py deleted file mode 100644 index 74363cf62..000000000 --- a/module/remote/thriftbackend/ThriftClient.py +++ /dev/null @@ -1,109 +0,0 @@ -# -*- coding: utf-8 -*- - -import sys -from socket import error -from os.path import dirname, abspath, join -from traceback import print_exc - -try: - import thrift -except ImportError: - sys.path.append(abspath(join(dirname(abspath(__file__)), "..", "..", "lib"))) - -from thrift.transport import TTransport -#from thrift.transport.TZlibTransport import TZlibTransport -from Socket import Socket -from Protocol import Protocol - -# modules should import ttypes from here, when want to avoid importing API - -from thriftgen.pyload import Pyload -from thriftgen.pyload.ttypes import * - -ConnectionClosed = TTransport.TTransportException - -class WrongLogin(Exception): - pass - -class NoConnection(Exception): - pass - -class NoSSL(Exception): - pass - -class ThriftClient: - def __init__(self, host="localhost", port=7227, user="", password=""): - - self.createConnection(host, port) - try: - self.transport.open() - except error, e: - if e.args and e.args[0] in (111, 10061): - raise NoConnection - else: - print_exc() - raise NoConnection - - try: - correct = self.client.login(user, password) - except error, e: - if e.args and e.args[0] == 104: - #connection reset by peer, probably wants ssl - try: - self.createConnection(host, port, True) - #set timeout or a ssl socket will block when querying none ssl server - self.socket.setTimeout(10) - - except ImportError: - #@TODO untested - raise NoSSL - try: - self.transport.open() - correct = self.client.login(user, password) - finally: - self.socket.setTimeout(None) - elif e.args and e.args[0] == 32: - raise NoConnection - else: - print_exc() - raise NoConnection - - if not correct: - self.transport.close() - raise WrongLogin - - def createConnection(self, host, port, ssl=False): - self.socket = Socket(host, port, ssl) - self.transport = TTransport.TBufferedTransport(self.socket) -# self.transport = TZlibTransport(TTransport.TBufferedTransport(self.socket)) - - protocol = Protocol(self.transport) - self.client = Pyload.Client(protocol) - - def close(self): - self.transport.close() - - def __getattr__(self, item): - return getattr(self.client, item) - -if __name__ == "__main__": - - client = ThriftClient(user="User", password="pwhere") - - print client.getServerVersion() - print client.statusServer() - print client.statusDownloads() - q = client.getQueue() - -# for p in q: -# data = client.getPackageData(p.pid) -# print data -# print "Package Name: ", data.name - - - print client.getServices() - print client.call(Pyload.ServiceCall("UpdateManager", "recheckForUpdates")) - - print client.getConfigValue("download", "limit_speed", "core") - - client.close() \ No newline at end of file diff --git a/module/remote/thriftbackend/ThriftTest.py b/module/remote/thriftbackend/ThriftTest.py deleted file mode 100644 index 69ac6a745..000000000 --- a/module/remote/thriftbackend/ThriftTest.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import sys -from os.path import join,abspath,dirname - -path = join((abspath(dirname(__file__))), "..","..", "lib") -sys.path.append(path) - -from thriftgen.pyload import Pyload -from thriftgen.pyload.ttypes import * -from Socket import Socket - -from thrift import Thrift -from thrift.transport import TTransport - -from Protocol import Protocol - -from time import time - -import xmlrpclib - -def bench(f, *args, **kwargs): - s = time() - ret = [f(*args, **kwargs) for i in range(0,100)] - e = time() - try: - print "%s: %f s" % (f._Method__name, e-s) - except : - print "%s: %f s" % (f.__name__, e-s) - return ret - -from getpass import getpass -user = raw_input("user ") -passwd = getpass("password ") - -server_url = "http%s://%s:%s@%s:%s/" % ( - "", - user, - passwd, - "127.0.0.1", - 7227 -) -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 -try: - - # Make socket - transport = Socket('localhost', 7228, False) - - # Buffering is critical. Raw sockets are very slow - transport = TTransport.TBufferedTransport(transport) - - # Wrap in a protocol - protocol = Protocol(transport) - - # Create a client to use the protocol encoder - client = Pyload.Client(protocol) - - # Connect! - transport.open() - - print "Login", client.login(user, passwd) - - 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: - data = client.getPackageData(p.pid) - print data - print "Package Name: ", data.name - - # Close! - transport.close() - -except Thrift.TException, tx: - print 'ThriftExpection: %s' % tx.message diff --git a/module/remote/thriftbackend/Transport.py b/module/remote/thriftbackend/Transport.py deleted file mode 100644 index 5772c5a9e..000000000 --- a/module/remote/thriftbackend/Transport.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- - -from thrift.transport.TTransport import TBufferedTransport -from thrift.transport.TZlibTransport import TZlibTransport - -class Transport(TBufferedTransport): - DEFAULT_BUFFER = 4096 - - def __init__(self, trans, rbuf_size = DEFAULT_BUFFER): - TBufferedTransport.__init__(self, trans, rbuf_size) - self.handle = trans.handle - self.remoteaddr = trans.handle.getpeername() - -class TransportCompressed(TZlibTransport): - DEFAULT_BUFFER = 4096 - - def __init__(self, trans, rbuf_size = DEFAULT_BUFFER): - TZlibTransport.__init__(self, trans, rbuf_size) - self.handle = trans.handle - self.remoteaddr = trans.handle.getpeername() - -class TransportFactory: - def getTransport(self, trans): - buffered = Transport(trans) - return buffered - -class TransportFactoryCompressed: - _last_trans = None - _last_z = None - - def getTransport(self, trans, compresslevel=9): - if trans == self._last_trans: - return self._last_z - ztrans = TransportCompressed(Transport(trans), compresslevel) - self._last_trans = trans - self._last_z = ztrans - return ztrans \ No newline at end of file diff --git a/module/remote/thriftbackend/__init__.py b/module/remote/thriftbackend/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift deleted file mode 100644 index 8257107b4..000000000 --- a/module/remote/thriftbackend/pyload.thrift +++ /dev/null @@ -1,514 +0,0 @@ -namespace java org.pyload.thrift - -typedef i32 FileID -typedef i32 PackageID -typedef i32 ResultID -typedef i32 InteractionID -typedef i32 UserID -typedef i64 UTCDate -typedef i64 ByteCount -typedef list LinkList -typedef string PluginName -typedef string JSONString - -// NA - Not Available -enum DownloadStatus { - NA, - Offline, - Online, - Queued, - Paused, - Finished, - Skipped, - Failed, - Starting, - Waiting, - Downloading, - TempOffline, - Aborted, - Decrypting, - Processing, - Custom, - Unknown -} - -enum MediaType { - All = 0 - Other = 1, - Audio = 2, - Image = 4, - Video = 8, - Document = 16, - Archive = 32, -} - -enum FileStatus { - Ok, - Missing, - Remote, // file is available at remote location -} - -enum PackageStatus { - Ok, - Paused, - Folder, - Remote, -} - -// types for user interaction -// some may only be place holder currently not supported -// also all input - output combination are not reasonable, see InteractionManager for further info -// Todo: how about: time, int, ip, file, s.o. -enum Input { - NA, - Text, - Textbox, - Password, - Bool, // confirm like, yes or no dialog - Click, // for positional captchas - Select, // select from list - Multiple, // multiple choice from list of elements - List, // arbitary list of elements - Table // table like data structure -} -// more can be implemented by need - -// this describes the type of the outgoing interaction -// ensure they can be logcial or'ed -enum Output { - All = 0, - Notification = 1, - Captcha = 2, - Query = 4, -} - -enum Permission { - All = 0, // requires no permission, but login - Add = 1, // can add packages - Delete = 2, // can delete packages - Modify = 4, // modify some attribute of downloads - Download = 8, // can download from webinterface - Accounts = 16, // can access accounts - Interaction = 32, // can interact with plugins - Plugins = 64 // user can configure plugins and activate addons -} - -enum Role { - Admin = 0, //admin has all permissions implicit - User = 1 -} - -struct DownloadProgress { - 1: FileID fid, - 2: PackageID pid, - 3: ByteCount speed, - 4: DownloadStatus status, -} - -struct ProgressInfo { - 1: PluginName plugin, - 2: string name, - 3: string statusmsg, - 4: i32 eta, // in seconds - 5: string format_eta, - 6: ByteCount done, - 7: ByteCount total, // arbitary number, size in case of files - 8: optional DownloadProgress download -} - -struct ServerStatus { - 1: bool pause, - 2: i16 active, - 3: i16 queue, - 4: i16 total, - 5: ByteCount speed, - 6: bool download, - 7: bool reconnect -} - -// download info for specific file -struct DownloadInfo { - 1: string url, - 2: PluginName plugin, - 3: string hash, - 4: DownloadStatus status, - 5: string statusmsg, - 6: string error, -} - -struct FileInfo { - 1: FileID fid, - 2: string name, - 3: PackageID package, - 4: UserID owner, - 5: ByteCount size, - 6: FileStatus status, - 7: MediaType media, - 8: UTCDate added, - 9: i16 fileorder, - 10: optional DownloadInfo download, -} - -struct PackageStats { - 1: i16 linkstotal, - 2: i16 linksdone, - 3: ByteCount sizetotal, - 4: ByteCount sizedone, -} - -struct PackageInfo { - 1: PackageID pid, - 2: string name, - 3: string folder, - 4: PackageID root, - 5: UserID owner, - 6: string site, - 7: string comment, - 8: string password, - 9: UTCDate added, - 10: PackageStatus status, - 11: i16 packageorder, - 12: PackageStats stats, - 13: list fids, - 14: list pids, -} - -// thrift does not allow recursive datatypes, so all data is accumulated and mapped with id -struct TreeCollection { - 1: PackageInfo root, - 2: map files, - 3: map packages -} - -// general info about link, used for collector and online results -struct LinkStatus { - 1: string url, - 2: string name, - 3: PluginName plugin, - 4: ByteCount size, // size <= 0 : unknown - 5: DownloadStatus status, - 6: string packagename, -} - -struct InteractionTask { - 1: InteractionID iid, - 2: Input input, - 3: list data, - 4: Output output, - 5: optional JSONString default_value, - 6: string title, - 7: string description, - 8: PluginName plugin, -} - -struct AddonService { - 1: string func_name, - 2: string description, - 3: list arguments, - 4: optional i16 media, -} - -struct AddonInfo { - 1: string func_name, - 2: string description, - 3: JSONString value, -} - -struct ConfigItem { - 1: string name, - 2: string label, - 3: string description, - 4: string type, - 5: JSONString default_value, - 6: JSONString value, -} - -struct ConfigHolder { - 1: string name, - 2: string label, - 3: string description, - 4: string long_description, - 5: list items, - 6: optional list info, - 7: optional list handler, // if null plugin is not loaded -} - -struct ConfigInfo { - 1: string name, - 2: string label, - 3: string description, - 4: bool saved, - 5: bool activated, -} - -struct EventInfo { - 1: string eventname, - 2: list event_args, -} - -struct UserData { - 1: UserID uid, - 2: string name, - 3: string email, - 4: i16 role, - 5: i16 permission, - 6: string folder, - 7: ByteCount traffic - 8: i16 dllimit - 9: string dlquota, - 10: ByteCount hddquota, - 11: UserID user, - 12: string templateName -} - -struct AccountInfo { - 1: PluginName plugin, - 2: string loginname, - 3: UserID owner, - 4: bool valid, - 5: UTCDate validuntil, - 6: ByteCount trafficleft, - 7: ByteCount maxtraffic, - 8: bool premium, - 9: bool activated, - 10: bool shared, - 11: map options, -} - -struct OnlineCheck { - 1: ResultID rid, // -1 -> nothing more to get - 2: map data, // url to result -} - -// exceptions - -exception PackageDoesNotExists { - 1: PackageID pid -} - -exception FileDoesNotExists { - 1: FileID fid -} - -exception UserDoesNotExists { - 1: string user -} - -exception ServiceDoesNotExists { - 1: string plugin - 2: string func -} - -exception ServiceException { - 1: string msg -} - -service Pyload { - - /////////////////////// - // Server Status - /////////////////////// - - string getServerVersion(), - ServerStatus statusServer(), - void pauseServer(), - void unpauseServer(), - bool togglePause(), - ByteCount freeSpace(), - void kill(), - void restart(), - list getLog(1: i32 offset), - bool isTimeDownload(), - bool isTimeReconnect(), - bool toggleReconnect(), - - // TODO - //void scanDownloadFolder(), - - list getProgressInfo(), - - /////////////////////// - // Configuration - /////////////////////// - - map getConfig(), - list getGlobalPlugins(), - list getUserPlugins(), - - ConfigHolder configurePlugin(1: PluginName plugin), - void saveConfig(1: ConfigHolder config), - void deleteConfig(1: PluginName plugin), - void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: JSONString value), - - /////////////////////// - // Download Preparing - /////////////////////// - - map checkURLs(1: LinkList urls), - map parseURLs(1: string html, 2: string url), - - // parses results and generates packages - OnlineCheck checkOnlineStatus(1: LinkList urls), - OnlineCheck checkOnlineStatusContainer(1: LinkList urls, 2: string filename, 3: binary data) - - // poll results from previously started online check - OnlineCheck pollResults(1: ResultID rid), - - // packagename -> urls - map generatePackages(1: LinkList links), - - /////////////////////// - // Adding/Deleting - /////////////////////// - - list generateAndAddPackages(1: LinkList links, 2: bool paused), - - PackageID createPackage(1: string name, 2: string folder, 3: PackageID root, 4: string password, - 5: string site, 6: string comment, 7: bool paused), - - PackageID addPackage(1: string name, 2: LinkList links, 3: string password), - // same as above with paused attribute - PackageID addPackageP(1: string name, 2: LinkList links, 3: string password, 4: bool paused), - - // pid -1 is toplevel - PackageID addPackageChild(1: string name, 2: LinkList links, 3: string password, 4: PackageID root, 5: bool paused), - - PackageID uploadContainer(1: string filename, 2: binary data), - - void addLinks(1: PackageID pid, 2: LinkList links) throws (1: PackageDoesNotExists e), - void addLocalFile(1: PackageID pid, 2: string name, 3: string path) throws (1: PackageDoesNotExists e) - - // these are real file operations and WILL delete files on disk - void deleteFiles(1: list fids), - void deletePackages(1: list pids), // delete the whole folder recursive - - /////////////////////// - // Collector - /////////////////////// - - list getCollector(), - - void addToCollector(1: LinkList links), - PackageID addFromCollector(1: string name, 2: bool paused), - void renameCollPack(1: string name, 2: string new_name), - void deleteCollPack(1: string name), - void deleteCollLink(1: string url), - - //////////////////////////// - // File Information retrival - //////////////////////////// - - TreeCollection getAllFiles(), - TreeCollection getAllUnfinishedFiles(), - - // pid -1 for root, full=False only delivers first level in tree - TreeCollection getFileTree(1: PackageID pid, 2: bool full), - TreeCollection getUnfinishedFileTree(1: PackageID pid, 2: bool full), - - // same as above with full=False - TreeCollection getPackageContent(1: PackageID pid), - - PackageInfo getPackageInfo(1: PackageID pid) throws (1: PackageDoesNotExists e), - FileInfo getFileInfo(1: FileID fid) throws (1: FileDoesNotExists e), - TreeCollection findFiles(1: string pattern), - - /////////////////////// - // Modify Downloads - /////////////////////// - - void restartPackage(1: PackageID pid), - void restartFile(1: FileID fid), - void recheckPackage(1: PackageID pid), - void restartFailed(), - void stopDownloads(1: list fids), - void stopAllDownloads(), - - ///////////////////////// - // Modify Files/Packages - ///////////////////////// - - // moving package while downloading is not possible, so they will return bool to indicate success - void setPackagePaused(1: PackageID pid, 2: bool paused) throws (1: PackageDoesNotExists e), - bool setPackageFolder(1: PackageID pid, 2: string path) throws (1: PackageDoesNotExists e), - void setPackageData(1: PackageID pid, 2: map data) throws (1: PackageDoesNotExists e), - - // as above, this will move files on disk - bool movePackage(1: PackageID pid, 2: PackageID root) throws (1: PackageDoesNotExists e), - bool moveFiles(1: list fids, 2: PackageID pid) throws (1: PackageDoesNotExists e), - - void orderPackage(1: list pids, 2: i16 position), - void orderFiles(1: list fids, 2: PackageID pid, 3: i16 position), - - /////////////////////// - // User Interaction - /////////////////////// - - // mode = Output types binary ORed - bool isInteractionWaiting(1: i16 mode), - InteractionTask getInteractionTask(1: i16 mode), - void setInteractionResult(1: InteractionID iid, 2: JSONString result), - - // generate a download link, everybody can download the file until timeout reached - string generateDownloadLink(1: FileID fid, 2: i16 timeout), - - list getNotifications(), - - /////////////////////// - // Event Handling - /////////////////////// - - list getEvents(1: string uuid), - - /////////////////////// - // Account Methods - /////////////////////// - - list getAccounts(1: bool refresh), - list getAccountTypes(), - void updateAccount(1: PluginName plugin, 2: string account, 3: string password), - void updateAccountInfo(1: AccountInfo account), - void removeAccount(1: PluginName plugin, 2: string account), - - ///////////////////////// - // Auth+User Information - ///////////////////////// - - bool login(1: string username, 2: string password), - // returns own user data - UserData getUserData(), - - // all user, for admins only - map getAllUserData(), - - UserData addUser(1: string username, 2:string password), - - // normal user can only update their own userdata and not all attributes - void updateUserData(1: UserData data), - void removeUser(1: UserID uid), - - // works contextual, admin can change every password - bool setPassword(1: string username, 2: string old_password, 3: string new_password), - - /////////////////////// - // Addon Methods - /////////////////////// - - map> getAllInfo(), - list getInfoByPlugin(1: PluginName plugin), - - map> getAddonHandler(), - bool hasAddonHandler(1: PluginName plugin, 2: string func), - - void callAddon(1: PluginName plugin, 2: string func, 3: list arguments) - throws (1: ServiceDoesNotExists e, 2: ServiceException ex), - - // special variant of callAddon that works on the media types, acccepting integer - void callAddonHandler(1: PluginName plugin, 2: string func, 3: PackageID pid_or_fid) - throws (1: ServiceDoesNotExists e, 2: ServiceException ex), - - - //scheduler - - // TODO - -} diff --git a/module/remote/thriftbackend/thriftgen/__init__.py b/module/remote/thriftbackend/thriftgen/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote deleted file mode 100755 index 20015ba43..000000000 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ /dev/null @@ -1,690 +0,0 @@ -#!/usr/bin/env python -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# -# options string: py:slots,dynamic -# - -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 getServerVersion()' - print ' ServerStatus statusServer()' - print ' void pauseServer()' - print ' void unpauseServer()' - print ' bool togglePause()' - print ' ByteCount freeSpace()' - print ' void kill()' - print ' void restart()' - print ' getLog(i32 offset)' - print ' bool isTimeDownload()' - print ' bool isTimeReconnect()' - print ' bool toggleReconnect()' - print ' getProgressInfo()' - print ' getConfig()' - print ' getGlobalPlugins()' - print ' getUserPlugins()' - print ' ConfigHolder configurePlugin(PluginName plugin)' - print ' void saveConfig(ConfigHolder config)' - print ' void deleteConfig(PluginName plugin)' - print ' void setConfigHandler(PluginName plugin, InteractionID iid, JSONString value)' - print ' checkURLs(LinkList urls)' - print ' parseURLs(string html, string url)' - print ' OnlineCheck checkOnlineStatus(LinkList urls)' - print ' OnlineCheck checkOnlineStatusContainer(LinkList urls, string filename, string data)' - print ' OnlineCheck pollResults(ResultID rid)' - print ' generatePackages(LinkList links)' - print ' generateAndAddPackages(LinkList links, bool paused)' - print ' PackageID createPackage(string name, string folder, PackageID root, string password, string site, string comment, bool paused)' - print ' PackageID addPackage(string name, LinkList links, string password)' - print ' PackageID addPackageP(string name, LinkList links, string password, bool paused)' - print ' PackageID addPackageChild(string name, LinkList links, string password, PackageID root, bool paused)' - print ' PackageID uploadContainer(string filename, string data)' - print ' void addLinks(PackageID pid, LinkList links)' - print ' void addLocalFile(PackageID pid, string name, string path)' - print ' void deleteFiles( fids)' - print ' void deletePackages( pids)' - print ' getCollector()' - print ' void addToCollector(LinkList links)' - print ' PackageID addFromCollector(string name, bool paused)' - print ' void renameCollPack(string name, string new_name)' - print ' void deleteCollPack(string name)' - print ' void deleteCollLink(string url)' - print ' TreeCollection getAllFiles()' - print ' TreeCollection getAllUnfinishedFiles()' - print ' TreeCollection getFileTree(PackageID pid, bool full)' - print ' TreeCollection getUnfinishedFileTree(PackageID pid, bool full)' - print ' TreeCollection getPackageContent(PackageID pid)' - print ' PackageInfo getPackageInfo(PackageID pid)' - print ' FileInfo getFileInfo(FileID fid)' - print ' TreeCollection findFiles(string pattern)' - print ' void restartPackage(PackageID pid)' - print ' void restartFile(FileID fid)' - print ' void recheckPackage(PackageID pid)' - print ' void restartFailed()' - print ' void stopDownloads( fids)' - print ' void stopAllDownloads()' - print ' void setPackagePaused(PackageID pid, bool paused)' - print ' bool setPackageFolder(PackageID pid, string path)' - print ' void setPackageData(PackageID pid, data)' - print ' bool movePackage(PackageID pid, PackageID root)' - print ' bool moveFiles( fids, PackageID pid)' - print ' void orderPackage( pids, i16 position)' - print ' void orderFiles( fids, PackageID pid, i16 position)' - print ' bool isInteractionWaiting(i16 mode)' - print ' InteractionTask getInteractionTask(i16 mode)' - print ' void setInteractionResult(InteractionID iid, JSONString result)' - print ' string generateDownloadLink(FileID fid, i16 timeout)' - print ' getNotifications()' - print ' getEvents(string uuid)' - print ' getAccounts(bool refresh)' - print ' getAccountTypes()' - print ' void updateAccount(PluginName plugin, string account, string password)' - print ' void updateAccountInfo(AccountInfo account)' - print ' void removeAccount(PluginName plugin, string account)' - print ' bool login(string username, string password)' - print ' UserData getUserData()' - print ' getAllUserData()' - print ' UserData addUser(string username, string password)' - print ' void updateUserData(UserData data)' - print ' void removeUser(UserID uid)' - print ' bool setPassword(string username, string old_password, string new_password)' - print ' getAllInfo()' - print ' getInfoByPlugin(PluginName plugin)' - print ' getAddonHandler()' - print ' bool hasAddonHandler(PluginName plugin, string func)' - print ' void callAddon(PluginName plugin, string func, arguments)' - print ' void callAddonHandler(PluginName plugin, string func, PackageID pid_or_fid)' - 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] - if len(parts) > 1: - 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 == 'getServerVersion': - if len(args) != 0: - print 'getServerVersion requires 0 args' - sys.exit(1) - pp.pprint(client.getServerVersion()) - -elif cmd == 'statusServer': - if len(args) != 0: - print 'statusServer requires 0 args' - sys.exit(1) - pp.pprint(client.statusServer()) - -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 == 'freeSpace': - if len(args) != 0: - print 'freeSpace requires 0 args' - sys.exit(1) - pp.pprint(client.freeSpace()) - -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 == '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 == 'toggleReconnect': - if len(args) != 0: - print 'toggleReconnect requires 0 args' - sys.exit(1) - pp.pprint(client.toggleReconnect()) - -elif cmd == 'getProgressInfo': - if len(args) != 0: - print 'getProgressInfo requires 0 args' - sys.exit(1) - pp.pprint(client.getProgressInfo()) - -elif cmd == 'getConfig': - if len(args) != 0: - print 'getConfig requires 0 args' - sys.exit(1) - pp.pprint(client.getConfig()) - -elif cmd == 'getGlobalPlugins': - if len(args) != 0: - print 'getGlobalPlugins requires 0 args' - sys.exit(1) - pp.pprint(client.getGlobalPlugins()) - -elif cmd == 'getUserPlugins': - if len(args) != 0: - print 'getUserPlugins requires 0 args' - sys.exit(1) - pp.pprint(client.getUserPlugins()) - -elif cmd == 'configurePlugin': - if len(args) != 1: - print 'configurePlugin requires 1 args' - sys.exit(1) - pp.pprint(client.configurePlugin(eval(args[0]),)) - -elif cmd == 'saveConfig': - if len(args) != 1: - print 'saveConfig requires 1 args' - sys.exit(1) - pp.pprint(client.saveConfig(eval(args[0]),)) - -elif cmd == 'deleteConfig': - if len(args) != 1: - print 'deleteConfig requires 1 args' - sys.exit(1) - pp.pprint(client.deleteConfig(eval(args[0]),)) - -elif cmd == 'setConfigHandler': - if len(args) != 3: - print 'setConfigHandler requires 3 args' - sys.exit(1) - pp.pprint(client.setConfigHandler(eval(args[0]),eval(args[1]),eval(args[2]),)) - -elif cmd == 'checkURLs': - if len(args) != 1: - print 'checkURLs requires 1 args' - sys.exit(1) - pp.pprint(client.checkURLs(eval(args[0]),)) - -elif cmd == 'parseURLs': - if len(args) != 2: - print 'parseURLs requires 2 args' - sys.exit(1) - pp.pprint(client.parseURLs(args[0],args[1],)) - -elif cmd == 'checkOnlineStatus': - if len(args) != 1: - print 'checkOnlineStatus requires 1 args' - sys.exit(1) - pp.pprint(client.checkOnlineStatus(eval(args[0]),)) - -elif cmd == 'checkOnlineStatusContainer': - if len(args) != 3: - print 'checkOnlineStatusContainer requires 3 args' - sys.exit(1) - pp.pprint(client.checkOnlineStatusContainer(eval(args[0]),args[1],args[2],)) - -elif cmd == 'pollResults': - if len(args) != 1: - print 'pollResults requires 1 args' - sys.exit(1) - pp.pprint(client.pollResults(eval(args[0]),)) - -elif cmd == 'generatePackages': - if len(args) != 1: - print 'generatePackages requires 1 args' - sys.exit(1) - pp.pprint(client.generatePackages(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 == 'createPackage': - if len(args) != 7: - print 'createPackage requires 7 args' - sys.exit(1) - pp.pprint(client.createPackage(args[0],args[1],eval(args[2]),args[3],args[4],args[5],eval(args[6]),)) - -elif cmd == 'addPackage': - if len(args) != 3: - print 'addPackage requires 3 args' - sys.exit(1) - pp.pprint(client.addPackage(args[0],eval(args[1]),args[2],)) - -elif cmd == 'addPackageP': - if len(args) != 4: - print 'addPackageP requires 4 args' - sys.exit(1) - pp.pprint(client.addPackageP(args[0],eval(args[1]),args[2],eval(args[3]),)) - -elif cmd == 'addPackageChild': - if len(args) != 5: - print 'addPackageChild requires 5 args' - sys.exit(1) - pp.pprint(client.addPackageChild(args[0],eval(args[1]),args[2],eval(args[3]),eval(args[4]),)) - -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 == 'addLinks': - if len(args) != 2: - print 'addLinks requires 2 args' - sys.exit(1) - pp.pprint(client.addLinks(eval(args[0]),eval(args[1]),)) - -elif cmd == 'addLocalFile': - if len(args) != 3: - print 'addLocalFile requires 3 args' - sys.exit(1) - pp.pprint(client.addLocalFile(eval(args[0]),args[1],args[2],)) - -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 == 'getCollector': - if len(args) != 0: - print 'getCollector requires 0 args' - sys.exit(1) - pp.pprint(client.getCollector()) - -elif cmd == 'addToCollector': - if len(args) != 1: - print 'addToCollector requires 1 args' - sys.exit(1) - pp.pprint(client.addToCollector(eval(args[0]),)) - -elif cmd == 'addFromCollector': - if len(args) != 2: - print 'addFromCollector requires 2 args' - sys.exit(1) - pp.pprint(client.addFromCollector(args[0],eval(args[1]),)) - -elif cmd == 'renameCollPack': - if len(args) != 2: - print 'renameCollPack requires 2 args' - sys.exit(1) - pp.pprint(client.renameCollPack(args[0],args[1],)) - -elif cmd == 'deleteCollPack': - if len(args) != 1: - print 'deleteCollPack requires 1 args' - sys.exit(1) - pp.pprint(client.deleteCollPack(args[0],)) - -elif cmd == 'deleteCollLink': - if len(args) != 1: - print 'deleteCollLink requires 1 args' - sys.exit(1) - pp.pprint(client.deleteCollLink(args[0],)) - -elif cmd == 'getAllFiles': - if len(args) != 0: - print 'getAllFiles requires 0 args' - sys.exit(1) - pp.pprint(client.getAllFiles()) - -elif cmd == 'getAllUnfinishedFiles': - if len(args) != 0: - print 'getAllUnfinishedFiles requires 0 args' - sys.exit(1) - pp.pprint(client.getAllUnfinishedFiles()) - -elif cmd == 'getFileTree': - if len(args) != 2: - print 'getFileTree requires 2 args' - sys.exit(1) - pp.pprint(client.getFileTree(eval(args[0]),eval(args[1]),)) - -elif cmd == 'getUnfinishedFileTree': - if len(args) != 2: - print 'getUnfinishedFileTree requires 2 args' - sys.exit(1) - pp.pprint(client.getUnfinishedFileTree(eval(args[0]),eval(args[1]),)) - -elif cmd == 'getPackageContent': - if len(args) != 1: - print 'getPackageContent requires 1 args' - sys.exit(1) - pp.pprint(client.getPackageContent(eval(args[0]),)) - -elif cmd == 'getPackageInfo': - if len(args) != 1: - print 'getPackageInfo requires 1 args' - sys.exit(1) - pp.pprint(client.getPackageInfo(eval(args[0]),)) - -elif cmd == 'getFileInfo': - if len(args) != 1: - print 'getFileInfo requires 1 args' - sys.exit(1) - pp.pprint(client.getFileInfo(eval(args[0]),)) - -elif cmd == 'findFiles': - if len(args) != 1: - print 'findFiles requires 1 args' - sys.exit(1) - pp.pprint(client.findFiles(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 == 'restartFailed': - if len(args) != 0: - print 'restartFailed requires 0 args' - sys.exit(1) - pp.pprint(client.restartFailed()) - -elif cmd == 'stopDownloads': - if len(args) != 1: - print 'stopDownloads requires 1 args' - sys.exit(1) - pp.pprint(client.stopDownloads(eval(args[0]),)) - -elif cmd == 'stopAllDownloads': - if len(args) != 0: - print 'stopAllDownloads requires 0 args' - sys.exit(1) - pp.pprint(client.stopAllDownloads()) - -elif cmd == 'setPackagePaused': - if len(args) != 2: - print 'setPackagePaused requires 2 args' - sys.exit(1) - pp.pprint(client.setPackagePaused(eval(args[0]),eval(args[1]),)) - -elif cmd == 'setPackageFolder': - if len(args) != 2: - print 'setPackageFolder requires 2 args' - sys.exit(1) - pp.pprint(client.setPackageFolder(eval(args[0]),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 == '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 == 'moveFiles': - if len(args) != 2: - print 'moveFiles requires 2 args' - sys.exit(1) - pp.pprint(client.moveFiles(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 == 'orderFiles': - if len(args) != 3: - print 'orderFiles requires 3 args' - sys.exit(1) - pp.pprint(client.orderFiles(eval(args[0]),eval(args[1]),eval(args[2]),)) - -elif cmd == 'isInteractionWaiting': - if len(args) != 1: - print 'isInteractionWaiting requires 1 args' - sys.exit(1) - pp.pprint(client.isInteractionWaiting(eval(args[0]),)) - -elif cmd == 'getInteractionTask': - if len(args) != 1: - print 'getInteractionTask requires 1 args' - sys.exit(1) - pp.pprint(client.getInteractionTask(eval(args[0]),)) - -elif cmd == 'setInteractionResult': - if len(args) != 2: - print 'setInteractionResult requires 2 args' - sys.exit(1) - pp.pprint(client.setInteractionResult(eval(args[0]),eval(args[1]),)) - -elif cmd == 'generateDownloadLink': - if len(args) != 2: - print 'generateDownloadLink requires 2 args' - sys.exit(1) - pp.pprint(client.generateDownloadLink(eval(args[0]),eval(args[1]),)) - -elif cmd == 'getNotifications': - if len(args) != 0: - print 'getNotifications requires 0 args' - sys.exit(1) - pp.pprint(client.getNotifications()) - -elif cmd == 'getEvents': - if len(args) != 1: - print 'getEvents requires 1 args' - sys.exit(1) - 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 'getAccountTypes requires 0 args' - sys.exit(1) - pp.pprint(client.getAccountTypes()) - -elif cmd == 'updateAccount': - if len(args) != 3: - print 'updateAccount requires 3 args' - sys.exit(1) - pp.pprint(client.updateAccount(eval(args[0]),args[1],args[2],)) - -elif cmd == 'updateAccountInfo': - if len(args) != 1: - print 'updateAccountInfo requires 1 args' - sys.exit(1) - pp.pprint(client.updateAccountInfo(eval(args[0]),)) - -elif cmd == 'removeAccount': - if len(args) != 2: - print 'removeAccount requires 2 args' - sys.exit(1) - pp.pprint(client.removeAccount(eval(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()) - -elif cmd == 'getAllUserData': - if len(args) != 0: - print 'getAllUserData requires 0 args' - sys.exit(1) - pp.pprint(client.getAllUserData()) - -elif cmd == 'addUser': - if len(args) != 2: - print 'addUser requires 2 args' - sys.exit(1) - pp.pprint(client.addUser(args[0],args[1],)) - -elif cmd == 'updateUserData': - if len(args) != 1: - print 'updateUserData requires 1 args' - sys.exit(1) - pp.pprint(client.updateUserData(eval(args[0]),)) - -elif cmd == 'removeUser': - if len(args) != 1: - print 'removeUser requires 1 args' - sys.exit(1) - pp.pprint(client.removeUser(eval(args[0]),)) - -elif cmd == 'setPassword': - if len(args) != 3: - print 'setPassword requires 3 args' - sys.exit(1) - pp.pprint(client.setPassword(args[0],args[1],args[2],)) - -elif cmd == 'getAllInfo': - if len(args) != 0: - print 'getAllInfo requires 0 args' - sys.exit(1) - pp.pprint(client.getAllInfo()) - -elif cmd == 'getInfoByPlugin': - if len(args) != 1: - print 'getInfoByPlugin requires 1 args' - sys.exit(1) - pp.pprint(client.getInfoByPlugin(eval(args[0]),)) - -elif cmd == 'getAddonHandler': - if len(args) != 0: - print 'getAddonHandler requires 0 args' - sys.exit(1) - pp.pprint(client.getAddonHandler()) - -elif cmd == 'hasAddonHandler': - if len(args) != 2: - print 'hasAddonHandler requires 2 args' - sys.exit(1) - pp.pprint(client.hasAddonHandler(eval(args[0]),args[1],)) - -elif cmd == 'callAddon': - if len(args) != 3: - print 'callAddon requires 3 args' - sys.exit(1) - pp.pprint(client.callAddon(eval(args[0]),args[1],eval(args[2]),)) - -elif cmd == 'callAddonHandler': - if len(args) != 3: - print 'callAddonHandler requires 3 args' - sys.exit(1) - pp.pprint(client.callAddonHandler(eval(args[0]),args[1],eval(args[2]),)) - -else: - print 'Unrecognized method %s' % cmd - sys.exit(1) - -transport.close() diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py deleted file mode 100644 index 157d5b87b..000000000 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ /dev/null @@ -1,7179 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# -# options string: py:slots,dynamic -# - -from thrift.Thrift import TType, TMessageType, TException -from ttypes import * -from thrift.Thrift import TProcessor, TApplicationException -from thrift.protocol.TBase import TBase, TExceptionBase - - -class Iface(object): - def getServerVersion(self, ): - pass - - def statusServer(self, ): - pass - - def pauseServer(self, ): - pass - - def unpauseServer(self, ): - pass - - def togglePause(self, ): - pass - - def freeSpace(self, ): - pass - - def kill(self, ): - pass - - def restart(self, ): - pass - - def getLog(self, offset): - """ - Parameters: - - offset - """ - pass - - def isTimeDownload(self, ): - pass - - def isTimeReconnect(self, ): - pass - - def toggleReconnect(self, ): - pass - - def getProgressInfo(self, ): - pass - - def getConfig(self, ): - pass - - def getGlobalPlugins(self, ): - pass - - def getUserPlugins(self, ): - pass - - def configurePlugin(self, plugin): - """ - Parameters: - - plugin - """ - pass - - def saveConfig(self, config): - """ - Parameters: - - config - """ - pass - - def deleteConfig(self, plugin): - """ - Parameters: - - plugin - """ - pass - - def setConfigHandler(self, plugin, iid, value): - """ - Parameters: - - plugin - - iid - - value - """ - pass - - def checkURLs(self, urls): - """ - Parameters: - - urls - """ - pass - - def parseURLs(self, html, url): - """ - Parameters: - - html - - url - """ - pass - - def checkOnlineStatus(self, urls): - """ - Parameters: - - urls - """ - pass - - def checkOnlineStatusContainer(self, urls, filename, data): - """ - Parameters: - - urls - - filename - - data - """ - pass - - def pollResults(self, rid): - """ - Parameters: - - rid - """ - pass - - def generatePackages(self, links): - """ - Parameters: - - links - """ - pass - - def generateAndAddPackages(self, links, paused): - """ - Parameters: - - links - - paused - """ - pass - - def createPackage(self, name, folder, root, password, site, comment, paused): - """ - Parameters: - - name - - folder - - root - - password - - site - - comment - - paused - """ - pass - - def addPackage(self, name, links, password): - """ - Parameters: - - name - - links - - password - """ - pass - - def addPackageP(self, name, links, password, paused): - """ - Parameters: - - name - - links - - password - - paused - """ - pass - - def addPackageChild(self, name, links, password, root, paused): - """ - Parameters: - - name - - links - - password - - root - - paused - """ - pass - - def uploadContainer(self, filename, data): - """ - Parameters: - - filename - - data - """ - pass - - def addLinks(self, pid, links): - """ - Parameters: - - pid - - links - """ - pass - - def addLocalFile(self, pid, name, path): - """ - Parameters: - - pid - - name - - path - """ - pass - - def deleteFiles(self, fids): - """ - Parameters: - - fids - """ - pass - - def deletePackages(self, pids): - """ - Parameters: - - pids - """ - pass - - def getCollector(self, ): - pass - - def addToCollector(self, links): - """ - Parameters: - - links - """ - pass - - def addFromCollector(self, name, paused): - """ - Parameters: - - name - - paused - """ - pass - - def renameCollPack(self, name, new_name): - """ - Parameters: - - name - - new_name - """ - pass - - def deleteCollPack(self, name): - """ - Parameters: - - name - """ - pass - - def deleteCollLink(self, url): - """ - Parameters: - - url - """ - pass - - def getAllFiles(self, ): - pass - - def getAllUnfinishedFiles(self, ): - pass - - def getFileTree(self, pid, full): - """ - Parameters: - - pid - - full - """ - pass - - def getUnfinishedFileTree(self, pid, full): - """ - Parameters: - - pid - - full - """ - pass - - def getPackageContent(self, pid): - """ - Parameters: - - pid - """ - pass - - def getPackageInfo(self, pid): - """ - Parameters: - - pid - """ - pass - - def getFileInfo(self, fid): - """ - Parameters: - - fid - """ - pass - - def findFiles(self, pattern): - """ - Parameters: - - pattern - """ - pass - - def restartPackage(self, pid): - """ - Parameters: - - pid - """ - pass - - def restartFile(self, fid): - """ - Parameters: - - fid - """ - pass - - def recheckPackage(self, pid): - """ - Parameters: - - pid - """ - pass - - def restartFailed(self, ): - pass - - def stopDownloads(self, fids): - """ - Parameters: - - fids - """ - pass - - def stopAllDownloads(self, ): - pass - - def setPackagePaused(self, pid, paused): - """ - Parameters: - - pid - - paused - """ - pass - - def setPackageFolder(self, pid, path): - """ - Parameters: - - pid - - path - """ - pass - - def setPackageData(self, pid, data): - """ - Parameters: - - pid - - data - """ - pass - - def movePackage(self, pid, root): - """ - Parameters: - - pid - - root - """ - pass - - def moveFiles(self, fids, pid): - """ - Parameters: - - fids - - pid - """ - pass - - def orderPackage(self, pids, position): - """ - Parameters: - - pids - - position - """ - pass - - def orderFiles(self, fids, pid, position): - """ - Parameters: - - fids - - pid - - position - """ - pass - - def isInteractionWaiting(self, mode): - """ - Parameters: - - mode - """ - pass - - def getInteractionTask(self, mode): - """ - Parameters: - - mode - """ - pass - - def setInteractionResult(self, iid, result): - """ - Parameters: - - iid - - result - """ - pass - - def generateDownloadLink(self, fid, timeout): - """ - Parameters: - - fid - - timeout - """ - pass - - def getNotifications(self, ): - pass - - def getEvents(self, uuid): - """ - Parameters: - - uuid - """ - pass - - def getAccounts(self, refresh): - """ - Parameters: - - refresh - """ - pass - - def getAccountTypes(self, ): - pass - - def updateAccount(self, plugin, account, password): - """ - Parameters: - - plugin - - account - - password - """ - pass - - def updateAccountInfo(self, account): - """ - Parameters: - - account - """ - pass - - def removeAccount(self, plugin, account): - """ - Parameters: - - plugin - - account - """ - pass - - def login(self, username, password): - """ - Parameters: - - username - - password - """ - pass - - def getUserData(self, ): - pass - - def getAllUserData(self, ): - pass - - def addUser(self, username, password): - """ - Parameters: - - username - - password - """ - pass - - def updateUserData(self, data): - """ - Parameters: - - data - """ - pass - - def removeUser(self, uid): - """ - Parameters: - - uid - """ - pass - - def setPassword(self, username, old_password, new_password): - """ - Parameters: - - username - - old_password - - new_password - """ - pass - - def getAllInfo(self, ): - pass - - def getInfoByPlugin(self, plugin): - """ - Parameters: - - plugin - """ - pass - - def getAddonHandler(self, ): - pass - - def hasAddonHandler(self, plugin, func): - """ - Parameters: - - plugin - - func - """ - pass - - def callAddon(self, plugin, func, arguments): - """ - Parameters: - - plugin - - func - - arguments - """ - pass - - def callAddonHandler(self, plugin, func, pid_or_fid): - """ - Parameters: - - plugin - - func - - pid_or_fid - """ - pass - - -class Client(Iface): - def __init__(self, iprot, oprot=None): - self._iprot = self._oprot = iprot - if oprot is not None: - self._oprot = oprot - self._seqid = 0 - - def getServerVersion(self, ): - self.send_getServerVersion() - return self.recv_getServerVersion() - - def send_getServerVersion(self, ): - self._oprot.writeMessageBegin('getServerVersion', TMessageType.CALL, self._seqid) - args = getServerVersion_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getServerVersion(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getServerVersion_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getServerVersion failed: unknown result"); - - def statusServer(self, ): - self.send_statusServer() - return self.recv_statusServer() - - def send_statusServer(self, ): - self._oprot.writeMessageBegin('statusServer', TMessageType.CALL, self._seqid) - args = statusServer_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_statusServer(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = statusServer_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "statusServer failed: unknown result"); - - def pauseServer(self, ): - self.send_pauseServer() - self.recv_pauseServer() - - def send_pauseServer(self, ): - self._oprot.writeMessageBegin('pauseServer', TMessageType.CALL, self._seqid) - args = pauseServer_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_pauseServer(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = pauseServer_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def unpauseServer(self, ): - self.send_unpauseServer() - self.recv_unpauseServer() - - def send_unpauseServer(self, ): - self._oprot.writeMessageBegin('unpauseServer', TMessageType.CALL, self._seqid) - args = unpauseServer_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_unpauseServer(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = unpauseServer_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def togglePause(self, ): - self.send_togglePause() - return self.recv_togglePause() - - def send_togglePause(self, ): - self._oprot.writeMessageBegin('togglePause', TMessageType.CALL, self._seqid) - args = togglePause_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_togglePause(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = togglePause_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "togglePause failed: unknown result"); - - def freeSpace(self, ): - self.send_freeSpace() - return self.recv_freeSpace() - - def send_freeSpace(self, ): - self._oprot.writeMessageBegin('freeSpace', TMessageType.CALL, self._seqid) - args = freeSpace_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_freeSpace(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = freeSpace_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "freeSpace failed: unknown result"); - - def kill(self, ): - self.send_kill() - self.recv_kill() - - def send_kill(self, ): - self._oprot.writeMessageBegin('kill', TMessageType.CALL, self._seqid) - args = kill_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_kill(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = kill_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def restart(self, ): - self.send_restart() - self.recv_restart() - - def send_restart(self, ): - self._oprot.writeMessageBegin('restart', TMessageType.CALL, self._seqid) - args = restart_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_restart(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = restart_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def getLog(self, offset): - """ - Parameters: - - offset - """ - self.send_getLog(offset) - return self.recv_getLog() - - def send_getLog(self, offset): - self._oprot.writeMessageBegin('getLog', TMessageType.CALL, self._seqid) - args = getLog_args() - args.offset = offset - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getLog(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getLog_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getLog failed: unknown result"); - - def isTimeDownload(self, ): - self.send_isTimeDownload() - return self.recv_isTimeDownload() - - def send_isTimeDownload(self, ): - self._oprot.writeMessageBegin('isTimeDownload', TMessageType.CALL, self._seqid) - args = isTimeDownload_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_isTimeDownload(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = isTimeDownload_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "isTimeDownload failed: unknown result"); - - def isTimeReconnect(self, ): - self.send_isTimeReconnect() - return self.recv_isTimeReconnect() - - def send_isTimeReconnect(self, ): - self._oprot.writeMessageBegin('isTimeReconnect', TMessageType.CALL, self._seqid) - args = isTimeReconnect_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_isTimeReconnect(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = isTimeReconnect_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - 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 is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "toggleReconnect failed: unknown result"); - - def getProgressInfo(self, ): - self.send_getProgressInfo() - return self.recv_getProgressInfo() - - def send_getProgressInfo(self, ): - self._oprot.writeMessageBegin('getProgressInfo', TMessageType.CALL, self._seqid) - args = getProgressInfo_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getProgressInfo(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getProgressInfo_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getProgressInfo failed: unknown result"); - - def getConfig(self, ): - self.send_getConfig() - return self.recv_getConfig() - - def send_getConfig(self, ): - self._oprot.writeMessageBegin('getConfig', TMessageType.CALL, self._seqid) - args = getConfig_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getConfig(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getConfig_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getConfig failed: unknown result"); - - def getGlobalPlugins(self, ): - self.send_getGlobalPlugins() - return self.recv_getGlobalPlugins() - - def send_getGlobalPlugins(self, ): - self._oprot.writeMessageBegin('getGlobalPlugins', TMessageType.CALL, self._seqid) - args = getGlobalPlugins_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getGlobalPlugins(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getGlobalPlugins_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getGlobalPlugins failed: unknown result"); - - def getUserPlugins(self, ): - self.send_getUserPlugins() - return self.recv_getUserPlugins() - - def send_getUserPlugins(self, ): - self._oprot.writeMessageBegin('getUserPlugins', TMessageType.CALL, self._seqid) - args = getUserPlugins_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getUserPlugins(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getUserPlugins_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getUserPlugins failed: unknown result"); - - def configurePlugin(self, plugin): - """ - Parameters: - - plugin - """ - self.send_configurePlugin(plugin) - return self.recv_configurePlugin() - - def send_configurePlugin(self, plugin): - self._oprot.writeMessageBegin('configurePlugin', TMessageType.CALL, self._seqid) - args = configurePlugin_args() - args.plugin = plugin - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_configurePlugin(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = configurePlugin_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "configurePlugin failed: unknown result"); - - def saveConfig(self, config): - """ - Parameters: - - config - """ - self.send_saveConfig(config) - self.recv_saveConfig() - - def send_saveConfig(self, config): - self._oprot.writeMessageBegin('saveConfig', TMessageType.CALL, self._seqid) - args = saveConfig_args() - args.config = config - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_saveConfig(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = saveConfig_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def deleteConfig(self, plugin): - """ - Parameters: - - plugin - """ - self.send_deleteConfig(plugin) - self.recv_deleteConfig() - - def send_deleteConfig(self, plugin): - self._oprot.writeMessageBegin('deleteConfig', TMessageType.CALL, self._seqid) - args = deleteConfig_args() - args.plugin = plugin - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_deleteConfig(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = deleteConfig_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def setConfigHandler(self, plugin, iid, value): - """ - Parameters: - - plugin - - iid - - value - """ - self.send_setConfigHandler(plugin, iid, value) - self.recv_setConfigHandler() - - def send_setConfigHandler(self, plugin, iid, value): - self._oprot.writeMessageBegin('setConfigHandler', TMessageType.CALL, self._seqid) - args = setConfigHandler_args() - args.plugin = plugin - args.iid = iid - args.value = value - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setConfigHandler(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setConfigHandler_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def checkURLs(self, urls): - """ - Parameters: - - urls - """ - self.send_checkURLs(urls) - return self.recv_checkURLs() - - def send_checkURLs(self, urls): - self._oprot.writeMessageBegin('checkURLs', TMessageType.CALL, self._seqid) - args = checkURLs_args() - args.urls = urls - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_checkURLs(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = checkURLs_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "checkURLs failed: unknown result"); - - def parseURLs(self, html, url): - """ - Parameters: - - html - - url - """ - self.send_parseURLs(html, url) - return self.recv_parseURLs() - - def send_parseURLs(self, html, url): - self._oprot.writeMessageBegin('parseURLs', TMessageType.CALL, self._seqid) - args = parseURLs_args() - args.html = html - args.url = url - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_parseURLs(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = parseURLs_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "parseURLs failed: unknown result"); - - def checkOnlineStatus(self, urls): - """ - Parameters: - - urls - """ - self.send_checkOnlineStatus(urls) - return self.recv_checkOnlineStatus() - - def send_checkOnlineStatus(self, urls): - self._oprot.writeMessageBegin('checkOnlineStatus', TMessageType.CALL, self._seqid) - args = checkOnlineStatus_args() - args.urls = urls - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_checkOnlineStatus(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = checkOnlineStatus_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "checkOnlineStatus failed: unknown result"); - - def checkOnlineStatusContainer(self, urls, filename, data): - """ - Parameters: - - urls - - filename - - data - """ - self.send_checkOnlineStatusContainer(urls, filename, data) - return self.recv_checkOnlineStatusContainer() - - def send_checkOnlineStatusContainer(self, urls, filename, data): - self._oprot.writeMessageBegin('checkOnlineStatusContainer', TMessageType.CALL, self._seqid) - args = checkOnlineStatusContainer_args() - args.urls = urls - args.filename = filename - args.data = data - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_checkOnlineStatusContainer(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = checkOnlineStatusContainer_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "checkOnlineStatusContainer failed: unknown result"); - - def pollResults(self, rid): - """ - Parameters: - - rid - """ - self.send_pollResults(rid) - return self.recv_pollResults() - - def send_pollResults(self, rid): - self._oprot.writeMessageBegin('pollResults', TMessageType.CALL, self._seqid) - args = pollResults_args() - args.rid = rid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_pollResults(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = pollResults_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "pollResults 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 generateAndAddPackages(self, links, paused): - """ - Parameters: - - links - - paused - """ - self.send_generateAndAddPackages(links, paused) - return self.recv_generateAndAddPackages() - - def send_generateAndAddPackages(self, links, paused): - self._oprot.writeMessageBegin('generateAndAddPackages', TMessageType.CALL, self._seqid) - args = generateAndAddPackages_args() - args.links = links - args.paused = paused - 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 createPackage(self, name, folder, root, password, site, comment, paused): - """ - Parameters: - - name - - folder - - root - - password - - site - - comment - - paused - """ - self.send_createPackage(name, folder, root, password, site, comment, paused) - return self.recv_createPackage() - - def send_createPackage(self, name, folder, root, password, site, comment, paused): - self._oprot.writeMessageBegin('createPackage', TMessageType.CALL, self._seqid) - args = createPackage_args() - args.name = name - args.folder = folder - args.root = root - args.password = password - args.site = site - args.comment = comment - args.paused = paused - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_createPackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = createPackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "createPackage failed: unknown result"); - - def addPackage(self, name, links, password): - """ - Parameters: - - name - - links - - password - """ - self.send_addPackage(name, links, password) - return self.recv_addPackage() - - def send_addPackage(self, name, links, password): - self._oprot.writeMessageBegin('addPackage', TMessageType.CALL, self._seqid) - args = addPackage_args() - args.name = name - args.links = links - args.password = password - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addPackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addPackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addPackage failed: unknown result"); - - def addPackageP(self, name, links, password, paused): - """ - Parameters: - - name - - links - - password - - paused - """ - self.send_addPackageP(name, links, password, paused) - return self.recv_addPackageP() - - def send_addPackageP(self, name, links, password, paused): - self._oprot.writeMessageBegin('addPackageP', TMessageType.CALL, self._seqid) - args = addPackageP_args() - args.name = name - args.links = links - args.password = password - args.paused = paused - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addPackageP(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addPackageP_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addPackageP failed: unknown result"); - - def addPackageChild(self, name, links, password, root, paused): - """ - Parameters: - - name - - links - - password - - root - - paused - """ - self.send_addPackageChild(name, links, password, root, paused) - return self.recv_addPackageChild() - - def send_addPackageChild(self, name, links, password, root, paused): - self._oprot.writeMessageBegin('addPackageChild', TMessageType.CALL, self._seqid) - args = addPackageChild_args() - args.name = name - args.links = links - args.password = password - args.root = root - args.paused = paused - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addPackageChild(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addPackageChild_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addPackageChild failed: unknown result"); - - def uploadContainer(self, filename, data): - """ - Parameters: - - filename - - data - """ - self.send_uploadContainer(filename, data) - return self.recv_uploadContainer() - - def send_uploadContainer(self, filename, data): - self._oprot.writeMessageBegin('uploadContainer', TMessageType.CALL, self._seqid) - args = uploadContainer_args() - args.filename = filename - args.data = data - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_uploadContainer(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = uploadContainer_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "uploadContainer failed: unknown result"); - - def addLinks(self, pid, links): - """ - Parameters: - - pid - - links - """ - self.send_addLinks(pid, links) - self.recv_addLinks() - - def send_addLinks(self, pid, links): - self._oprot.writeMessageBegin('addLinks', TMessageType.CALL, self._seqid) - args = addLinks_args() - args.pid = pid - args.links = links - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addLinks(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addLinks_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - return - - def addLocalFile(self, pid, name, path): - """ - Parameters: - - pid - - name - - path - """ - self.send_addLocalFile(pid, name, path) - self.recv_addLocalFile() - - def send_addLocalFile(self, pid, name, path): - self._oprot.writeMessageBegin('addLocalFile', TMessageType.CALL, self._seqid) - args = addLocalFile_args() - args.pid = pid - args.name = name - args.path = path - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addLocalFile(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addLocalFile_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - return - - def deleteFiles(self, fids): - """ - Parameters: - - fids - """ - self.send_deleteFiles(fids) - self.recv_deleteFiles() - - def send_deleteFiles(self, fids): - self._oprot.writeMessageBegin('deleteFiles', TMessageType.CALL, self._seqid) - args = deleteFiles_args() - args.fids = fids - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_deleteFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = deleteFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def deletePackages(self, pids): - """ - Parameters: - - pids - """ - self.send_deletePackages(pids) - self.recv_deletePackages() - - def send_deletePackages(self, pids): - self._oprot.writeMessageBegin('deletePackages', TMessageType.CALL, self._seqid) - args = deletePackages_args() - args.pids = pids - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_deletePackages(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = deletePackages_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def getCollector(self, ): - self.send_getCollector() - return self.recv_getCollector() - - def send_getCollector(self, ): - self._oprot.writeMessageBegin('getCollector', TMessageType.CALL, self._seqid) - args = getCollector_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getCollector(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getCollector_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getCollector failed: unknown result"); - - def addToCollector(self, links): - """ - Parameters: - - links - """ - self.send_addToCollector(links) - self.recv_addToCollector() - - def send_addToCollector(self, links): - self._oprot.writeMessageBegin('addToCollector', TMessageType.CALL, self._seqid) - args = addToCollector_args() - args.links = links - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addToCollector(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addToCollector_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def addFromCollector(self, name, paused): - """ - Parameters: - - name - - paused - """ - self.send_addFromCollector(name, paused) - return self.recv_addFromCollector() - - def send_addFromCollector(self, name, paused): - self._oprot.writeMessageBegin('addFromCollector', TMessageType.CALL, self._seqid) - args = addFromCollector_args() - args.name = name - args.paused = paused - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addFromCollector(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addFromCollector_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addFromCollector failed: unknown result"); - - def renameCollPack(self, name, new_name): - """ - Parameters: - - name - - new_name - """ - self.send_renameCollPack(name, new_name) - self.recv_renameCollPack() - - def send_renameCollPack(self, name, new_name): - self._oprot.writeMessageBegin('renameCollPack', TMessageType.CALL, self._seqid) - args = renameCollPack_args() - args.name = name - args.new_name = new_name - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_renameCollPack(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = renameCollPack_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def deleteCollPack(self, name): - """ - Parameters: - - name - """ - self.send_deleteCollPack(name) - self.recv_deleteCollPack() - - def send_deleteCollPack(self, name): - self._oprot.writeMessageBegin('deleteCollPack', TMessageType.CALL, self._seqid) - args = deleteCollPack_args() - args.name = name - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_deleteCollPack(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = deleteCollPack_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def deleteCollLink(self, url): - """ - Parameters: - - url - """ - self.send_deleteCollLink(url) - self.recv_deleteCollLink() - - def send_deleteCollLink(self, url): - self._oprot.writeMessageBegin('deleteCollLink', TMessageType.CALL, self._seqid) - args = deleteCollLink_args() - args.url = url - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_deleteCollLink(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = deleteCollLink_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def getAllFiles(self, ): - self.send_getAllFiles() - return self.recv_getAllFiles() - - def send_getAllFiles(self, ): - self._oprot.writeMessageBegin('getAllFiles', TMessageType.CALL, self._seqid) - args = getAllFiles_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getAllFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAllFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllFiles failed: unknown result"); - - def getAllUnfinishedFiles(self, ): - self.send_getAllUnfinishedFiles() - return self.recv_getAllUnfinishedFiles() - - def send_getAllUnfinishedFiles(self, ): - self._oprot.writeMessageBegin('getAllUnfinishedFiles', TMessageType.CALL, self._seqid) - args = getAllUnfinishedFiles_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getAllUnfinishedFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAllUnfinishedFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllUnfinishedFiles failed: unknown result"); - - def getFileTree(self, pid, full): - """ - Parameters: - - pid - - full - """ - self.send_getFileTree(pid, full) - return self.recv_getFileTree() - - def send_getFileTree(self, pid, full): - self._oprot.writeMessageBegin('getFileTree', TMessageType.CALL, self._seqid) - args = getFileTree_args() - args.pid = pid - args.full = full - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getFileTree(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getFileTree_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getFileTree failed: unknown result"); - - def getUnfinishedFileTree(self, pid, full): - """ - Parameters: - - pid - - full - """ - self.send_getUnfinishedFileTree(pid, full) - return self.recv_getUnfinishedFileTree() - - def send_getUnfinishedFileTree(self, pid, full): - self._oprot.writeMessageBegin('getUnfinishedFileTree', TMessageType.CALL, self._seqid) - args = getUnfinishedFileTree_args() - args.pid = pid - args.full = full - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getUnfinishedFileTree(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getUnfinishedFileTree_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getUnfinishedFileTree failed: unknown result"); - - def getPackageContent(self, pid): - """ - Parameters: - - pid - """ - self.send_getPackageContent(pid) - return self.recv_getPackageContent() - - def send_getPackageContent(self, pid): - self._oprot.writeMessageBegin('getPackageContent', TMessageType.CALL, self._seqid) - args = getPackageContent_args() - args.pid = pid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getPackageContent(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getPackageContent_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getPackageContent failed: unknown result"); - - def getPackageInfo(self, pid): - """ - Parameters: - - pid - """ - self.send_getPackageInfo(pid) - return self.recv_getPackageInfo() - - def send_getPackageInfo(self, pid): - self._oprot.writeMessageBegin('getPackageInfo', TMessageType.CALL, self._seqid) - args = getPackageInfo_args() - args.pid = pid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getPackageInfo(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getPackageInfo_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - raise TApplicationException(TApplicationException.MISSING_RESULT, "getPackageInfo failed: unknown result"); - - def getFileInfo(self, fid): - """ - Parameters: - - fid - """ - self.send_getFileInfo(fid) - return self.recv_getFileInfo() - - def send_getFileInfo(self, fid): - self._oprot.writeMessageBegin('getFileInfo', TMessageType.CALL, self._seqid) - args = getFileInfo_args() - args.fid = fid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getFileInfo(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getFileInfo_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - raise TApplicationException(TApplicationException.MISSING_RESULT, "getFileInfo failed: unknown result"); - - def findFiles(self, pattern): - """ - Parameters: - - pattern - """ - self.send_findFiles(pattern) - return self.recv_findFiles() - - def send_findFiles(self, pattern): - self._oprot.writeMessageBegin('findFiles', TMessageType.CALL, self._seqid) - args = findFiles_args() - args.pattern = pattern - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_findFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = findFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "findFiles failed: unknown result"); - - def restartPackage(self, pid): - """ - Parameters: - - pid - """ - self.send_restartPackage(pid) - self.recv_restartPackage() - - def send_restartPackage(self, pid): - self._oprot.writeMessageBegin('restartPackage', TMessageType.CALL, self._seqid) - args = restartPackage_args() - args.pid = pid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_restartPackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = restartPackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def restartFile(self, fid): - """ - Parameters: - - fid - """ - self.send_restartFile(fid) - self.recv_restartFile() - - def send_restartFile(self, fid): - self._oprot.writeMessageBegin('restartFile', TMessageType.CALL, self._seqid) - args = restartFile_args() - args.fid = fid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_restartFile(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = restartFile_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def recheckPackage(self, pid): - """ - Parameters: - - pid - """ - self.send_recheckPackage(pid) - self.recv_recheckPackage() - - def send_recheckPackage(self, pid): - self._oprot.writeMessageBegin('recheckPackage', TMessageType.CALL, self._seqid) - args = recheckPackage_args() - args.pid = pid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_recheckPackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = recheckPackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def restartFailed(self, ): - self.send_restartFailed() - self.recv_restartFailed() - - def send_restartFailed(self, ): - self._oprot.writeMessageBegin('restartFailed', TMessageType.CALL, self._seqid) - args = restartFailed_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_restartFailed(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = restartFailed_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def stopDownloads(self, fids): - """ - Parameters: - - fids - """ - self.send_stopDownloads(fids) - self.recv_stopDownloads() - - def send_stopDownloads(self, fids): - self._oprot.writeMessageBegin('stopDownloads', TMessageType.CALL, self._seqid) - args = stopDownloads_args() - args.fids = fids - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_stopDownloads(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = stopDownloads_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def stopAllDownloads(self, ): - self.send_stopAllDownloads() - self.recv_stopAllDownloads() - - def send_stopAllDownloads(self, ): - self._oprot.writeMessageBegin('stopAllDownloads', TMessageType.CALL, self._seqid) - args = stopAllDownloads_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_stopAllDownloads(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = stopAllDownloads_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def setPackagePaused(self, pid, paused): - """ - Parameters: - - pid - - paused - """ - self.send_setPackagePaused(pid, paused) - self.recv_setPackagePaused() - - def send_setPackagePaused(self, pid, paused): - self._oprot.writeMessageBegin('setPackagePaused', TMessageType.CALL, self._seqid) - args = setPackagePaused_args() - args.pid = pid - args.paused = paused - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setPackagePaused(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setPackagePaused_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - return - - def setPackageFolder(self, pid, path): - """ - Parameters: - - pid - - path - """ - self.send_setPackageFolder(pid, path) - return self.recv_setPackageFolder() - - def send_setPackageFolder(self, pid, path): - self._oprot.writeMessageBegin('setPackageFolder', TMessageType.CALL, self._seqid) - args = setPackageFolder_args() - args.pid = pid - args.path = path - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setPackageFolder(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setPackageFolder_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - raise TApplicationException(TApplicationException.MISSING_RESULT, "setPackageFolder failed: unknown result"); - - def setPackageData(self, pid, data): - """ - Parameters: - - pid - - data - """ - self.send_setPackageData(pid, data) - self.recv_setPackageData() - - def send_setPackageData(self, pid, data): - self._oprot.writeMessageBegin('setPackageData', TMessageType.CALL, self._seqid) - args = setPackageData_args() - args.pid = pid - args.data = data - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setPackageData(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setPackageData_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - return - - def movePackage(self, pid, root): - """ - Parameters: - - pid - - root - """ - self.send_movePackage(pid, root) - return self.recv_movePackage() - - def send_movePackage(self, pid, root): - self._oprot.writeMessageBegin('movePackage', TMessageType.CALL, self._seqid) - args = movePackage_args() - args.pid = pid - args.root = root - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_movePackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = movePackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - raise TApplicationException(TApplicationException.MISSING_RESULT, "movePackage failed: unknown result"); - - def moveFiles(self, fids, pid): - """ - Parameters: - - fids - - pid - """ - self.send_moveFiles(fids, pid) - return self.recv_moveFiles() - - def send_moveFiles(self, fids, pid): - self._oprot.writeMessageBegin('moveFiles', TMessageType.CALL, self._seqid) - args = moveFiles_args() - args.fids = fids - args.pid = pid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_moveFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = moveFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - raise TApplicationException(TApplicationException.MISSING_RESULT, "moveFiles failed: unknown result"); - - def orderPackage(self, pids, position): - """ - Parameters: - - pids - - position - """ - self.send_orderPackage(pids, position) - self.recv_orderPackage() - - def send_orderPackage(self, pids, position): - self._oprot.writeMessageBegin('orderPackage', TMessageType.CALL, self._seqid) - args = orderPackage_args() - args.pids = pids - args.position = position - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_orderPackage(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = orderPackage_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def orderFiles(self, fids, pid, position): - """ - Parameters: - - fids - - pid - - position - """ - self.send_orderFiles(fids, pid, position) - self.recv_orderFiles() - - def send_orderFiles(self, fids, pid, position): - self._oprot.writeMessageBegin('orderFiles', TMessageType.CALL, self._seqid) - args = orderFiles_args() - args.fids = fids - args.pid = pid - args.position = position - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_orderFiles(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = orderFiles_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def isInteractionWaiting(self, mode): - """ - Parameters: - - mode - """ - self.send_isInteractionWaiting(mode) - return self.recv_isInteractionWaiting() - - def send_isInteractionWaiting(self, mode): - self._oprot.writeMessageBegin('isInteractionWaiting', TMessageType.CALL, self._seqid) - args = isInteractionWaiting_args() - args.mode = mode - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_isInteractionWaiting(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = isInteractionWaiting_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "isInteractionWaiting failed: unknown result"); - - def getInteractionTask(self, mode): - """ - Parameters: - - mode - """ - self.send_getInteractionTask(mode) - return self.recv_getInteractionTask() - - def send_getInteractionTask(self, mode): - self._oprot.writeMessageBegin('getInteractionTask', TMessageType.CALL, self._seqid) - args = getInteractionTask_args() - args.mode = mode - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getInteractionTask(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getInteractionTask_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getInteractionTask failed: unknown result"); - - def setInteractionResult(self, iid, result): - """ - Parameters: - - iid - - result - """ - self.send_setInteractionResult(iid, result) - self.recv_setInteractionResult() - - def send_setInteractionResult(self, iid, result): - self._oprot.writeMessageBegin('setInteractionResult', TMessageType.CALL, self._seqid) - args = setInteractionResult_args() - args.iid = iid - args.result = result - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setInteractionResult(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setInteractionResult_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def generateDownloadLink(self, fid, timeout): - """ - Parameters: - - fid - - timeout - """ - self.send_generateDownloadLink(fid, timeout) - return self.recv_generateDownloadLink() - - def send_generateDownloadLink(self, fid, timeout): - self._oprot.writeMessageBegin('generateDownloadLink', TMessageType.CALL, self._seqid) - args = generateDownloadLink_args() - args.fid = fid - args.timeout = timeout - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_generateDownloadLink(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = generateDownloadLink_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "generateDownloadLink failed: unknown result"); - - def getNotifications(self, ): - self.send_getNotifications() - return self.recv_getNotifications() - - def send_getNotifications(self, ): - self._oprot.writeMessageBegin('getNotifications', TMessageType.CALL, self._seqid) - args = getNotifications_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getNotifications(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getNotifications_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getNotifications failed: unknown result"); - - def getEvents(self, uuid): - """ - Parameters: - - uuid - """ - self.send_getEvents(uuid) - return self.recv_getEvents() - - 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() - - def recv_getEvents(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getEvents_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getEvents failed: unknown result"); - - def getAccounts(self, refresh): - """ - Parameters: - - refresh - """ - self.send_getAccounts(refresh) - return self.recv_getAccounts() - - 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() - - def recv_getAccounts(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAccounts_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - 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 is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAccountTypes failed: unknown result"); - - def updateAccount(self, plugin, account, password): - """ - Parameters: - - plugin - - account - - password - """ - self.send_updateAccount(plugin, account, password) - self.recv_updateAccount() - - def send_updateAccount(self, plugin, account, password): - self._oprot.writeMessageBegin('updateAccount', TMessageType.CALL, self._seqid) - args = updateAccount_args() - args.plugin = plugin - args.account = account - args.password = password - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_updateAccount(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = updateAccount_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def updateAccountInfo(self, account): - """ - Parameters: - - account - """ - self.send_updateAccountInfo(account) - self.recv_updateAccountInfo() - - def send_updateAccountInfo(self, account): - self._oprot.writeMessageBegin('updateAccountInfo', TMessageType.CALL, self._seqid) - args = updateAccountInfo_args() - args.account = account - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_updateAccountInfo(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = updateAccountInfo_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def removeAccount(self, plugin, account): - """ - Parameters: - - plugin - - account - """ - self.send_removeAccount(plugin, account) - self.recv_removeAccount() - - def send_removeAccount(self, plugin, account): - self._oprot.writeMessageBegin('removeAccount', TMessageType.CALL, self._seqid) - args = removeAccount_args() - args.plugin = plugin - args.account = account - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_removeAccount(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = removeAccount_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def login(self, username, password): - """ - Parameters: - - username - - password - """ - self.send_login(username, password) - return self.recv_login() - - def send_login(self, username, password): - self._oprot.writeMessageBegin('login', TMessageType.CALL, self._seqid) - args = login_args() - args.username = username - args.password = password - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_login(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = login_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "login failed: unknown result"); - - def getUserData(self, ): - self.send_getUserData() - return self.recv_getUserData() - - def send_getUserData(self, ): - self._oprot.writeMessageBegin('getUserData', TMessageType.CALL, self._seqid) - args = getUserData_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getUserData(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getUserData_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getUserData failed: unknown result"); - - def getAllUserData(self, ): - self.send_getAllUserData() - return self.recv_getAllUserData() - - def send_getAllUserData(self, ): - self._oprot.writeMessageBegin('getAllUserData', TMessageType.CALL, self._seqid) - args = getAllUserData_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getAllUserData(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAllUserData_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllUserData failed: unknown result"); - - def addUser(self, username, password): - """ - Parameters: - - username - - password - """ - self.send_addUser(username, password) - return self.recv_addUser() - - def send_addUser(self, username, password): - self._oprot.writeMessageBegin('addUser', TMessageType.CALL, self._seqid) - args = addUser_args() - args.username = username - args.password = password - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_addUser(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = addUser_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addUser failed: unknown result"); - - def updateUserData(self, data): - """ - Parameters: - - data - """ - self.send_updateUserData(data) - self.recv_updateUserData() - - def send_updateUserData(self, data): - self._oprot.writeMessageBegin('updateUserData', TMessageType.CALL, self._seqid) - args = updateUserData_args() - args.data = data - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_updateUserData(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = updateUserData_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def removeUser(self, uid): - """ - Parameters: - - uid - """ - self.send_removeUser(uid) - self.recv_removeUser() - - def send_removeUser(self, uid): - self._oprot.writeMessageBegin('removeUser', TMessageType.CALL, self._seqid) - args = removeUser_args() - args.uid = uid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_removeUser(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = removeUser_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - return - - def setPassword(self, username, old_password, new_password): - """ - Parameters: - - username - - old_password - - new_password - """ - self.send_setPassword(username, old_password, new_password) - return self.recv_setPassword() - - def send_setPassword(self, username, old_password, new_password): - self._oprot.writeMessageBegin('setPassword', TMessageType.CALL, self._seqid) - args = setPassword_args() - args.username = username - args.old_password = old_password - args.new_password = new_password - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_setPassword(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = setPassword_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "setPassword failed: unknown result"); - - def getAllInfo(self, ): - self.send_getAllInfo() - return self.recv_getAllInfo() - - def send_getAllInfo(self, ): - self._oprot.writeMessageBegin('getAllInfo', TMessageType.CALL, self._seqid) - args = getAllInfo_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getAllInfo(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAllInfo_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllInfo failed: unknown result"); - - def getInfoByPlugin(self, plugin): - """ - Parameters: - - plugin - """ - self.send_getInfoByPlugin(plugin) - return self.recv_getInfoByPlugin() - - def send_getInfoByPlugin(self, plugin): - self._oprot.writeMessageBegin('getInfoByPlugin', TMessageType.CALL, self._seqid) - args = getInfoByPlugin_args() - args.plugin = plugin - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getInfoByPlugin(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getInfoByPlugin_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getInfoByPlugin failed: unknown result"); - - def getAddonHandler(self, ): - self.send_getAddonHandler() - return self.recv_getAddonHandler() - - def send_getAddonHandler(self, ): - self._oprot.writeMessageBegin('getAddonHandler', TMessageType.CALL, self._seqid) - args = getAddonHandler_args() - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_getAddonHandler(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = getAddonHandler_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "getAddonHandler failed: unknown result"); - - def hasAddonHandler(self, plugin, func): - """ - Parameters: - - plugin - - func - """ - self.send_hasAddonHandler(plugin, func) - return self.recv_hasAddonHandler() - - def send_hasAddonHandler(self, plugin, func): - self._oprot.writeMessageBegin('hasAddonHandler', TMessageType.CALL, self._seqid) - args = hasAddonHandler_args() - args.plugin = plugin - args.func = func - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_hasAddonHandler(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = hasAddonHandler_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success is not None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "hasAddonHandler failed: unknown result"); - - def callAddon(self, plugin, func, arguments): - """ - Parameters: - - plugin - - func - - arguments - """ - self.send_callAddon(plugin, func, arguments) - self.recv_callAddon() - - def send_callAddon(self, plugin, func, arguments): - self._oprot.writeMessageBegin('callAddon', TMessageType.CALL, self._seqid) - args = callAddon_args() - args.plugin = plugin - args.func = func - args.arguments = arguments - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_callAddon(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = callAddon_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - if result.ex is not None: - raise result.ex - return - - def callAddonHandler(self, plugin, func, pid_or_fid): - """ - Parameters: - - plugin - - func - - pid_or_fid - """ - self.send_callAddonHandler(plugin, func, pid_or_fid) - self.recv_callAddonHandler() - - def send_callAddonHandler(self, plugin, func, pid_or_fid): - self._oprot.writeMessageBegin('callAddonHandler', TMessageType.CALL, self._seqid) - args = callAddonHandler_args() - args.plugin = plugin - args.func = func - args.pid_or_fid = pid_or_fid - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_callAddonHandler(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = callAddonHandler_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.e is not None: - raise result.e - if result.ex is not None: - raise result.ex - return - - -class Processor(Iface, TProcessor): - def __init__(self, handler): - self._handler = handler - self._processMap = {} - self._processMap["getServerVersion"] = Processor.process_getServerVersion - self._processMap["statusServer"] = Processor.process_statusServer - self._processMap["pauseServer"] = Processor.process_pauseServer - self._processMap["unpauseServer"] = Processor.process_unpauseServer - self._processMap["togglePause"] = Processor.process_togglePause - self._processMap["freeSpace"] = Processor.process_freeSpace - self._processMap["kill"] = Processor.process_kill - self._processMap["restart"] = Processor.process_restart - self._processMap["getLog"] = Processor.process_getLog - self._processMap["isTimeDownload"] = Processor.process_isTimeDownload - self._processMap["isTimeReconnect"] = Processor.process_isTimeReconnect - self._processMap["toggleReconnect"] = Processor.process_toggleReconnect - self._processMap["getProgressInfo"] = Processor.process_getProgressInfo - self._processMap["getConfig"] = Processor.process_getConfig - self._processMap["getGlobalPlugins"] = Processor.process_getGlobalPlugins - self._processMap["getUserPlugins"] = Processor.process_getUserPlugins - self._processMap["configurePlugin"] = Processor.process_configurePlugin - self._processMap["saveConfig"] = Processor.process_saveConfig - self._processMap["deleteConfig"] = Processor.process_deleteConfig - self._processMap["setConfigHandler"] = Processor.process_setConfigHandler - self._processMap["checkURLs"] = Processor.process_checkURLs - self._processMap["parseURLs"] = Processor.process_parseURLs - self._processMap["checkOnlineStatus"] = Processor.process_checkOnlineStatus - self._processMap["checkOnlineStatusContainer"] = Processor.process_checkOnlineStatusContainer - self._processMap["pollResults"] = Processor.process_pollResults - self._processMap["generatePackages"] = Processor.process_generatePackages - self._processMap["generateAndAddPackages"] = Processor.process_generateAndAddPackages - self._processMap["createPackage"] = Processor.process_createPackage - self._processMap["addPackage"] = Processor.process_addPackage - self._processMap["addPackageP"] = Processor.process_addPackageP - self._processMap["addPackageChild"] = Processor.process_addPackageChild - self._processMap["uploadContainer"] = Processor.process_uploadContainer - self._processMap["addLinks"] = Processor.process_addLinks - self._processMap["addLocalFile"] = Processor.process_addLocalFile - self._processMap["deleteFiles"] = Processor.process_deleteFiles - self._processMap["deletePackages"] = Processor.process_deletePackages - self._processMap["getCollector"] = Processor.process_getCollector - self._processMap["addToCollector"] = Processor.process_addToCollector - self._processMap["addFromCollector"] = Processor.process_addFromCollector - self._processMap["renameCollPack"] = Processor.process_renameCollPack - self._processMap["deleteCollPack"] = Processor.process_deleteCollPack - self._processMap["deleteCollLink"] = Processor.process_deleteCollLink - self._processMap["getAllFiles"] = Processor.process_getAllFiles - self._processMap["getAllUnfinishedFiles"] = Processor.process_getAllUnfinishedFiles - self._processMap["getFileTree"] = Processor.process_getFileTree - self._processMap["getUnfinishedFileTree"] = Processor.process_getUnfinishedFileTree - self._processMap["getPackageContent"] = Processor.process_getPackageContent - self._processMap["getPackageInfo"] = Processor.process_getPackageInfo - self._processMap["getFileInfo"] = Processor.process_getFileInfo - self._processMap["findFiles"] = Processor.process_findFiles - self._processMap["restartPackage"] = Processor.process_restartPackage - self._processMap["restartFile"] = Processor.process_restartFile - self._processMap["recheckPackage"] = Processor.process_recheckPackage - self._processMap["restartFailed"] = Processor.process_restartFailed - self._processMap["stopDownloads"] = Processor.process_stopDownloads - self._processMap["stopAllDownloads"] = Processor.process_stopAllDownloads - self._processMap["setPackagePaused"] = Processor.process_setPackagePaused - self._processMap["setPackageFolder"] = Processor.process_setPackageFolder - self._processMap["setPackageData"] = Processor.process_setPackageData - self._processMap["movePackage"] = Processor.process_movePackage - self._processMap["moveFiles"] = Processor.process_moveFiles - self._processMap["orderPackage"] = Processor.process_orderPackage - self._processMap["orderFiles"] = Processor.process_orderFiles - self._processMap["isInteractionWaiting"] = Processor.process_isInteractionWaiting - self._processMap["getInteractionTask"] = Processor.process_getInteractionTask - self._processMap["setInteractionResult"] = Processor.process_setInteractionResult - self._processMap["generateDownloadLink"] = Processor.process_generateDownloadLink - self._processMap["getNotifications"] = Processor.process_getNotifications - self._processMap["getEvents"] = Processor.process_getEvents - self._processMap["getAccounts"] = Processor.process_getAccounts - self._processMap["getAccountTypes"] = Processor.process_getAccountTypes - self._processMap["updateAccount"] = Processor.process_updateAccount - self._processMap["updateAccountInfo"] = Processor.process_updateAccountInfo - self._processMap["removeAccount"] = Processor.process_removeAccount - self._processMap["login"] = Processor.process_login - self._processMap["getUserData"] = Processor.process_getUserData - self._processMap["getAllUserData"] = Processor.process_getAllUserData - self._processMap["addUser"] = Processor.process_addUser - self._processMap["updateUserData"] = Processor.process_updateUserData - self._processMap["removeUser"] = Processor.process_removeUser - self._processMap["setPassword"] = Processor.process_setPassword - self._processMap["getAllInfo"] = Processor.process_getAllInfo - self._processMap["getInfoByPlugin"] = Processor.process_getInfoByPlugin - self._processMap["getAddonHandler"] = Processor.process_getAddonHandler - self._processMap["hasAddonHandler"] = Processor.process_hasAddonHandler - self._processMap["callAddon"] = Processor.process_callAddon - self._processMap["callAddonHandler"] = Processor.process_callAddonHandler - - def process(self, iprot, oprot): - (name, type, seqid) = iprot.readMessageBegin() - if name not in self._processMap: - iprot.skip(TType.STRUCT) - iprot.readMessageEnd() - x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) - oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) - x.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - return - else: - self._processMap[name](self, seqid, iprot, oprot) - return True - - def process_getServerVersion(self, seqid, iprot, oprot): - args = getServerVersion_args() - args.read(iprot) - iprot.readMessageEnd() - result = getServerVersion_result() - result.success = self._handler.getServerVersion() - oprot.writeMessageBegin("getServerVersion", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_statusServer(self, seqid, iprot, oprot): - args = statusServer_args() - args.read(iprot) - iprot.readMessageEnd() - result = statusServer_result() - result.success = self._handler.statusServer() - oprot.writeMessageBegin("statusServer", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_pauseServer(self, seqid, iprot, oprot): - args = pauseServer_args() - args.read(iprot) - iprot.readMessageEnd() - result = pauseServer_result() - self._handler.pauseServer() - oprot.writeMessageBegin("pauseServer", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_unpauseServer(self, seqid, iprot, oprot): - args = unpauseServer_args() - args.read(iprot) - iprot.readMessageEnd() - result = unpauseServer_result() - self._handler.unpauseServer() - oprot.writeMessageBegin("unpauseServer", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_togglePause(self, seqid, iprot, oprot): - args = togglePause_args() - args.read(iprot) - iprot.readMessageEnd() - result = togglePause_result() - result.success = self._handler.togglePause() - oprot.writeMessageBegin("togglePause", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_freeSpace(self, seqid, iprot, oprot): - args = freeSpace_args() - args.read(iprot) - iprot.readMessageEnd() - result = freeSpace_result() - result.success = self._handler.freeSpace() - oprot.writeMessageBegin("freeSpace", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_kill(self, seqid, iprot, oprot): - args = kill_args() - args.read(iprot) - iprot.readMessageEnd() - result = kill_result() - self._handler.kill() - oprot.writeMessageBegin("kill", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_restart(self, seqid, iprot, oprot): - args = restart_args() - args.read(iprot) - iprot.readMessageEnd() - result = restart_result() - self._handler.restart() - oprot.writeMessageBegin("restart", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getLog(self, seqid, iprot, oprot): - args = getLog_args() - args.read(iprot) - iprot.readMessageEnd() - result = getLog_result() - result.success = self._handler.getLog(args.offset) - oprot.writeMessageBegin("getLog", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_isTimeDownload(self, seqid, iprot, oprot): - args = isTimeDownload_args() - args.read(iprot) - iprot.readMessageEnd() - result = isTimeDownload_result() - result.success = self._handler.isTimeDownload() - oprot.writeMessageBegin("isTimeDownload", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_isTimeReconnect(self, seqid, iprot, oprot): - args = isTimeReconnect_args() - args.read(iprot) - iprot.readMessageEnd() - result = isTimeReconnect_result() - result.success = self._handler.isTimeReconnect() - oprot.writeMessageBegin("isTimeReconnect", TMessageType.REPLY, seqid) - result.write(oprot) - 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_getProgressInfo(self, seqid, iprot, oprot): - args = getProgressInfo_args() - args.read(iprot) - iprot.readMessageEnd() - result = getProgressInfo_result() - result.success = self._handler.getProgressInfo() - oprot.writeMessageBegin("getProgressInfo", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getConfig(self, seqid, iprot, oprot): - args = getConfig_args() - args.read(iprot) - iprot.readMessageEnd() - result = getConfig_result() - result.success = self._handler.getConfig() - oprot.writeMessageBegin("getConfig", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getGlobalPlugins(self, seqid, iprot, oprot): - args = getGlobalPlugins_args() - args.read(iprot) - iprot.readMessageEnd() - result = getGlobalPlugins_result() - result.success = self._handler.getGlobalPlugins() - oprot.writeMessageBegin("getGlobalPlugins", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getUserPlugins(self, seqid, iprot, oprot): - args = getUserPlugins_args() - args.read(iprot) - iprot.readMessageEnd() - result = getUserPlugins_result() - result.success = self._handler.getUserPlugins() - oprot.writeMessageBegin("getUserPlugins", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_configurePlugin(self, seqid, iprot, oprot): - args = configurePlugin_args() - args.read(iprot) - iprot.readMessageEnd() - result = configurePlugin_result() - result.success = self._handler.configurePlugin(args.plugin) - oprot.writeMessageBegin("configurePlugin", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_saveConfig(self, seqid, iprot, oprot): - args = saveConfig_args() - args.read(iprot) - iprot.readMessageEnd() - result = saveConfig_result() - self._handler.saveConfig(args.config) - oprot.writeMessageBegin("saveConfig", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_deleteConfig(self, seqid, iprot, oprot): - args = deleteConfig_args() - args.read(iprot) - iprot.readMessageEnd() - result = deleteConfig_result() - self._handler.deleteConfig(args.plugin) - oprot.writeMessageBegin("deleteConfig", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setConfigHandler(self, seqid, iprot, oprot): - args = setConfigHandler_args() - args.read(iprot) - iprot.readMessageEnd() - result = setConfigHandler_result() - self._handler.setConfigHandler(args.plugin, args.iid, args.value) - oprot.writeMessageBegin("setConfigHandler", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_checkURLs(self, seqid, iprot, oprot): - args = checkURLs_args() - args.read(iprot) - iprot.readMessageEnd() - result = checkURLs_result() - result.success = self._handler.checkURLs(args.urls) - oprot.writeMessageBegin("checkURLs", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_parseURLs(self, seqid, iprot, oprot): - args = parseURLs_args() - args.read(iprot) - iprot.readMessageEnd() - result = parseURLs_result() - result.success = self._handler.parseURLs(args.html, args.url) - oprot.writeMessageBegin("parseURLs", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_checkOnlineStatus(self, seqid, iprot, oprot): - args = checkOnlineStatus_args() - args.read(iprot) - iprot.readMessageEnd() - result = checkOnlineStatus_result() - result.success = self._handler.checkOnlineStatus(args.urls) - oprot.writeMessageBegin("checkOnlineStatus", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_checkOnlineStatusContainer(self, seqid, iprot, oprot): - args = checkOnlineStatusContainer_args() - args.read(iprot) - iprot.readMessageEnd() - result = checkOnlineStatusContainer_result() - result.success = self._handler.checkOnlineStatusContainer(args.urls, args.filename, args.data) - oprot.writeMessageBegin("checkOnlineStatusContainer", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_pollResults(self, seqid, iprot, oprot): - args = pollResults_args() - args.read(iprot) - iprot.readMessageEnd() - result = pollResults_result() - result.success = self._handler.pollResults(args.rid) - oprot.writeMessageBegin("pollResults", TMessageType.REPLY, seqid) - result.write(oprot) - 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_generateAndAddPackages(self, seqid, iprot, oprot): - args = generateAndAddPackages_args() - args.read(iprot) - iprot.readMessageEnd() - result = generateAndAddPackages_result() - result.success = self._handler.generateAndAddPackages(args.links, args.paused) - oprot.writeMessageBegin("generateAndAddPackages", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_createPackage(self, seqid, iprot, oprot): - args = createPackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = createPackage_result() - result.success = self._handler.createPackage(args.name, args.folder, args.root, args.password, args.site, args.comment, args.paused) - oprot.writeMessageBegin("createPackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addPackage(self, seqid, iprot, oprot): - args = addPackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = addPackage_result() - result.success = self._handler.addPackage(args.name, args.links, args.password) - oprot.writeMessageBegin("addPackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addPackageP(self, seqid, iprot, oprot): - args = addPackageP_args() - args.read(iprot) - iprot.readMessageEnd() - result = addPackageP_result() - result.success = self._handler.addPackageP(args.name, args.links, args.password, args.paused) - oprot.writeMessageBegin("addPackageP", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addPackageChild(self, seqid, iprot, oprot): - args = addPackageChild_args() - args.read(iprot) - iprot.readMessageEnd() - result = addPackageChild_result() - result.success = self._handler.addPackageChild(args.name, args.links, args.password, args.root, args.paused) - oprot.writeMessageBegin("addPackageChild", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_uploadContainer(self, seqid, iprot, oprot): - args = uploadContainer_args() - args.read(iprot) - iprot.readMessageEnd() - result = uploadContainer_result() - result.success = self._handler.uploadContainer(args.filename, args.data) - oprot.writeMessageBegin("uploadContainer", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addLinks(self, seqid, iprot, oprot): - args = addLinks_args() - args.read(iprot) - iprot.readMessageEnd() - result = addLinks_result() - try: - self._handler.addLinks(args.pid, args.links) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("addLinks", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addLocalFile(self, seqid, iprot, oprot): - args = addLocalFile_args() - args.read(iprot) - iprot.readMessageEnd() - result = addLocalFile_result() - try: - self._handler.addLocalFile(args.pid, args.name, args.path) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("addLocalFile", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_deleteFiles(self, seqid, iprot, oprot): - args = deleteFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = deleteFiles_result() - self._handler.deleteFiles(args.fids) - oprot.writeMessageBegin("deleteFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_deletePackages(self, seqid, iprot, oprot): - args = deletePackages_args() - args.read(iprot) - iprot.readMessageEnd() - result = deletePackages_result() - self._handler.deletePackages(args.pids) - oprot.writeMessageBegin("deletePackages", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getCollector(self, seqid, iprot, oprot): - args = getCollector_args() - args.read(iprot) - iprot.readMessageEnd() - result = getCollector_result() - result.success = self._handler.getCollector() - oprot.writeMessageBegin("getCollector", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addToCollector(self, seqid, iprot, oprot): - args = addToCollector_args() - args.read(iprot) - iprot.readMessageEnd() - result = addToCollector_result() - self._handler.addToCollector(args.links) - oprot.writeMessageBegin("addToCollector", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addFromCollector(self, seqid, iprot, oprot): - args = addFromCollector_args() - args.read(iprot) - iprot.readMessageEnd() - result = addFromCollector_result() - result.success = self._handler.addFromCollector(args.name, args.paused) - oprot.writeMessageBegin("addFromCollector", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_renameCollPack(self, seqid, iprot, oprot): - args = renameCollPack_args() - args.read(iprot) - iprot.readMessageEnd() - result = renameCollPack_result() - self._handler.renameCollPack(args.name, args.new_name) - oprot.writeMessageBegin("renameCollPack", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_deleteCollPack(self, seqid, iprot, oprot): - args = deleteCollPack_args() - args.read(iprot) - iprot.readMessageEnd() - result = deleteCollPack_result() - self._handler.deleteCollPack(args.name) - oprot.writeMessageBegin("deleteCollPack", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_deleteCollLink(self, seqid, iprot, oprot): - args = deleteCollLink_args() - args.read(iprot) - iprot.readMessageEnd() - result = deleteCollLink_result() - self._handler.deleteCollLink(args.url) - oprot.writeMessageBegin("deleteCollLink", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAllFiles(self, seqid, iprot, oprot): - args = getAllFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAllFiles_result() - result.success = self._handler.getAllFiles() - oprot.writeMessageBegin("getAllFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAllUnfinishedFiles(self, seqid, iprot, oprot): - args = getAllUnfinishedFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAllUnfinishedFiles_result() - result.success = self._handler.getAllUnfinishedFiles() - oprot.writeMessageBegin("getAllUnfinishedFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getFileTree(self, seqid, iprot, oprot): - args = getFileTree_args() - args.read(iprot) - iprot.readMessageEnd() - result = getFileTree_result() - result.success = self._handler.getFileTree(args.pid, args.full) - oprot.writeMessageBegin("getFileTree", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getUnfinishedFileTree(self, seqid, iprot, oprot): - args = getUnfinishedFileTree_args() - args.read(iprot) - iprot.readMessageEnd() - result = getUnfinishedFileTree_result() - result.success = self._handler.getUnfinishedFileTree(args.pid, args.full) - oprot.writeMessageBegin("getUnfinishedFileTree", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getPackageContent(self, seqid, iprot, oprot): - args = getPackageContent_args() - args.read(iprot) - iprot.readMessageEnd() - result = getPackageContent_result() - result.success = self._handler.getPackageContent(args.pid) - oprot.writeMessageBegin("getPackageContent", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getPackageInfo(self, seqid, iprot, oprot): - args = getPackageInfo_args() - args.read(iprot) - iprot.readMessageEnd() - result = getPackageInfo_result() - try: - result.success = self._handler.getPackageInfo(args.pid) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("getPackageInfo", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getFileInfo(self, seqid, iprot, oprot): - args = getFileInfo_args() - args.read(iprot) - iprot.readMessageEnd() - result = getFileInfo_result() - try: - result.success = self._handler.getFileInfo(args.fid) - except FileDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("getFileInfo", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_findFiles(self, seqid, iprot, oprot): - args = findFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = findFiles_result() - result.success = self._handler.findFiles(args.pattern) - oprot.writeMessageBegin("findFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_restartPackage(self, seqid, iprot, oprot): - args = restartPackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = restartPackage_result() - self._handler.restartPackage(args.pid) - oprot.writeMessageBegin("restartPackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_restartFile(self, seqid, iprot, oprot): - args = restartFile_args() - args.read(iprot) - iprot.readMessageEnd() - result = restartFile_result() - self._handler.restartFile(args.fid) - oprot.writeMessageBegin("restartFile", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_recheckPackage(self, seqid, iprot, oprot): - args = recheckPackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = recheckPackage_result() - self._handler.recheckPackage(args.pid) - oprot.writeMessageBegin("recheckPackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_restartFailed(self, seqid, iprot, oprot): - args = restartFailed_args() - args.read(iprot) - iprot.readMessageEnd() - result = restartFailed_result() - self._handler.restartFailed() - oprot.writeMessageBegin("restartFailed", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_stopDownloads(self, seqid, iprot, oprot): - args = stopDownloads_args() - args.read(iprot) - iprot.readMessageEnd() - result = stopDownloads_result() - self._handler.stopDownloads(args.fids) - oprot.writeMessageBegin("stopDownloads", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_stopAllDownloads(self, seqid, iprot, oprot): - args = stopAllDownloads_args() - args.read(iprot) - iprot.readMessageEnd() - result = stopAllDownloads_result() - self._handler.stopAllDownloads() - oprot.writeMessageBegin("stopAllDownloads", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setPackagePaused(self, seqid, iprot, oprot): - args = setPackagePaused_args() - args.read(iprot) - iprot.readMessageEnd() - result = setPackagePaused_result() - try: - self._handler.setPackagePaused(args.pid, args.paused) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("setPackagePaused", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setPackageFolder(self, seqid, iprot, oprot): - args = setPackageFolder_args() - args.read(iprot) - iprot.readMessageEnd() - result = setPackageFolder_result() - try: - result.success = self._handler.setPackageFolder(args.pid, args.path) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("setPackageFolder", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setPackageData(self, seqid, iprot, oprot): - args = setPackageData_args() - args.read(iprot) - iprot.readMessageEnd() - result = setPackageData_result() - try: - self._handler.setPackageData(args.pid, args.data) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("setPackageData", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_movePackage(self, seqid, iprot, oprot): - args = movePackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = movePackage_result() - try: - result.success = self._handler.movePackage(args.pid, args.root) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("movePackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_moveFiles(self, seqid, iprot, oprot): - args = moveFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = moveFiles_result() - try: - result.success = self._handler.moveFiles(args.fids, args.pid) - except PackageDoesNotExists, e: - result.e = e - oprot.writeMessageBegin("moveFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_orderPackage(self, seqid, iprot, oprot): - args = orderPackage_args() - args.read(iprot) - iprot.readMessageEnd() - result = orderPackage_result() - self._handler.orderPackage(args.pids, args.position) - oprot.writeMessageBegin("orderPackage", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_orderFiles(self, seqid, iprot, oprot): - args = orderFiles_args() - args.read(iprot) - iprot.readMessageEnd() - result = orderFiles_result() - self._handler.orderFiles(args.fids, args.pid, args.position) - oprot.writeMessageBegin("orderFiles", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_isInteractionWaiting(self, seqid, iprot, oprot): - args = isInteractionWaiting_args() - args.read(iprot) - iprot.readMessageEnd() - result = isInteractionWaiting_result() - result.success = self._handler.isInteractionWaiting(args.mode) - oprot.writeMessageBegin("isInteractionWaiting", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getInteractionTask(self, seqid, iprot, oprot): - args = getInteractionTask_args() - args.read(iprot) - iprot.readMessageEnd() - result = getInteractionTask_result() - result.success = self._handler.getInteractionTask(args.mode) - oprot.writeMessageBegin("getInteractionTask", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setInteractionResult(self, seqid, iprot, oprot): - args = setInteractionResult_args() - args.read(iprot) - iprot.readMessageEnd() - result = setInteractionResult_result() - self._handler.setInteractionResult(args.iid, args.result) - oprot.writeMessageBegin("setInteractionResult", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_generateDownloadLink(self, seqid, iprot, oprot): - args = generateDownloadLink_args() - args.read(iprot) - iprot.readMessageEnd() - result = generateDownloadLink_result() - result.success = self._handler.generateDownloadLink(args.fid, args.timeout) - oprot.writeMessageBegin("generateDownloadLink", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getNotifications(self, seqid, iprot, oprot): - args = getNotifications_args() - args.read(iprot) - iprot.readMessageEnd() - result = getNotifications_result() - result.success = self._handler.getNotifications() - oprot.writeMessageBegin("getNotifications", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getEvents(self, seqid, iprot, oprot): - args = getEvents_args() - args.read(iprot) - iprot.readMessageEnd() - result = getEvents_result() - result.success = self._handler.getEvents(args.uuid) - oprot.writeMessageBegin("getEvents", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAccounts(self, seqid, iprot, oprot): - args = getAccounts_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAccounts_result() - 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_updateAccount(self, seqid, iprot, oprot): - args = updateAccount_args() - args.read(iprot) - iprot.readMessageEnd() - result = updateAccount_result() - self._handler.updateAccount(args.plugin, args.account, args.password) - oprot.writeMessageBegin("updateAccount", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_updateAccountInfo(self, seqid, iprot, oprot): - args = updateAccountInfo_args() - args.read(iprot) - iprot.readMessageEnd() - result = updateAccountInfo_result() - self._handler.updateAccountInfo(args.account) - oprot.writeMessageBegin("updateAccountInfo", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_removeAccount(self, seqid, iprot, oprot): - args = removeAccount_args() - args.read(iprot) - iprot.readMessageEnd() - result = removeAccount_result() - self._handler.removeAccount(args.plugin, args.account) - oprot.writeMessageBegin("removeAccount", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_login(self, seqid, iprot, oprot): - args = login_args() - args.read(iprot) - iprot.readMessageEnd() - result = login_result() - result.success = self._handler.login(args.username, args.password) - oprot.writeMessageBegin("login", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getUserData(self, seqid, iprot, oprot): - args = getUserData_args() - args.read(iprot) - iprot.readMessageEnd() - result = getUserData_result() - result.success = self._handler.getUserData() - oprot.writeMessageBegin("getUserData", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAllUserData(self, seqid, iprot, oprot): - args = getAllUserData_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAllUserData_result() - result.success = self._handler.getAllUserData() - oprot.writeMessageBegin("getAllUserData", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_addUser(self, seqid, iprot, oprot): - args = addUser_args() - args.read(iprot) - iprot.readMessageEnd() - result = addUser_result() - result.success = self._handler.addUser(args.username, args.password) - oprot.writeMessageBegin("addUser", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_updateUserData(self, seqid, iprot, oprot): - args = updateUserData_args() - args.read(iprot) - iprot.readMessageEnd() - result = updateUserData_result() - self._handler.updateUserData(args.data) - oprot.writeMessageBegin("updateUserData", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_removeUser(self, seqid, iprot, oprot): - args = removeUser_args() - args.read(iprot) - iprot.readMessageEnd() - result = removeUser_result() - self._handler.removeUser(args.uid) - oprot.writeMessageBegin("removeUser", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_setPassword(self, seqid, iprot, oprot): - args = setPassword_args() - args.read(iprot) - iprot.readMessageEnd() - result = setPassword_result() - result.success = self._handler.setPassword(args.username, args.old_password, args.new_password) - oprot.writeMessageBegin("setPassword", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAllInfo(self, seqid, iprot, oprot): - args = getAllInfo_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAllInfo_result() - result.success = self._handler.getAllInfo() - oprot.writeMessageBegin("getAllInfo", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getInfoByPlugin(self, seqid, iprot, oprot): - args = getInfoByPlugin_args() - args.read(iprot) - iprot.readMessageEnd() - result = getInfoByPlugin_result() - result.success = self._handler.getInfoByPlugin(args.plugin) - oprot.writeMessageBegin("getInfoByPlugin", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_getAddonHandler(self, seqid, iprot, oprot): - args = getAddonHandler_args() - args.read(iprot) - iprot.readMessageEnd() - result = getAddonHandler_result() - result.success = self._handler.getAddonHandler() - oprot.writeMessageBegin("getAddonHandler", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_hasAddonHandler(self, seqid, iprot, oprot): - args = hasAddonHandler_args() - args.read(iprot) - iprot.readMessageEnd() - result = hasAddonHandler_result() - result.success = self._handler.hasAddonHandler(args.plugin, args.func) - oprot.writeMessageBegin("hasAddonHandler", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_callAddon(self, seqid, iprot, oprot): - args = callAddon_args() - args.read(iprot) - iprot.readMessageEnd() - result = callAddon_result() - try: - self._handler.callAddon(args.plugin, args.func, args.arguments) - except ServiceDoesNotExists, e: - result.e = e - except ServiceException, ex: - result.ex = ex - oprot.writeMessageBegin("callAddon", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_callAddonHandler(self, seqid, iprot, oprot): - args = callAddonHandler_args() - args.read(iprot) - iprot.readMessageEnd() - result = callAddonHandler_result() - try: - self._handler.callAddonHandler(args.plugin, args.func, args.pid_or_fid) - except ServiceDoesNotExists, e: - result.e = e - except ServiceException, ex: - result.ex = ex - oprot.writeMessageBegin("callAddonHandler", TMessageType.REPLY, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - -# HELPER FUNCTIONS AND STRUCTURES - -class getServerVersion_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getServerVersion_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRING, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class statusServer_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class statusServer_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (ServerStatus, ServerStatus.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class pauseServer_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class pauseServer_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class unpauseServer_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class unpauseServer_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class togglePause_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class togglePause_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class freeSpace_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class freeSpace_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I64, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class kill_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class kill_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class restart_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class restart_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getLog_args(TBase): - """ - Attributes: - - offset - """ - - __slots__ = [ - 'offset', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'offset', None, None, ), # 1 - ) - - def __init__(self, offset=None,): - self.offset = offset - - -class getLog_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class isTimeDownload_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class isTimeDownload_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class isTimeReconnect_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class isTimeReconnect_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class toggleReconnect_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class toggleReconnect_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getProgressInfo_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getProgressInfo_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(ProgressInfo, ProgressInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getConfig_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getConfig_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING,None,TType.STRUCT,(ConfigHolder, ConfigHolder.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getGlobalPlugins_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getGlobalPlugins_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(ConfigInfo, ConfigInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getUserPlugins_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getUserPlugins_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(ConfigInfo, ConfigInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class configurePlugin_args(TBase): - """ - Attributes: - - plugin - """ - - __slots__ = [ - 'plugin', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - ) - - def __init__(self, plugin=None,): - self.plugin = plugin - - -class configurePlugin_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (ConfigHolder, ConfigHolder.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class saveConfig_args(TBase): - """ - Attributes: - - config - """ - - __slots__ = [ - 'config', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'config', (ConfigHolder, ConfigHolder.thrift_spec), None, ), # 1 - ) - - def __init__(self, config=None,): - self.config = config - - -class saveConfig_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class deleteConfig_args(TBase): - """ - Attributes: - - plugin - """ - - __slots__ = [ - 'plugin', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - ) - - def __init__(self, plugin=None,): - self.plugin = plugin - - -class deleteConfig_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class setConfigHandler_args(TBase): - """ - Attributes: - - plugin - - iid - - value - """ - - __slots__ = [ - 'plugin', - 'iid', - 'value', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.I32, 'iid', None, None, ), # 2 - (3, TType.STRING, 'value', None, None, ), # 3 - ) - - def __init__(self, plugin=None, iid=None, value=None,): - self.plugin = plugin - self.iid = iid - self.value = value - - -class setConfigHandler_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class checkURLs_args(TBase): - """ - Attributes: - - urls - """ - - __slots__ = [ - 'urls', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING,None), None, ), # 1 - ) - - def __init__(self, urls=None,): - self.urls = urls - - -class checkURLs_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 parseURLs_args(TBase): - """ - Attributes: - - html - - url - """ - - __slots__ = [ - 'html', - 'url', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'html', None, None, ), # 1 - (2, TType.STRING, 'url', None, None, ), # 2 - ) - - def __init__(self, html=None, url=None,): - self.html = html - self.url = url - - -class parseURLs_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 checkOnlineStatus_args(TBase): - """ - Attributes: - - urls - """ - - __slots__ = [ - 'urls', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING,None), None, ), # 1 - ) - - def __init__(self, urls=None,): - self.urls = urls - - -class checkOnlineStatus_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class checkOnlineStatusContainer_args(TBase): - """ - Attributes: - - urls - - filename - - data - """ - - __slots__ = [ - 'urls', - 'filename', - 'data', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING,None), None, ), # 1 - (2, TType.STRING, 'filename', None, None, ), # 2 - (3, TType.STRING, 'data', None, None, ), # 3 - ) - - def __init__(self, urls=None, filename=None, data=None,): - self.urls = urls - self.filename = filename - self.data = data - - -class checkOnlineStatusContainer_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class pollResults_args(TBase): - """ - Attributes: - - rid - """ - - __slots__ = [ - 'rid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'rid', None, None, ), # 1 - ) - - def __init__(self, rid=None,): - self.rid = rid - - -class pollResults_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - 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 generateAndAddPackages_args(TBase): - """ - Attributes: - - links - - paused - """ - - __slots__ = [ - 'links', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'links', (TType.STRING,None), None, ), # 1 - (2, TType.BOOL, 'paused', None, None, ), # 2 - ) - - def __init__(self, links=None, paused=None,): - self.links = links - self.paused = paused - - -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 createPackage_args(TBase): - """ - Attributes: - - name - - folder - - root - - password - - site - - comment - - paused - """ - - __slots__ = [ - 'name', - 'folder', - 'root', - 'password', - 'site', - 'comment', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'folder', None, None, ), # 2 - (3, TType.I32, 'root', None, None, ), # 3 - (4, TType.STRING, 'password', None, None, ), # 4 - (5, TType.STRING, 'site', None, None, ), # 5 - (6, TType.STRING, 'comment', None, None, ), # 6 - (7, TType.BOOL, 'paused', None, None, ), # 7 - ) - - def __init__(self, name=None, folder=None, root=None, password=None, site=None, comment=None, paused=None,): - self.name = name - self.folder = folder - self.root = root - self.password = password - self.site = site - self.comment = comment - self.paused = paused - - -class createPackage_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addPackage_args(TBase): - """ - Attributes: - - name - - links - - password - """ - - __slots__ = [ - 'name', - 'links', - 'password', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.LIST, 'links', (TType.STRING,None), None, ), # 2 - (3, TType.STRING, 'password', None, None, ), # 3 - ) - - def __init__(self, name=None, links=None, password=None,): - self.name = name - self.links = links - self.password = password - - -class addPackage_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addPackageP_args(TBase): - """ - Attributes: - - name - - links - - password - - paused - """ - - __slots__ = [ - 'name', - 'links', - 'password', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.LIST, 'links', (TType.STRING,None), None, ), # 2 - (3, TType.STRING, 'password', None, None, ), # 3 - (4, TType.BOOL, 'paused', None, None, ), # 4 - ) - - def __init__(self, name=None, links=None, password=None, paused=None,): - self.name = name - self.links = links - self.password = password - self.paused = paused - - -class addPackageP_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addPackageChild_args(TBase): - """ - Attributes: - - name - - links - - password - - root - - paused - """ - - __slots__ = [ - 'name', - 'links', - 'password', - 'root', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.LIST, 'links', (TType.STRING,None), None, ), # 2 - (3, TType.STRING, 'password', None, None, ), # 3 - (4, TType.I32, 'root', None, None, ), # 4 - (5, TType.BOOL, 'paused', None, None, ), # 5 - ) - - def __init__(self, name=None, links=None, password=None, root=None, paused=None,): - self.name = name - self.links = links - self.password = password - self.root = root - self.paused = paused - - -class addPackageChild_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class uploadContainer_args(TBase): - """ - Attributes: - - filename - - data - """ - - __slots__ = [ - 'filename', - 'data', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'filename', None, None, ), # 1 - (2, TType.STRING, 'data', None, None, ), # 2 - ) - - def __init__(self, filename=None, data=None,): - self.filename = filename - self.data = data - - -class uploadContainer_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addLinks_args(TBase): - """ - Attributes: - - pid - - links - """ - - __slots__ = [ - 'pid', - 'links', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.LIST, 'links', (TType.STRING,None), None, ), # 2 - ) - - def __init__(self, pid=None, links=None,): - self.pid = pid - self.links = links - - -class addLinks_result(TBase): - """ - Attributes: - - e - """ - - __slots__ = [ - 'e', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, e=None,): - self.e = e - - -class addLocalFile_args(TBase): - """ - Attributes: - - pid - - name - - path - """ - - __slots__ = [ - 'pid', - 'name', - 'path', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 - (3, TType.STRING, 'path', None, None, ), # 3 - ) - - def __init__(self, pid=None, name=None, path=None,): - self.pid = pid - self.name = name - self.path = path - - -class addLocalFile_result(TBase): - """ - Attributes: - - e - """ - - __slots__ = [ - 'e', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, e=None,): - self.e = e - - -class deleteFiles_args(TBase): - """ - Attributes: - - fids - """ - - __slots__ = [ - 'fids', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1 - ) - - def __init__(self, fids=None,): - self.fids = fids - - -class deleteFiles_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class deletePackages_args(TBase): - """ - Attributes: - - pids - """ - - __slots__ = [ - 'pids', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'pids', (TType.I32,None), None, ), # 1 - ) - - def __init__(self, pids=None,): - self.pids = pids - - -class deletePackages_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getCollector_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getCollector_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(LinkStatus, LinkStatus.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addToCollector_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 addToCollector_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class addFromCollector_args(TBase): - """ - Attributes: - - name - - paused - """ - - __slots__ = [ - 'name', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.BOOL, 'paused', None, None, ), # 2 - ) - - def __init__(self, name=None, paused=None,): - self.name = name - self.paused = paused - - -class addFromCollector_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.I32, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class renameCollPack_args(TBase): - """ - Attributes: - - name - - new_name - """ - - __slots__ = [ - 'name', - 'new_name', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'new_name', None, None, ), # 2 - ) - - def __init__(self, name=None, new_name=None,): - self.name = name - self.new_name = new_name - - -class renameCollPack_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class deleteCollPack_args(TBase): - """ - Attributes: - - name - """ - - __slots__ = [ - 'name', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - ) - - def __init__(self, name=None,): - self.name = name - - -class deleteCollPack_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class deleteCollLink_args(TBase): - """ - Attributes: - - url - """ - - __slots__ = [ - 'url', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'url', None, None, ), # 1 - ) - - def __init__(self, url=None,): - self.url = url - - -class deleteCollLink_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAllFiles_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAllFiles_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAllUnfinishedFiles_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAllUnfinishedFiles_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getFileTree_args(TBase): - """ - Attributes: - - pid - - full - """ - - __slots__ = [ - 'pid', - 'full', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.BOOL, 'full', None, None, ), # 2 - ) - - def __init__(self, pid=None, full=None,): - self.pid = pid - self.full = full - - -class getFileTree_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getUnfinishedFileTree_args(TBase): - """ - Attributes: - - pid - - full - """ - - __slots__ = [ - 'pid', - 'full', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.BOOL, 'full', None, None, ), # 2 - ) - - def __init__(self, pid=None, full=None,): - self.pid = pid - self.full = full - - -class getUnfinishedFileTree_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getPackageContent_args(TBase): - """ - Attributes: - - pid - """ - - __slots__ = [ - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - ) - - def __init__(self, pid=None,): - self.pid = pid - - -class getPackageContent_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getPackageInfo_args(TBase): - """ - Attributes: - - pid - """ - - __slots__ = [ - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - ) - - def __init__(self, pid=None,): - self.pid = pid - - -class getPackageInfo_result(TBase): - """ - Attributes: - - success - - e - """ - - __slots__ = [ - 'success', - 'e', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (PackageInfo, PackageInfo.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, e=None,): - self.success = success - self.e = e - - -class getFileInfo_args(TBase): - """ - Attributes: - - fid - """ - - __slots__ = [ - 'fid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - ) - - def __init__(self, fid=None,): - self.fid = fid - - -class getFileInfo_result(TBase): - """ - Attributes: - - success - - e - """ - - __slots__ = [ - 'success', - 'e', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (FileInfo, FileInfo.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'e', (FileDoesNotExists, FileDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, e=None,): - self.success = success - self.e = e - - -class findFiles_args(TBase): - """ - Attributes: - - pattern - """ - - __slots__ = [ - 'pattern', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'pattern', None, None, ), # 1 - ) - - def __init__(self, pattern=None,): - self.pattern = pattern - - -class findFiles_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (TreeCollection, TreeCollection.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class restartPackage_args(TBase): - """ - Attributes: - - pid - """ - - __slots__ = [ - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - ) - - def __init__(self, pid=None,): - self.pid = pid - - -class restartPackage_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class restartFile_args(TBase): - """ - Attributes: - - fid - """ - - __slots__ = [ - 'fid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - ) - - def __init__(self, fid=None,): - self.fid = fid - - -class restartFile_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class recheckPackage_args(TBase): - """ - Attributes: - - pid - """ - - __slots__ = [ - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - ) - - def __init__(self, pid=None,): - self.pid = pid - - -class recheckPackage_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class restartFailed_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class restartFailed_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class stopDownloads_args(TBase): - """ - Attributes: - - fids - """ - - __slots__ = [ - 'fids', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1 - ) - - def __init__(self, fids=None,): - self.fids = fids - - -class stopDownloads_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class stopAllDownloads_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class stopAllDownloads_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class setPackagePaused_args(TBase): - """ - Attributes: - - pid - - paused - """ - - __slots__ = [ - 'pid', - 'paused', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.BOOL, 'paused', None, None, ), # 2 - ) - - def __init__(self, pid=None, paused=None,): - self.pid = pid - self.paused = paused - - -class setPackagePaused_result(TBase): - """ - Attributes: - - e - """ - - __slots__ = [ - 'e', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, e=None,): - self.e = e - - -class setPackageFolder_args(TBase): - """ - Attributes: - - pid - - path - """ - - __slots__ = [ - 'pid', - 'path', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.STRING, 'path', None, None, ), # 2 - ) - - def __init__(self, pid=None, path=None,): - self.pid = pid - self.path = path - - -class setPackageFolder_result(TBase): - """ - Attributes: - - success - - e - """ - - __slots__ = [ - 'success', - 'e', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, e=None,): - self.success = success - self.e = e - - -class setPackageData_args(TBase): - """ - Attributes: - - pid - - data - """ - - __slots__ = [ - 'pid', - 'data', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.MAP, 'data', (TType.STRING,None,TType.STRING,None), None, ), # 2 - ) - - def __init__(self, pid=None, data=None,): - self.pid = pid - self.data = data - - -class setPackageData_result(TBase): - """ - Attributes: - - e - """ - - __slots__ = [ - 'e', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, e=None,): - self.e = e - - -class movePackage_args(TBase): - """ - Attributes: - - pid - - root - """ - - __slots__ = [ - 'pid', - 'root', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.I32, 'root', None, None, ), # 2 - ) - - def __init__(self, pid=None, root=None,): - self.pid = pid - self.root = root - - -class movePackage_result(TBase): - """ - Attributes: - - success - - e - """ - - __slots__ = [ - 'success', - 'e', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, e=None,): - self.success = success - self.e = e - - -class moveFiles_args(TBase): - """ - Attributes: - - fids - - pid - """ - - __slots__ = [ - 'fids', - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1 - (2, TType.I32, 'pid', None, None, ), # 2 - ) - - def __init__(self, fids=None, pid=None,): - self.fids = fids - self.pid = pid - - -class moveFiles_result(TBase): - """ - Attributes: - - success - - e - """ - - __slots__ = [ - 'success', - 'e', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, e=None,): - self.success = success - self.e = e - - -class orderPackage_args(TBase): - """ - Attributes: - - pids - - position - """ - - __slots__ = [ - 'pids', - 'position', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'pids', (TType.I32,None), None, ), # 1 - (2, TType.I16, 'position', None, None, ), # 2 - ) - - def __init__(self, pids=None, position=None,): - self.pids = pids - self.position = position - - -class orderPackage_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class orderFiles_args(TBase): - """ - Attributes: - - fids - - pid - - position - """ - - __slots__ = [ - 'fids', - 'pid', - 'position', - ] - - thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1 - (2, TType.I32, 'pid', None, None, ), # 2 - (3, TType.I16, 'position', None, None, ), # 3 - ) - - def __init__(self, fids=None, pid=None, position=None,): - self.fids = fids - self.pid = pid - self.position = position - - -class orderFiles_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class isInteractionWaiting_args(TBase): - """ - Attributes: - - mode - """ - - __slots__ = [ - 'mode', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I16, 'mode', None, None, ), # 1 - ) - - def __init__(self, mode=None,): - self.mode = mode - - -class isInteractionWaiting_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getInteractionTask_args(TBase): - """ - Attributes: - - mode - """ - - __slots__ = [ - 'mode', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I16, 'mode', None, None, ), # 1 - ) - - def __init__(self, mode=None,): - self.mode = mode - - -class getInteractionTask_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (InteractionTask, InteractionTask.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class setInteractionResult_args(TBase): - """ - Attributes: - - iid - - result - """ - - __slots__ = [ - 'iid', - 'result', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'iid', None, None, ), # 1 - (2, TType.STRING, 'result', None, None, ), # 2 - ) - - def __init__(self, iid=None, result=None,): - self.iid = iid - self.result = result - - -class setInteractionResult_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class generateDownloadLink_args(TBase): - """ - Attributes: - - fid - - timeout - """ - - __slots__ = [ - 'fid', - 'timeout', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - (2, TType.I16, 'timeout', None, None, ), # 2 - ) - - def __init__(self, fid=None, timeout=None,): - self.fid = fid - self.timeout = timeout - - -class generateDownloadLink_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRING, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getNotifications_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getNotifications_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(InteractionTask, InteractionTask.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getEvents_args(TBase): - """ - Attributes: - - uuid - """ - - __slots__ = [ - 'uuid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'uuid', None, None, ), # 1 - ) - - def __init__(self, uuid=None,): - self.uuid = uuid - - -class getEvents_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(EventInfo, EventInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAccounts_args(TBase): - """ - Attributes: - - refresh - """ - - __slots__ = [ - 'refresh', - ] - - thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'refresh', None, None, ), # 1 - ) - - def __init__(self, refresh=None,): - self.refresh = refresh - - -class getAccounts_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(AccountInfo, AccountInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAccountTypes_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAccountTypes_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class updateAccount_args(TBase): - """ - Attributes: - - plugin - - account - - password - """ - - __slots__ = [ - 'plugin', - 'account', - 'password', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'account', None, None, ), # 2 - (3, TType.STRING, 'password', None, None, ), # 3 - ) - - def __init__(self, plugin=None, account=None, password=None,): - self.plugin = plugin - self.account = account - self.password = password - - -class updateAccount_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class updateAccountInfo_args(TBase): - """ - Attributes: - - account - """ - - __slots__ = [ - 'account', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'account', (AccountInfo, AccountInfo.thrift_spec), None, ), # 1 - ) - - def __init__(self, account=None,): - self.account = account - - -class updateAccountInfo_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class removeAccount_args(TBase): - """ - Attributes: - - plugin - - account - """ - - __slots__ = [ - 'plugin', - 'account', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'account', None, None, ), # 2 - ) - - def __init__(self, plugin=None, account=None,): - self.plugin = plugin - self.account = account - - -class removeAccount_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class login_args(TBase): - """ - Attributes: - - username - - password - """ - - __slots__ = [ - 'username', - 'password', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', None, None, ), # 1 - (2, TType.STRING, 'password', None, None, ), # 2 - ) - - def __init__(self, username=None, password=None,): - self.username = username - self.password = password - - -class login_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getUserData_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getUserData_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAllUserData_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAllUserData_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.MAP, 'success', (TType.I32,None,TType.STRUCT,(UserData, UserData.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class addUser_args(TBase): - """ - Attributes: - - username - - password - """ - - __slots__ = [ - 'username', - 'password', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', None, None, ), # 1 - (2, TType.STRING, 'password', None, None, ), # 2 - ) - - def __init__(self, username=None, password=None,): - self.username = username - self.password = password - - -class addUser_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class updateUserData_args(TBase): - """ - Attributes: - - data - """ - - __slots__ = [ - 'data', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'data', (UserData, UserData.thrift_spec), None, ), # 1 - ) - - def __init__(self, data=None,): - self.data = data - - -class updateUserData_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class removeUser_args(TBase): - """ - Attributes: - - uid - """ - - __slots__ = [ - 'uid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'uid', None, None, ), # 1 - ) - - def __init__(self, uid=None,): - self.uid = uid - - -class removeUser_result(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class setPassword_args(TBase): - """ - Attributes: - - username - - old_password - - new_password - """ - - __slots__ = [ - 'username', - 'old_password', - 'new_password', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', None, None, ), # 1 - (2, TType.STRING, 'old_password', None, None, ), # 2 - (3, TType.STRING, 'new_password', None, None, ), # 3 - ) - - def __init__(self, username=None, old_password=None, new_password=None,): - self.username = username - self.old_password = old_password - self.new_password = new_password - - -class setPassword_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAllInfo_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAllInfo_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING,None,TType.LIST,(TType.STRUCT,(AddonInfo, AddonInfo.thrift_spec))), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getInfoByPlugin_args(TBase): - """ - Attributes: - - plugin - """ - - __slots__ = [ - 'plugin', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - ) - - def __init__(self, plugin=None,): - self.plugin = plugin - - -class getInfoByPlugin_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT,(AddonInfo, AddonInfo.thrift_spec)), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class getAddonHandler_args(TBase): - - __slots__ = [ - ] - - thrift_spec = ( - ) - - -class getAddonHandler_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING,None,TType.LIST,(TType.STRUCT,(AddonService, AddonService.thrift_spec))), None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class hasAddonHandler_args(TBase): - """ - Attributes: - - plugin - - func - """ - - __slots__ = [ - 'plugin', - 'func', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'func', None, None, ), # 2 - ) - - def __init__(self, plugin=None, func=None,): - self.plugin = plugin - self.func = func - - -class hasAddonHandler_result(TBase): - """ - Attributes: - - success - """ - - __slots__ = [ - 'success', - ] - - thrift_spec = ( - (0, TType.BOOL, 'success', None, None, ), # 0 - ) - - def __init__(self, success=None,): - self.success = success - - -class callAddon_args(TBase): - """ - Attributes: - - plugin - - func - - arguments - """ - - __slots__ = [ - 'plugin', - 'func', - 'arguments', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'func', None, None, ), # 2 - (3, TType.LIST, 'arguments', (TType.STRING,None), None, ), # 3 - ) - - def __init__(self, plugin=None, func=None, arguments=None,): - self.plugin = plugin - self.func = func - self.arguments = arguments - - -class callAddon_result(TBase): - """ - Attributes: - - e - - ex - """ - - __slots__ = [ - 'e', - 'ex', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (ServiceDoesNotExists, ServiceDoesNotExists.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'ex', (ServiceException, ServiceException.thrift_spec), None, ), # 2 - ) - - def __init__(self, e=None, ex=None,): - self.e = e - self.ex = ex - - -class callAddonHandler_args(TBase): - """ - Attributes: - - plugin - - func - - pid_or_fid - """ - - __slots__ = [ - 'plugin', - 'func', - 'pid_or_fid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'func', None, None, ), # 2 - (3, TType.I32, 'pid_or_fid', None, None, ), # 3 - ) - - def __init__(self, plugin=None, func=None, pid_or_fid=None,): - self.plugin = plugin - self.func = func - self.pid_or_fid = pid_or_fid - - -class callAddonHandler_result(TBase): - """ - Attributes: - - e - - ex - """ - - __slots__ = [ - 'e', - 'ex', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (ServiceDoesNotExists, ServiceDoesNotExists.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'ex', (ServiceException, ServiceException.thrift_spec), None, ), # 2 - ) - - def __init__(self, e=None, ex=None,): - self.e = e - self.ex = ex - diff --git a/module/remote/thriftbackend/thriftgen/pyload/__init__.py b/module/remote/thriftbackend/thriftgen/pyload/__init__.py deleted file mode 100644 index ce7f52598..000000000 --- a/module/remote/thriftbackend/thriftgen/pyload/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__all__ = ['ttypes', 'constants', 'Pyload'] diff --git a/module/remote/thriftbackend/thriftgen/pyload/constants.py b/module/remote/thriftbackend/thriftgen/pyload/constants.py deleted file mode 100644 index 7842b3177..000000000 --- a/module/remote/thriftbackend/thriftgen/pyload/constants.py +++ /dev/null @@ -1,11 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# -# options string: py:slots,dynamic -# - -from thrift.Thrift import TType, TMessageType, TException -from ttypes import * - diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py deleted file mode 100644 index 4b2f6497c..000000000 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ /dev/null @@ -1,1129 +0,0 @@ -# -# Autogenerated by Thrift Compiler (0.8.0) -# -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING -# -# options string: py:slots,dynamic -# - -from thrift.Thrift import TType, TMessageType, TException - -from thrift.protocol.TBase import TBase, TExceptionBase - - -class DownloadStatus(TBase): - NA = 0 - Offline = 1 - Online = 2 - Queued = 3 - Paused = 4 - Finished = 5 - Skipped = 6 - Failed = 7 - Starting = 8 - Waiting = 9 - Downloading = 10 - TempOffline = 11 - Aborted = 12 - Decrypting = 13 - Processing = 14 - Custom = 15 - Unknown = 16 - - _VALUES_TO_NAMES = { - 0: "NA", - 1: "Offline", - 2: "Online", - 3: "Queued", - 4: "Paused", - 5: "Finished", - 6: "Skipped", - 7: "Failed", - 8: "Starting", - 9: "Waiting", - 10: "Downloading", - 11: "TempOffline", - 12: "Aborted", - 13: "Decrypting", - 14: "Processing", - 15: "Custom", - 16: "Unknown", - } - - _NAMES_TO_VALUES = { - "NA": 0, - "Offline": 1, - "Online": 2, - "Queued": 3, - "Paused": 4, - "Finished": 5, - "Skipped": 6, - "Failed": 7, - "Starting": 8, - "Waiting": 9, - "Downloading": 10, - "TempOffline": 11, - "Aborted": 12, - "Decrypting": 13, - "Processing": 14, - "Custom": 15, - "Unknown": 16, - } - -class MediaType(TBase): - All = 0 - Other = 1 - Audio = 2 - Image = 4 - Video = 8 - Document = 16 - Archive = 32 - - _VALUES_TO_NAMES = { - 0: "All", - 1: "Other", - 2: "Audio", - 4: "Image", - 8: "Video", - 16: "Document", - 32: "Archive", - } - - _NAMES_TO_VALUES = { - "All": 0, - "Other": 1, - "Audio": 2, - "Image": 4, - "Video": 8, - "Document": 16, - "Archive": 32, - } - -class FileStatus(TBase): - Ok = 0 - Missing = 1 - Remote = 2 - - _VALUES_TO_NAMES = { - 0: "Ok", - 1: "Missing", - 2: "Remote", - } - - _NAMES_TO_VALUES = { - "Ok": 0, - "Missing": 1, - "Remote": 2, - } - -class PackageStatus(TBase): - Ok = 0 - Paused = 1 - Folder = 2 - Remote = 3 - - _VALUES_TO_NAMES = { - 0: "Ok", - 1: "Paused", - 2: "Folder", - 3: "Remote", - } - - _NAMES_TO_VALUES = { - "Ok": 0, - "Paused": 1, - "Folder": 2, - "Remote": 3, - } - -class Input(TBase): - NA = 0 - Text = 1 - Textbox = 2 - Password = 3 - Bool = 4 - Click = 5 - Select = 6 - Multiple = 7 - List = 8 - Table = 9 - - _VALUES_TO_NAMES = { - 0: "NA", - 1: "Text", - 2: "Textbox", - 3: "Password", - 4: "Bool", - 5: "Click", - 6: "Select", - 7: "Multiple", - 8: "List", - 9: "Table", - } - - _NAMES_TO_VALUES = { - "NA": 0, - "Text": 1, - "Textbox": 2, - "Password": 3, - "Bool": 4, - "Click": 5, - "Select": 6, - "Multiple": 7, - "List": 8, - "Table": 9, - } - -class Output(TBase): - All = 0 - Notification = 1 - Captcha = 2 - Query = 4 - - _VALUES_TO_NAMES = { - 0: "All", - 1: "Notification", - 2: "Captcha", - 4: "Query", - } - - _NAMES_TO_VALUES = { - "All": 0, - "Notification": 1, - "Captcha": 2, - "Query": 4, - } - -class Permission(TBase): - All = 0 - Add = 1 - Delete = 2 - Modify = 4 - Download = 8 - Accounts = 16 - Interaction = 32 - Plugins = 64 - - _VALUES_TO_NAMES = { - 0: "All", - 1: "Add", - 2: "Delete", - 4: "Modify", - 8: "Download", - 16: "Accounts", - 32: "Interaction", - 64: "Plugins", - } - - _NAMES_TO_VALUES = { - "All": 0, - "Add": 1, - "Delete": 2, - "Modify": 4, - "Download": 8, - "Accounts": 16, - "Interaction": 32, - "Plugins": 64, - } - -class Role(TBase): - Admin = 0 - User = 1 - - _VALUES_TO_NAMES = { - 0: "Admin", - 1: "User", - } - - _NAMES_TO_VALUES = { - "Admin": 0, - "User": 1, - } - - -class DownloadProgress(TBase): - """ - Attributes: - - fid - - pid - - speed - - status - """ - - __slots__ = [ - 'fid', - 'pid', - 'speed', - 'status', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - (2, TType.I32, 'pid', None, None, ), # 2 - (3, TType.I64, 'speed', None, None, ), # 3 - (4, TType.I32, 'status', None, None, ), # 4 - ) - - def __init__(self, fid=None, pid=None, speed=None, status=None,): - self.fid = fid - self.pid = pid - self.speed = speed - self.status = status - - -class ProgressInfo(TBase): - """ - Attributes: - - plugin - - name - - statusmsg - - eta - - format_eta - - done - - total - - download - """ - - __slots__ = [ - 'plugin', - 'name', - 'statusmsg', - 'eta', - 'format_eta', - 'done', - 'total', - 'download', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 - (3, TType.STRING, 'statusmsg', None, None, ), # 3 - (4, TType.I32, 'eta', None, None, ), # 4 - (5, TType.STRING, 'format_eta', None, None, ), # 5 - (6, TType.I64, 'done', None, None, ), # 6 - (7, TType.I64, 'total', None, None, ), # 7 - (8, TType.STRUCT, 'download', (DownloadProgress, DownloadProgress.thrift_spec), None, ), # 8 - ) - - def __init__(self, plugin=None, name=None, statusmsg=None, eta=None, format_eta=None, done=None, total=None, download=None,): - self.plugin = plugin - self.name = name - self.statusmsg = statusmsg - self.eta = eta - self.format_eta = format_eta - self.done = done - self.total = total - self.download = download - - -class ServerStatus(TBase): - """ - Attributes: - - pause - - active - - queue - - total - - speed - - download - - reconnect - """ - - __slots__ = [ - 'pause', - 'active', - 'queue', - 'total', - 'speed', - 'download', - 'reconnect', - ] - - thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'pause', None, None, ), # 1 - (2, TType.I16, 'active', None, None, ), # 2 - (3, TType.I16, 'queue', None, None, ), # 3 - (4, TType.I16, 'total', None, None, ), # 4 - (5, TType.I64, 'speed', None, None, ), # 5 - (6, TType.BOOL, 'download', None, None, ), # 6 - (7, TType.BOOL, 'reconnect', None, None, ), # 7 - ) - - def __init__(self, pause=None, active=None, queue=None, total=None, speed=None, download=None, reconnect=None,): - self.pause = pause - self.active = active - self.queue = queue - self.total = total - self.speed = speed - self.download = download - self.reconnect = reconnect - - -class DownloadInfo(TBase): - """ - Attributes: - - url - - plugin - - hash - - status - - statusmsg - - error - """ - - __slots__ = [ - 'url', - 'plugin', - 'hash', - 'status', - 'statusmsg', - 'error', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'url', None, None, ), # 1 - (2, TType.STRING, 'plugin', None, None, ), # 2 - (3, TType.STRING, 'hash', None, None, ), # 3 - (4, TType.I32, 'status', None, None, ), # 4 - (5, TType.STRING, 'statusmsg', None, None, ), # 5 - (6, TType.STRING, 'error', None, None, ), # 6 - ) - - def __init__(self, url=None, plugin=None, hash=None, status=None, statusmsg=None, error=None,): - self.url = url - self.plugin = plugin - self.hash = hash - self.status = status - self.statusmsg = statusmsg - self.error = error - - -class FileInfo(TBase): - """ - Attributes: - - fid - - name - - package - - owner - - size - - status - - media - - added - - fileorder - - download - """ - - __slots__ = [ - 'fid', - 'name', - 'package', - 'owner', - 'size', - 'status', - 'media', - 'added', - 'fileorder', - 'download', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 - (3, TType.I32, 'package', None, None, ), # 3 - (4, TType.I32, 'owner', None, None, ), # 4 - (5, TType.I64, 'size', None, None, ), # 5 - (6, TType.I32, 'status', None, None, ), # 6 - (7, TType.I32, 'media', None, None, ), # 7 - (8, TType.I64, 'added', None, None, ), # 8 - (9, TType.I16, 'fileorder', None, None, ), # 9 - (10, TType.STRUCT, 'download', (DownloadInfo, DownloadInfo.thrift_spec), None, ), # 10 - ) - - def __init__(self, fid=None, name=None, package=None, owner=None, size=None, status=None, media=None, added=None, fileorder=None, download=None,): - self.fid = fid - self.name = name - self.package = package - self.owner = owner - self.size = size - self.status = status - self.media = media - self.added = added - self.fileorder = fileorder - self.download = download - - -class PackageStats(TBase): - """ - Attributes: - - linkstotal - - linksdone - - sizetotal - - sizedone - """ - - __slots__ = [ - 'linkstotal', - 'linksdone', - 'sizetotal', - 'sizedone', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I16, 'linkstotal', None, None, ), # 1 - (2, TType.I16, 'linksdone', None, None, ), # 2 - (3, TType.I64, 'sizetotal', None, None, ), # 3 - (4, TType.I64, 'sizedone', None, None, ), # 4 - ) - - def __init__(self, linkstotal=None, linksdone=None, sizetotal=None, sizedone=None,): - self.linkstotal = linkstotal - self.linksdone = linksdone - self.sizetotal = sizetotal - self.sizedone = sizedone - - -class PackageInfo(TBase): - """ - Attributes: - - pid - - name - - folder - - root - - owner - - site - - comment - - password - - added - - status - - packageorder - - stats - - fids - - pids - """ - - __slots__ = [ - 'pid', - 'name', - 'folder', - 'root', - 'owner', - 'site', - 'comment', - 'password', - 'added', - 'status', - 'packageorder', - 'stats', - 'fids', - 'pids', - ] - - 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.I32, 'root', None, None, ), # 4 - (5, TType.I32, 'owner', None, None, ), # 5 - (6, TType.STRING, 'site', None, None, ), # 6 - (7, TType.STRING, 'comment', None, None, ), # 7 - (8, TType.STRING, 'password', None, None, ), # 8 - (9, TType.I64, 'added', None, None, ), # 9 - (10, TType.I32, 'status', None, None, ), # 10 - (11, TType.I16, 'packageorder', None, None, ), # 11 - (12, TType.STRUCT, 'stats', (PackageStats, PackageStats.thrift_spec), None, ), # 12 - (13, TType.LIST, 'fids', (TType.I32,None), None, ), # 13 - (14, TType.LIST, 'pids', (TType.I32,None), None, ), # 14 - ) - - def __init__(self, pid=None, name=None, folder=None, root=None, owner=None, site=None, comment=None, password=None, added=None, status=None, packageorder=None, stats=None, fids=None, pids=None,): - self.pid = pid - self.name = name - self.folder = folder - self.root = root - self.owner = owner - self.site = site - self.comment = comment - self.password = password - self.added = added - self.status = status - self.packageorder = packageorder - self.stats = stats - self.fids = fids - self.pids = pids - - -class TreeCollection(TBase): - """ - Attributes: - - root - - files - - packages - """ - - __slots__ = [ - 'root', - 'files', - 'packages', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'root', (PackageInfo, PackageInfo.thrift_spec), None, ), # 1 - (2, TType.MAP, 'files', (TType.I32,None,TType.STRUCT,(FileInfo, FileInfo.thrift_spec)), None, ), # 2 - (3, TType.MAP, 'packages', (TType.I32,None,TType.STRUCT,(PackageInfo, PackageInfo.thrift_spec)), None, ), # 3 - ) - - def __init__(self, root=None, files=None, packages=None,): - self.root = root - self.files = files - self.packages = packages - - -class LinkStatus(TBase): - """ - Attributes: - - url - - name - - plugin - - size - - status - - packagename - """ - - __slots__ = [ - 'url', - 'name', - 'plugin', - 'size', - 'status', - 'packagename', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'url', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 - (3, TType.STRING, 'plugin', None, None, ), # 3 - (4, TType.I64, 'size', None, None, ), # 4 - (5, TType.I32, 'status', None, None, ), # 5 - (6, TType.STRING, 'packagename', None, None, ), # 6 - ) - - def __init__(self, url=None, name=None, plugin=None, size=None, status=None, packagename=None,): - self.url = url - self.name = name - self.plugin = plugin - self.size = size - self.status = status - self.packagename = packagename - - -class InteractionTask(TBase): - """ - Attributes: - - iid - - input - - data - - output - - default_value - - title - - description - - plugin - """ - - __slots__ = [ - 'iid', - 'input', - 'data', - 'output', - 'default_value', - 'title', - 'description', - 'plugin', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'iid', None, None, ), # 1 - (2, TType.I32, 'input', None, None, ), # 2 - (3, TType.LIST, 'data', (TType.STRING,None), None, ), # 3 - (4, TType.I32, 'output', None, None, ), # 4 - (5, TType.STRING, 'default_value', None, None, ), # 5 - (6, TType.STRING, 'title', None, None, ), # 6 - (7, TType.STRING, 'description', None, None, ), # 7 - (8, TType.STRING, 'plugin', None, None, ), # 8 - ) - - def __init__(self, iid=None, input=None, data=None, output=None, default_value=None, title=None, description=None, plugin=None,): - self.iid = iid - self.input = input - self.data = data - self.output = output - self.default_value = default_value - self.title = title - self.description = description - self.plugin = plugin - - -class AddonService(TBase): - """ - Attributes: - - func_name - - description - - arguments - - media - """ - - __slots__ = [ - 'func_name', - 'description', - 'arguments', - 'media', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'func_name', None, None, ), # 1 - (2, TType.STRING, 'description', None, None, ), # 2 - (3, TType.LIST, 'arguments', (TType.STRING,None), None, ), # 3 - (4, TType.I16, 'media', None, None, ), # 4 - ) - - def __init__(self, func_name=None, description=None, arguments=None, media=None,): - self.func_name = func_name - self.description = description - self.arguments = arguments - self.media = media - - -class AddonInfo(TBase): - """ - Attributes: - - func_name - - description - - value - """ - - __slots__ = [ - 'func_name', - 'description', - 'value', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'func_name', None, None, ), # 1 - (2, TType.STRING, 'description', None, None, ), # 2 - (3, TType.STRING, 'value', None, None, ), # 3 - ) - - def __init__(self, func_name=None, description=None, value=None,): - self.func_name = func_name - self.description = description - self.value = value - - -class ConfigItem(TBase): - """ - Attributes: - - name - - label - - description - - type - - default_value - - value - """ - - __slots__ = [ - 'name', - 'label', - 'description', - 'type', - 'default_value', - 'value', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'label', None, None, ), # 2 - (3, TType.STRING, 'description', None, None, ), # 3 - (4, TType.STRING, 'type', None, None, ), # 4 - (5, TType.STRING, 'default_value', None, None, ), # 5 - (6, TType.STRING, 'value', None, None, ), # 6 - ) - - def __init__(self, name=None, label=None, description=None, type=None, default_value=None, value=None,): - self.name = name - self.label = label - self.description = description - self.type = type - self.default_value = default_value - self.value = value - - -class ConfigHolder(TBase): - """ - Attributes: - - name - - label - - description - - long_description - - items - - info - - handler - """ - - __slots__ = [ - 'name', - 'label', - 'description', - 'long_description', - 'items', - 'info', - 'handler', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'label', None, None, ), # 2 - (3, TType.STRING, 'description', None, None, ), # 3 - (4, TType.STRING, 'long_description', None, None, ), # 4 - (5, TType.LIST, 'items', (TType.STRUCT,(ConfigItem, ConfigItem.thrift_spec)), None, ), # 5 - (6, TType.LIST, 'info', (TType.STRUCT,(AddonInfo, AddonInfo.thrift_spec)), None, ), # 6 - (7, TType.LIST, 'handler', (TType.STRUCT,(InteractionTask, InteractionTask.thrift_spec)), None, ), # 7 - ) - - def __init__(self, name=None, label=None, description=None, long_description=None, items=None, info=None, handler=None,): - self.name = name - self.label = label - self.description = description - self.long_description = long_description - self.items = items - self.info = info - self.handler = handler - - -class ConfigInfo(TBase): - """ - Attributes: - - name - - label - - description - - saved - - activated - """ - - __slots__ = [ - 'name', - 'label', - 'description', - 'saved', - 'activated', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None, ), # 1 - (2, TType.STRING, 'label', None, None, ), # 2 - (3, TType.STRING, 'description', None, None, ), # 3 - (4, TType.BOOL, 'saved', None, None, ), # 4 - (5, TType.BOOL, 'activated', None, None, ), # 5 - ) - - def __init__(self, name=None, label=None, description=None, saved=None, activated=None,): - self.name = name - self.label = label - self.description = description - self.saved = saved - self.activated = activated - - -class EventInfo(TBase): - """ - Attributes: - - eventname - - event_args - """ - - __slots__ = [ - 'eventname', - 'event_args', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'eventname', None, None, ), # 1 - (2, TType.LIST, 'event_args', (TType.STRING,None), None, ), # 2 - ) - - def __init__(self, eventname=None, event_args=None,): - self.eventname = eventname - self.event_args = event_args - - -class UserData(TBase): - """ - Attributes: - - uid - - name - - email - - role - - permission - - folder - - traffic - - dllimit - - dlquota - - hddquota - - user - - templateName - """ - - __slots__ = [ - 'uid', - 'name', - 'email', - 'role', - 'permission', - 'folder', - 'traffic', - 'dllimit', - 'dlquota', - 'hddquota', - 'user', - 'templateName', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'uid', None, None, ), # 1 - (2, TType.STRING, 'name', None, None, ), # 2 - (3, TType.STRING, 'email', None, None, ), # 3 - (4, TType.I16, 'role', None, None, ), # 4 - (5, TType.I16, 'permission', None, None, ), # 5 - (6, TType.STRING, 'folder', None, None, ), # 6 - (7, TType.I64, 'traffic', None, None, ), # 7 - (8, TType.I16, 'dllimit', None, None, ), # 8 - (9, TType.STRING, 'dlquota', None, None, ), # 9 - (10, TType.I64, 'hddquota', None, None, ), # 10 - (11, TType.I32, 'user', None, None, ), # 11 - (12, TType.STRING, 'templateName', None, None, ), # 12 - ) - - def __init__(self, uid=None, name=None, email=None, role=None, permission=None, folder=None, traffic=None, dllimit=None, dlquota=None, hddquota=None, user=None, templateName=None,): - self.uid = uid - self.name = name - self.email = email - self.role = role - self.permission = permission - self.folder = folder - self.traffic = traffic - self.dllimit = dllimit - self.dlquota = dlquota - self.hddquota = hddquota - self.user = user - self.templateName = templateName - - -class AccountInfo(TBase): - """ - Attributes: - - plugin - - loginname - - owner - - valid - - validuntil - - trafficleft - - maxtraffic - - premium - - activated - - shared - - options - """ - - __slots__ = [ - 'plugin', - 'loginname', - 'owner', - 'valid', - 'validuntil', - 'trafficleft', - 'maxtraffic', - 'premium', - 'activated', - 'shared', - 'options', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'loginname', None, None, ), # 2 - (3, TType.I32, 'owner', None, None, ), # 3 - (4, TType.BOOL, 'valid', None, None, ), # 4 - (5, TType.I64, 'validuntil', None, None, ), # 5 - (6, TType.I64, 'trafficleft', None, None, ), # 6 - (7, TType.I64, 'maxtraffic', None, None, ), # 7 - (8, TType.BOOL, 'premium', None, None, ), # 8 - (9, TType.BOOL, 'activated', None, None, ), # 9 - (10, TType.BOOL, 'shared', None, None, ), # 10 - (11, TType.MAP, 'options', (TType.STRING,None,TType.STRING,None), None, ), # 11 - ) - - def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, options=None,): - self.plugin = plugin - self.loginname = loginname - self.owner = owner - self.valid = valid - self.validuntil = validuntil - self.trafficleft = trafficleft - self.maxtraffic = maxtraffic - self.premium = premium - self.activated = activated - self.shared = shared - self.options = options - - -class OnlineCheck(TBase): - """ - Attributes: - - rid - - data - """ - - __slots__ = [ - 'rid', - 'data', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'rid', None, None, ), # 1 - (2, TType.MAP, 'data', (TType.STRING,None,TType.STRUCT,(LinkStatus, LinkStatus.thrift_spec)), None, ), # 2 - ) - - def __init__(self, rid=None, data=None,): - self.rid = rid - self.data = data - - -class PackageDoesNotExists(TExceptionBase): - """ - Attributes: - - pid - """ - - __slots__ = [ - 'pid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - ) - - def __init__(self, pid=None,): - self.pid = pid - - def __str__(self): - return repr(self) - - -class FileDoesNotExists(TExceptionBase): - """ - Attributes: - - fid - """ - - __slots__ = [ - 'fid', - ] - - thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None, ), # 1 - ) - - def __init__(self, fid=None,): - self.fid = fid - - def __str__(self): - return repr(self) - - -class UserDoesNotExists(TExceptionBase): - """ - Attributes: - - user - """ - - __slots__ = [ - 'user', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'user', None, None, ), # 1 - ) - - def __init__(self, user=None,): - self.user = user - - def __str__(self): - return repr(self) - - -class ServiceDoesNotExists(TExceptionBase): - """ - Attributes: - - plugin - - func - """ - - __slots__ = [ - 'plugin', - 'func', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None, ), # 1 - (2, TType.STRING, 'func', None, None, ), # 2 - ) - - def __init__(self, plugin=None, func=None,): - self.plugin = plugin - self.func = func - - def __str__(self): - return repr(self) - - -class ServiceException(TExceptionBase): - """ - Attributes: - - msg - """ - - __slots__ = [ - 'msg', - ] - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'msg', None, None, ), # 1 - ) - - def __init__(self, msg=None,): - self.msg = msg - - def __str__(self): - return repr(self) - diff --git a/module/remote/ttypes.py b/module/remote/ttypes.py new file mode 100644 index 000000000..06f051fc7 --- /dev/null +++ b/module/remote/ttypes.py @@ -0,0 +1,503 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Autogenerated by pyload +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + +class BaseObject(object): + __slots__ = [] + +class DownloadStatus: + Aborted = 12 + Custom = 15 + Decrypting = 13 + Downloading = 10 + Failed = 7 + Finished = 5 + NA = 0 + Offline = 1 + Online = 2 + Paused = 4 + Processing = 14 + Queued = 3 + Skipped = 6 + Starting = 8 + TempOffline = 11 + Unknown = 16 + Waiting = 9 + +class FileStatus: + Missing = 1 + Ok = 0 + Remote = 2 + +class Input: + Bool = 4 + Click = 5 + List = 8 + Multiple = 7 + NA = 0 + Password = 3 + Select = 6 + Table = 9 + Text = 1 + Textbox = 2 + +class MediaType: + All = 0 + Archive = 32 + Audio = 2 + Document = 16 + Image = 4 + Other = 1 + Video = 8 + +class Output: + All = 0 + Captcha = 2 + Notification = 1 + Query = 4 + +class PackageStatus: + Folder = 2 + Ok = 0 + Paused = 1 + Remote = 3 + +class Permission: + Accounts = 16 + Add = 1 + All = 0 + Delete = 2 + Download = 8 + Interaction = 32 + Modify = 4 + Plugins = 64 + +class Role: + Admin = 0 + User = 1 + +class AccountInfo(BaseObject): + __slots__ = ['plugin', 'loginname', 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'shared', 'options'] + + def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, options=None): + self.plugin = plugin + self.loginname = loginname + self.owner = owner + self.valid = valid + self.validuntil = validuntil + self.trafficleft = trafficleft + self.maxtraffic = maxtraffic + self.premium = premium + self.activated = activated + self.shared = shared + self.options = options + +class AddonInfo(BaseObject): + __slots__ = ['func_name', 'description', 'value'] + + def __init__(self, func_name=None, description=None, value=None): + self.func_name = func_name + self.description = description + self.value = value + +class AddonService(BaseObject): + __slots__ = ['func_name', 'description', 'arguments', 'media'] + + def __init__(self, func_name=None, description=None, arguments=None, media=None): + self.func_name = func_name + self.description = description + self.arguments = arguments + self.media = media + +class ConfigHolder(BaseObject): + __slots__ = ['name', 'label', 'description', 'long_description', 'items', 'info', 'handler'] + + def __init__(self, name=None, label=None, description=None, long_description=None, items=None, info=None, handler=None): + self.name = name + self.label = label + self.description = description + self.long_description = long_description + self.items = items + self.info = info + self.handler = handler + +class ConfigInfo(BaseObject): + __slots__ = ['name', 'label', 'description', 'saved', 'activated'] + + def __init__(self, name=None, label=None, description=None, saved=None, activated=None): + self.name = name + self.label = label + self.description = description + self.saved = saved + self.activated = activated + +class ConfigItem(BaseObject): + __slots__ = ['name', 'label', 'description', 'type', 'default_value', 'value'] + + def __init__(self, name=None, label=None, description=None, type=None, default_value=None, value=None): + self.name = name + self.label = label + self.description = description + self.type = type + self.default_value = default_value + self.value = value + +class DownloadInfo(BaseObject): + __slots__ = ['url', 'plugin', 'hash', 'status', 'statusmsg', 'error'] + + def __init__(self, url=None, plugin=None, hash=None, status=None, statusmsg=None, error=None): + self.url = url + self.plugin = plugin + self.hash = hash + self.status = status + self.statusmsg = statusmsg + self.error = error + +class DownloadProgress(BaseObject): + __slots__ = ['fid', 'pid', 'speed', 'status'] + + def __init__(self, fid=None, pid=None, speed=None, status=None): + self.fid = fid + self.pid = pid + self.speed = speed + self.status = status + +class EventInfo(BaseObject): + __slots__ = ['eventname', 'event_args'] + + def __init__(self, eventname=None, event_args=None): + self.eventname = eventname + self.event_args = event_args + +class FileDoesNotExists(Exception): + __slots__ = ['fid'] + + def __init__(self, fid=None): + self.fid = fid + +class FileInfo(BaseObject): + __slots__ = ['fid', 'name', 'package', 'owner', 'size', 'status', 'media', 'added', 'fileorder', 'download'] + + def __init__(self, fid=None, name=None, package=None, owner=None, size=None, status=None, media=None, added=None, fileorder=None, download=None): + self.fid = fid + self.name = name + self.package = package + self.owner = owner + self.size = size + self.status = status + self.media = media + self.added = added + self.fileorder = fileorder + self.download = download + +class InteractionTask(BaseObject): + __slots__ = ['iid', 'input', 'data', 'output', 'default_value', 'title', 'description', 'plugin'] + + def __init__(self, iid=None, input=None, data=None, output=None, default_value=None, title=None, description=None, plugin=None): + self.iid = iid + self.input = input + self.data = data + self.output = output + self.default_value = default_value + self.title = title + self.description = description + self.plugin = plugin + +class LinkStatus(BaseObject): + __slots__ = ['url', 'name', 'plugin', 'size', 'status', 'packagename'] + + def __init__(self, url=None, name=None, plugin=None, size=None, status=None, packagename=None): + self.url = url + self.name = name + self.plugin = plugin + self.size = size + self.status = status + self.packagename = packagename + +class OnlineCheck(BaseObject): + __slots__ = ['rid', 'data'] + + def __init__(self, rid=None, data=None): + self.rid = rid + self.data = data + +class PackageDoesNotExists(Exception): + __slots__ = ['pid'] + + def __init__(self, pid=None): + self.pid = pid + +class PackageInfo(BaseObject): + __slots__ = ['pid', 'name', 'folder', 'root', 'owner', 'site', 'comment', 'password', 'added', 'status', 'packageorder', 'stats', 'fids', 'pids'] + + def __init__(self, pid=None, name=None, folder=None, root=None, owner=None, site=None, comment=None, password=None, added=None, status=None, packageorder=None, stats=None, fids=None, pids=None): + self.pid = pid + self.name = name + self.folder = folder + self.root = root + self.owner = owner + self.site = site + self.comment = comment + self.password = password + self.added = added + self.status = status + self.packageorder = packageorder + self.stats = stats + self.fids = fids + self.pids = pids + +class PackageStats(BaseObject): + __slots__ = ['linkstotal', 'linksdone', 'sizetotal', 'sizedone'] + + def __init__(self, linkstotal=None, linksdone=None, sizetotal=None, sizedone=None): + self.linkstotal = linkstotal + self.linksdone = linksdone + self.sizetotal = sizetotal + self.sizedone = sizedone + +class ProgressInfo(BaseObject): + __slots__ = ['plugin', 'name', 'statusmsg', 'eta', 'format_eta', 'done', 'total', 'download'] + + def __init__(self, plugin=None, name=None, statusmsg=None, eta=None, format_eta=None, done=None, total=None, download=None): + self.plugin = plugin + self.name = name + self.statusmsg = statusmsg + self.eta = eta + self.format_eta = format_eta + self.done = done + self.total = total + self.download = download + +class ServerStatus(BaseObject): + __slots__ = ['pause', 'active', 'queue', 'total', 'speed', 'download', 'reconnect'] + + def __init__(self, pause=None, active=None, queue=None, total=None, speed=None, download=None, reconnect=None): + self.pause = pause + self.active = active + self.queue = queue + self.total = total + self.speed = speed + self.download = download + self.reconnect = reconnect + +class ServiceDoesNotExists(Exception): + __slots__ = ['plugin', 'func'] + + def __init__(self, plugin=None, func=None): + self.plugin = plugin + self.func = func + +class ServiceException(Exception): + __slots__ = ['msg'] + + def __init__(self, msg=None): + self.msg = msg + +class TreeCollection(BaseObject): + __slots__ = ['root', 'files', 'packages'] + + def __init__(self, root=None, files=None, packages=None): + self.root = root + self.files = files + self.packages = packages + +class UserData(BaseObject): + __slots__ = ['uid', 'name', 'email', 'role', 'permission', 'folder', 'traffic', 'dllimit', 'dlquota', 'hddquota', 'user', 'templateName'] + + def __init__(self, uid=None, name=None, email=None, role=None, permission=None, folder=None, traffic=None, dllimit=None, dlquota=None, hddquota=None, user=None, templateName=None): + self.uid = uid + self.name = name + self.email = email + self.role = role + self.permission = permission + self.folder = folder + self.traffic = traffic + self.dllimit = dllimit + self.dlquota = dlquota + self.hddquota = hddquota + self.user = user + self.templateName = templateName + +class UserDoesNotExists(Exception): + __slots__ = ['user'] + + def __init__(self, user=None): + self.user = user + +class Iface(object): + def addFromCollector(self, name, paused): + pass + def addLinks(self, pid, links): + pass + def addLocalFile(self, pid, name, path): + pass + def addPackage(self, name, links, password): + pass + def addPackageChild(self, name, links, password, root, paused): + pass + def addPackageP(self, name, links, password, paused): + pass + def addToCollector(self, links): + pass + def addUser(self, username, password): + pass + def callAddon(self, plugin, func, arguments): + pass + def callAddonHandler(self, plugin, func, pid_or_fid): + pass + def checkOnlineStatus(self, urls): + pass + def checkOnlineStatusContainer(self, urls, filename, data): + pass + def checkURLs(self, urls): + pass + def configurePlugin(self, plugin): + pass + def createPackage(self, name, folder, root, password, site, comment, paused): + pass + def deleteCollLink(self, url): + pass + def deleteCollPack(self, name): + pass + def deleteConfig(self, plugin): + pass + def deleteFiles(self, fids): + pass + def deletePackages(self, pids): + pass + def findFiles(self, pattern): + pass + def freeSpace(self): + pass + def generateAndAddPackages(self, links, paused): + pass + def generateDownloadLink(self, fid, timeout): + pass + def generatePackages(self, links): + pass + def getAccountTypes(self): + pass + def getAccounts(self, refresh): + pass + def getAddonHandler(self): + pass + def getAllFiles(self): + pass + def getAllInfo(self): + pass + def getAllUnfinishedFiles(self): + pass + def getAllUserData(self): + pass + def getCollector(self): + pass + def getConfig(self): + pass + def getEvents(self, uuid): + pass + def getFileInfo(self, fid): + pass + def getFileTree(self, pid, full): + pass + def getGlobalPlugins(self): + pass + def getInfoByPlugin(self, plugin): + pass + def getInteractionTask(self, mode): + pass + def getLog(self, offset): + pass + def getNotifications(self): + pass + def getPackageContent(self, pid): + pass + def getPackageInfo(self, pid): + pass + def getProgressInfo(self): + pass + def getServerVersion(self): + pass + def getUnfinishedFileTree(self, pid, full): + pass + def getUserData(self): + pass + def getUserPlugins(self): + pass + def hasAddonHandler(self, plugin, func): + pass + def isInteractionWaiting(self, mode): + pass + def isTimeDownload(self): + pass + def isTimeReconnect(self): + pass + def kill(self): + pass + def login(self, username, password): + pass + def moveFiles(self, fids, pid): + pass + def movePackage(self, pid, root): + pass + def orderFiles(self, fids, pid, position): + pass + def orderPackage(self, pids, position): + pass + def parseURLs(self, html, url): + pass + def pauseServer(self): + pass + def pollResults(self, rid): + pass + def recheckPackage(self, pid): + pass + def removeAccount(self, plugin, account): + pass + def removeUser(self, uid): + pass + def renameCollPack(self, name, new_name): + pass + def restart(self): + pass + def restartFailed(self): + pass + def restartFile(self, fid): + pass + def restartPackage(self, pid): + pass + def saveConfig(self, config): + pass + def setConfigHandler(self, plugin, iid, value): + pass + def setInteractionResult(self, iid, result): + pass + def setPackageData(self, pid, data): + pass + def setPackageFolder(self, pid, path): + pass + def setPackagePaused(self, pid, paused): + pass + def setPassword(self, username, old_password, new_password): + pass + def statusServer(self): + pass + def stopAllDownloads(self): + pass + def stopDownloads(self, fids): + pass + def togglePause(self): + pass + def toggleReconnect(self): + pass + def unpauseServer(self): + pass + def updateAccount(self, plugin, account, password): + pass + def updateAccountInfo(self, account): + pass + def updateUserData(self, data): + pass + def uploadContainer(self, filename, data): + pass + diff --git a/module/remote/wsbackend/Dispatcher.py b/module/remote/wsbackend/Dispatcher.py new file mode 100644 index 000000000..eb1c9a291 --- /dev/null +++ b/module/remote/wsbackend/Dispatcher.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +############################################################################### +# Copyright(c) 2008-2012 pyLoad Team +# http://www.pyload.org +# +# This file is part of pyLoad. +# pyLoad is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Subjected to the terms and conditions in LICENSE +# +# @author: RaNaN +############################################################################### + +from mod_pywebsocket import util +from mod_pywebsocket.dispatch import Dispatcher as BaseDispatcher +from mod_pywebsocket.msgutil import receive_message, send_message + +class Dispatcher(BaseDispatcher): + + def __init__(self): + self._logger = util.get_class_logger(self) + + self._handler_suite_map = {} + self._source_warnings = [] + + def addHandler(self, path, handler): + self._handler_suite_map[path] = handler + + + +class ApiHandler: + + def do_extra_handshake(self, req): + pass + + def transfer_data(self, req): + + while True: + try: + line = receive_message(req) + except TypeError: # connection closed + return + + print "Got", line + send_message(req, "You send: %s" % line) + + def passive_closing_handshake(self, req): + print "Closed", req \ No newline at end of file diff --git a/module/remote/wsbackend/Server.py b/module/remote/wsbackend/Server.py new file mode 100644 index 000000000..570753073 --- /dev/null +++ b/module/remote/wsbackend/Server.py @@ -0,0 +1,670 @@ +#!/usr/bin/env python +# +# Copyright 2012, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# A copy of standalone.py with uneeded stuff removed +# some logging methods removed + +import BaseHTTPServer +import CGIHTTPServer +import SocketServer +import httplib +import logging +import os +import re +import select +import socket +import sys +import threading + +_HAS_SSL = False +_HAS_OPEN_SSL = False + +from mod_pywebsocket import common +from mod_pywebsocket import dispatch +from mod_pywebsocket import handshake +from mod_pywebsocket import http_header_util +from mod_pywebsocket import memorizingfile +from mod_pywebsocket import util + + +_DEFAULT_REQUEST_QUEUE_SIZE = 128 + +# 1024 is practically large enough to contain WebSocket handshake lines. +_MAX_MEMORIZED_LINES = 1024 + +def import_ssl(): + global _HAS_SSL, _HAS_OPEN_SSL + try: + import ssl + _HAS_SSL = True + except ImportError: + try: + import OpenSSL.SSL + _HAS_OPEN_SSL = True + except ImportError: + pass + + +class _StandaloneConnection(object): + """Mimic mod_python mp_conn.""" + + def __init__(self, request_handler): + """Construct an instance. + + Args: + request_handler: A WebSocketRequestHandler instance. + """ + + self._request_handler = request_handler + + def get_local_addr(self): + """Getter to mimic mp_conn.local_addr.""" + + return (self._request_handler.server.server_name, + self._request_handler.server.server_port) + local_addr = property(get_local_addr) + + def get_remote_addr(self): + """Getter to mimic mp_conn.remote_addr. + + Setting the property in __init__ won't work because the request + handler is not initialized yet there.""" + + return self._request_handler.client_address + remote_addr = property(get_remote_addr) + + def write(self, data): + """Mimic mp_conn.write().""" + + return self._request_handler.wfile.write(data) + + def read(self, length): + """Mimic mp_conn.read().""" + + return self._request_handler.rfile.read(length) + + def get_memorized_lines(self): + """Get memorized lines.""" + + return self._request_handler.rfile.get_memorized_lines() + + +class _StandaloneRequest(object): + """Mimic mod_python request.""" + + def __init__(self, request_handler, use_tls): + """Construct an instance. + + Args: + request_handler: A WebSocketRequestHandler instance. + """ + + self._logger = logging.getLogger("log") + + self._request_handler = request_handler + self.connection = _StandaloneConnection(request_handler) + self._use_tls = use_tls + self.headers_in = request_handler.headers + + def get_uri(self): + """Getter to mimic request.uri.""" + + return self._request_handler.path + uri = property(get_uri) + + def get_method(self): + """Getter to mimic request.method.""" + + return self._request_handler.command + method = property(get_method) + + def is_https(self): + """Mimic request.is_https().""" + + return self._use_tls + + def _drain_received_data(self): + """Don't use this method from WebSocket handler. Drains unread data + in the receive buffer. + """ + + raw_socket = self._request_handler.connection + drained_data = util.drain_received_data(raw_socket) + + if drained_data: + self._logger.debug( + 'Drained data following close frame: %r', drained_data) + + +class _StandaloneSSLConnection(object): + """A wrapper class for OpenSSL.SSL.Connection to provide makefile method + which is not supported by the class. + """ + + def __init__(self, connection): + self._connection = connection + + def __getattribute__(self, name): + if name in ('_connection', 'makefile'): + return object.__getattribute__(self, name) + return self._connection.__getattribute__(name) + + def __setattr__(self, name, value): + if name in ('_connection', 'makefile'): + return object.__setattr__(self, name, value) + return self._connection.__setattr__(name, value) + + def makefile(self, mode='r', bufsize=-1): + return socket._fileobject(self._connection, mode, bufsize) + + +class WebSocketServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): + """HTTPServer specialized for WebSocket.""" + + # Overrides SocketServer.ThreadingMixIn.daemon_threads + daemon_threads = True + # Overrides BaseHTTPServer.HTTPServer.allow_reuse_address + allow_reuse_address = True + + def __init__(self, options): + """Override SocketServer.TCPServer.__init__ to set SSL enabled + socket object to self.socket before server_bind and server_activate, + if necessary. + """ + + self._logger = logging.getLogger("log") + + self.request_queue_size = options.request_queue_size + self.__ws_is_shut_down = threading.Event() + self.__ws_serving = False + + SocketServer.BaseServer.__init__( + self, (options.server_host, options.port), WebSocketRequestHandler) + + # Expose the options object to allow handler objects access it. We name + # it with websocket_ prefix to avoid conflict. + self.websocket_server_options = options + + self._create_sockets() + self.server_bind() + self.server_activate() + + def _create_sockets(self): + self.server_name, self.server_port = self.server_address + self._sockets = [] + if not self.server_name: + # On platforms that doesn't support IPv6, the first bind fails. + # On platforms that supports IPv6 + # - If it binds both IPv4 and IPv6 on call with AF_INET6, the + # first bind succeeds and the second fails (we'll see 'Address + # already in use' error). + # - If it binds only IPv6 on call with AF_INET6, both call are + # expected to succeed to listen both protocol. + addrinfo_array = [ + (socket.AF_INET6, socket.SOCK_STREAM, '', '', ''), + (socket.AF_INET, socket.SOCK_STREAM, '', '', '')] + else: + addrinfo_array = socket.getaddrinfo(self.server_name, + self.server_port, + socket.AF_UNSPEC, + socket.SOCK_STREAM, + socket.IPPROTO_TCP) + for addrinfo in addrinfo_array: + family, socktype, proto, canonname, sockaddr = addrinfo + try: + socket_ = socket.socket(family, socktype) + except Exception, e: + self._logger.info('Skip by failure: %r', e) + continue + if self.websocket_server_options.use_tls: + if _HAS_SSL: + if self.websocket_server_options.ca_certificate: + client_cert_ = ssl.CERT_REQUIRED + else: + client_cert_ = ssl.CERT_NONE + socket_ = ssl.wrap_socket(socket_, + keyfile=self.websocket_server_options.private_key, + certfile=self.websocket_server_options.certificate, + ssl_version=ssl.PROTOCOL_SSLv23, + ca_certs=self.websocket_server_options.ca_certificate, + cert_reqs=client_cert_) + if _HAS_OPEN_SSL: + ctx = OpenSSL.SSL.Context(OpenSSL.SSL.SSLv23_METHOD) + ctx.use_privatekey_file( + self.websocket_server_options.private_key) + ctx.use_certificate_file( + self.websocket_server_options.certificate) + socket_ = OpenSSL.SSL.Connection(ctx, socket_) + self._sockets.append((socket_, addrinfo)) + + def server_bind(self): + """Override SocketServer.TCPServer.server_bind to enable multiple + sockets bind. + """ + + failed_sockets = [] + + for socketinfo in self._sockets: + socket_, addrinfo = socketinfo + if self.allow_reuse_address: + socket_.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + try: + socket_.bind(self.server_address) + except Exception, e: + self._logger.info('Skip by failure: %r', e) + socket_.close() + failed_sockets.append(socketinfo) + + for socketinfo in failed_sockets: + self._sockets.remove(socketinfo) + + def server_activate(self): + """Override SocketServer.TCPServer.server_activate to enable multiple + sockets listen. + """ + + failed_sockets = [] + + for socketinfo in self._sockets: + socket_, addrinfo = socketinfo + self._logger.debug('Listen on: %r', addrinfo) + try: + socket_.listen(self.request_queue_size) + except Exception, e: + self._logger.info('Skip by failure: %r', e) + socket_.close() + failed_sockets.append(socketinfo) + + for socketinfo in failed_sockets: + self._sockets.remove(socketinfo) + + def server_close(self): + """Override SocketServer.TCPServer.server_close to enable multiple + sockets close. + """ + + for socketinfo in self._sockets: + socket_, addrinfo = socketinfo + self._logger.info('Close on: %r', addrinfo) + socket_.close() + + def fileno(self): + """Override SocketServer.TCPServer.fileno.""" + + self._logger.critical('Not supported: fileno') + return self._sockets[0][0].fileno() + + def handle_error(self, rquest, client_address): + """Override SocketServer.handle_error.""" + + self._logger.error( + 'Exception in processing request from: %r\n%s', + client_address, + util.get_stack_trace()) + # Note: client_address is a tuple. + + def get_request(self): + """Override TCPServer.get_request to wrap OpenSSL.SSL.Connection + object with _StandaloneSSLConnection to provide makefile method. We + cannot substitute OpenSSL.SSL.Connection.makefile since it's readonly + attribute. + """ + + accepted_socket, client_address = self.socket.accept() + if self.websocket_server_options.use_tls and _HAS_OPEN_SSL: + accepted_socket = _StandaloneSSLConnection(accepted_socket) + return accepted_socket, client_address + + def serve_forever(self, poll_interval=0.5): + """Override SocketServer.BaseServer.serve_forever.""" + + self.__ws_serving = True + self.__ws_is_shut_down.clear() + handle_request = self.handle_request + if hasattr(self, '_handle_request_noblock'): + handle_request = self._handle_request_noblock + else: + self._logger.warning('Fallback to blocking request handler') + try: + while self.__ws_serving: + r, w, e = select.select( + [socket_[0] for socket_ in self._sockets], + [], [], poll_interval) + for socket_ in r: + self.socket = socket_ + handle_request() + self.socket = None + finally: + self.__ws_is_shut_down.set() + + def shutdown(self): + """Override SocketServer.BaseServer.shutdown.""" + + self.__ws_serving = False + self.__ws_is_shut_down.wait() + + +class WebSocketRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler): + """CGIHTTPRequestHandler specialized for WebSocket.""" + + # Use httplib.HTTPMessage instead of mimetools.Message. + MessageClass = httplib.HTTPMessage + + def setup(self): + """Override SocketServer.StreamRequestHandler.setup to wrap rfile + with MemorizingFile. + + This method will be called by BaseRequestHandler's constructor + before calling BaseHTTPRequestHandler.handle. + BaseHTTPRequestHandler.handle will call + BaseHTTPRequestHandler.handle_one_request and it will call + WebSocketRequestHandler.parse_request. + """ + + # Call superclass's setup to prepare rfile, wfile, etc. See setup + # definition on the root class SocketServer.StreamRequestHandler to + # understand what this does. + CGIHTTPServer.CGIHTTPRequestHandler.setup(self) + + self.rfile = memorizingfile.MemorizingFile( + self.rfile, + max_memorized_lines=_MAX_MEMORIZED_LINES) + + def __init__(self, request, client_address, server): + self._logger = util.get_class_logger(self) + + self._options = server.websocket_server_options + + # Overrides CGIHTTPServerRequestHandler.cgi_directories. + self.cgi_directories = self._options.cgi_directories + # Replace CGIHTTPRequestHandler.is_executable method. + if self._options.is_executable_method is not None: + self.is_executable = self._options.is_executable_method + + # This actually calls BaseRequestHandler.__init__. + CGIHTTPServer.CGIHTTPRequestHandler.__init__( + self, request, client_address, server) + + def parse_request(self): + """Override BaseHTTPServer.BaseHTTPRequestHandler.parse_request. + + Return True to continue processing for HTTP(S), False otherwise. + + See BaseHTTPRequestHandler.handle_one_request method which calls + this method to understand how the return value will be handled. + """ + + # We hook parse_request method, but also call the original + # CGIHTTPRequestHandler.parse_request since when we return False, + # CGIHTTPRequestHandler.handle_one_request continues processing and + # it needs variables set by CGIHTTPRequestHandler.parse_request. + # + # Variables set by this method will be also used by WebSocket request + # handling (self.path, self.command, self.requestline, etc. See also + # how _StandaloneRequest's members are implemented using these + # attributes). + if not CGIHTTPServer.CGIHTTPRequestHandler.parse_request(self): + return False + host, port, resource = http_header_util.parse_uri(self.path) + if resource is None: + self._logger.info('Invalid URI: %r', self.path) + self._logger.info('Fallback to CGIHTTPRequestHandler') + return True + server_options = self.server.websocket_server_options + if host is not None: + validation_host = server_options.validation_host + if validation_host is not None and host != validation_host: + self._logger.info('Invalid host: %r (expected: %r)', + host, + validation_host) + self._logger.info('Fallback to CGIHTTPRequestHandler') + return True + if port is not None: + validation_port = server_options.validation_port + if validation_port is not None and port != validation_port: + self._logger.info('Invalid port: %r (expected: %r)', + port, + validation_port) + self._logger.info('Fallback to CGIHTTPRequestHandler') + return True + self.path = resource + + request = _StandaloneRequest(self, self._options.use_tls) + + try: + # Fallback to default http handler for request paths for which + # we don't have request handlers. + if not self._options.dispatcher.get_handler_suite(self.path): + self._logger.info('No handler for resource: %r', + self.path) + self._logger.info('Fallback to CGIHTTPRequestHandler') + return True + except dispatch.DispatchException, e: + self._logger.info('%s', e) + self.send_error(e.status) + return False + + # If any Exceptions without except clause setup (including + # DispatchException) is raised below this point, it will be caught + # and logged by WebSocketServer. + + try: + try: + handshake.do_handshake( + request, + self._options.dispatcher, + allowDraft75=self._options.allow_draft75, + strict=self._options.strict) + except handshake.VersionException, e: + self._logger.info('%s', e) + self.send_response(common.HTTP_STATUS_BAD_REQUEST) + self.send_header(common.SEC_WEBSOCKET_VERSION_HEADER, + e.supported_versions) + self.end_headers() + return False + except handshake.HandshakeException, e: + # Handshake for ws(s) failed. + self._logger.info('%s', e) + self.send_error(e.status) + return False + + request._dispatcher = self._options.dispatcher + self._options.dispatcher.transfer_data(request) + except handshake.AbortedByUserException, e: + self._logger.info('%s', e) + return False + + def log_request(self, code='-', size='-'): + """Override BaseHTTPServer.log_request.""" + + self._logger.info('"%s" %s %s', + self.requestline, str(code), str(size)) + + def log_error(self, *args): + """Override BaseHTTPServer.log_error.""" + + # Despite the name, this method is for warnings than for errors. + # For example, HTTP status code is logged by this method. + self._logger.warning('%s - %s', + self.address_string(), + args[0] % args[1:]) + + def is_cgi(self): + """Test whether self.path corresponds to a CGI script. + + Add extra check that self.path doesn't contains .. + Also check if the file is a executable file or not. + If the file is not executable, it is handled as static file or dir + rather than a CGI script. + """ + + if CGIHTTPServer.CGIHTTPRequestHandler.is_cgi(self): + if '..' in self.path: + return False + # strip query parameter from request path + resource_name = self.path.split('?', 2)[0] + # convert resource_name into real path name in filesystem. + scriptfile = self.translate_path(resource_name) + if not os.path.isfile(scriptfile): + return False + if not self.is_executable(scriptfile): + return False + return True + return False + + +def _get_logger_from_class(c): + return logging.getLogger('%s.%s' % (c.__module__, c.__name__)) + + +def _alias_handlers(dispatcher, websock_handlers_map_file): + """Set aliases specified in websock_handler_map_file in dispatcher. + + Args: + dispatcher: dispatch.Dispatcher instance + websock_handler_map_file: alias map file + """ + + fp = open(websock_handlers_map_file) + try: + for line in fp: + if line[0] == '#' or line.isspace(): + continue + m = re.match('(\S+)\s+(\S+)', line) + if not m: + logging.warning('Wrong format in map file:' + line) + continue + try: + dispatcher.add_resource_path_alias( + m.group(1), m.group(2)) + except dispatch.DispatchException, e: + logging.error(str(e)) + finally: + fp.close() + +class DefaultOptions: + server_host = '' + port = common.DEFAULT_WEB_SOCKET_PORT + use_tls = False + private_key = '' + certificate = '' + ca_certificate = '' + dispatcher = None + request_queue_size = _DEFAULT_REQUEST_QUEUE_SIZE + + allow_draft75 = False + strict = False + validation_host = None + validation_port = None + cgi_directories = '' + is_executable_method = False + +def _main(args=None): + options, args = _parse_args_and_config(args=args) + + os.chdir(options.document_root) + + _configure_logging(options) + + # TODO(tyoshino): Clean up initialization of CGI related values. Move some + # of code here to WebSocketRequestHandler class if it's better. + options.cgi_directories = [] + options.is_executable_method = None + if options.cgi_paths: + options.cgi_directories = options.cgi_paths.split(',') + if sys.platform in ('cygwin', 'win32'): + cygwin_path = None + # For Win32 Python, it is expected that CYGWIN_PATH + # is set to a directory of cygwin binaries. + # For example, websocket_server.py in Chromium sets CYGWIN_PATH to + # full path of third_party/cygwin/bin. + if 'CYGWIN_PATH' in os.environ: + cygwin_path = os.environ['CYGWIN_PATH'] + util.wrap_popen3_for_win(cygwin_path) + + def __check_script(scriptpath): + return util.get_script_interp(scriptpath, cygwin_path) + + options.is_executable_method = __check_script + + if options.use_tls: + if not (_HAS_SSL or _HAS_OPEN_SSL): + logging.critical('TLS support requires ssl or pyOpenSSL module.') + sys.exit(1) + if not options.private_key or not options.certificate: + logging.critical( + 'To use TLS, specify private_key and certificate.') + sys.exit(1) + + if options.ca_certificate: + if not options.use_tls: + logging.critical('TLS must be enabled for client authentication.') + sys.exit(1) + if not _HAS_SSL: + logging.critical('Client authentication requires ssl module.') + + if not options.scan_dir: + options.scan_dir = options.websock_handlers + + try: + if options.thread_monitor_interval_in_sec > 0: + # Run a thread monitor to show the status of server threads for + # debugging. + ThreadMonitor(options.thread_monitor_interval_in_sec).start() + + # Share a Dispatcher among request handlers to save time for + # instantiation. Dispatcher can be shared because it is thread-safe. + options.dispatcher = dispatch.Dispatcher( + options.websock_handlers, + options.scan_dir, + options.allow_handlers_outside_root_dir) + if options.websock_handlers_map_file: + _alias_handlers(options.dispatcher, + options.websock_handlers_map_file) + warnings = options.dispatcher.source_warnings() + if warnings: + for warning in warnings: + logging.warning('mod_pywebsocket: %s' % warning) + + server = WebSocketServer(options) + server.serve_forever() + except Exception, e: + logging.critical('mod_pywebsocket: %s' % e) + logging.critical('mod_pywebsocket: %s' % util.get_stack_trace()) + sys.exit(1) + + +if __name__ == '__main__': + _main(sys.argv[1:]) + + +# vi:sts=4 sw=4 et diff --git a/module/remote/wsbackend/__init__.py b/module/remote/wsbackend/__init__.py new file mode 100644 index 000000000..de6d13128 --- /dev/null +++ b/module/remote/wsbackend/__init__.py @@ -0,0 +1,2 @@ +__author__ = 'christian' + \ No newline at end of file -- cgit v1.2.3