diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-11-19 22:44:24 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-11-19 22:44:24 +0100 |
commit | 3b9885e40961bde996014c7e82d59daf2bd7ac14 (patch) | |
tree | 54f60f42b9b445d8b497d373a9d16eefd262ce87 /module/remote/socketbackend | |
parent | catch real debrid error, when ip is blocked (diff) | |
download | pyload-3b9885e40961bde996014c7e82d59daf2bd7ac14.tar.xz |
disableble thriftbackend
Diffstat (limited to 'module/remote/socketbackend')
-rw-r--r-- | module/remote/socketbackend/__init__.py | 2 | ||||
-rw-r--r-- | module/remote/socketbackend/create_ttypes.py | 87 | ||||
-rw-r--r-- | module/remote/socketbackend/ttypes.py | 352 |
3 files changed, 441 insertions, 0 deletions
diff --git a/module/remote/socketbackend/__init__.py b/module/remote/socketbackend/__init__.py new file mode 100644 index 000000000..de6d13128 --- /dev/null +++ b/module/remote/socketbackend/__init__.py @@ -0,0 +1,2 @@ +__author__ = 'christian' +
\ No newline at end of file diff --git a/module/remote/socketbackend/create_ttypes.py b/module/remote/socketbackend/create_ttypes.py new file mode 100644 index 000000000..db27bd02f --- /dev/null +++ b/module/remote/socketbackend/create_ttypes.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +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): + __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 = "BaseException" 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:\n") + + for name in dir(Iface): + if name.startswith("_"): continue + f.write("\tdef %s():\n\t\tpass\n" % name) + + 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 new file mode 100644 index 000000000..30a7d3adc --- /dev/null +++ b/module/remote/socketbackend/ttypes.py @@ -0,0 +1,352 @@ +#!/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 Destination: + Collector = 0 + Queue = 1 + +class DownloadStatus: + Aborted = 9 + Custom = 11 + Decrypting = 10 + Downloading = 12 + Failed = 8 + Finished = 0 + Offline = 1 + Online = 2 + Processing = 13 + Queued = 3 + Skipped = 4 + Starting = 7 + TempOffline = 6 + Unknown = 14 + Waiting = 5 + +class ElementType: + File = 1 + Package = 0 + +class AccountInfo(BaseObject): + __slots__ = ['validuntil', 'login', 'options', 'valid', 'trafficleft', 'maxtraffic', 'premium', 'type'] + + def init(self, validuntil=None, login=None, options=None, valid=None, trafficleft=None, maxtraffic=None, premium=None, type=None): + self.validuntil = validuntil + self.login = login + self.options = options + self.valid = valid + self.trafficleft = trafficleft + self.maxtraffic = maxtraffic + self.premium = premium + self.type = type + +class CaptchaTask(BaseObject): + __slots__ = ['tid', 'data', 'type', 'resultType'] + + def init(self, tid=None, data=None, type=None, resultType=None): + self.tid = tid + self.data = data + self.type = type + self.resultType = resultType + +class ConfigItem(BaseObject): + __slots__ = ['name', 'description', 'value', 'type'] + + def init(self, name=None, description=None, value=None, type=None): + self.name = name + self.description = description + self.value = value + self.type = type + +class ConfigSection(BaseObject): + __slots__ = ['name', 'description', 'items', 'outline'] + + def init(self, name=None, description=None, items=None, outline=None): + self.name = name + self.description = description + self.items = items + self.outline = outline + +class DownloadInfo(BaseObject): + __slots__ = ['fid', 'name', 'speed', 'eta', 'format_eta', 'bleft', 'size', 'format_size', 'percent', 'status', 'statusmsg', 'format_wait', 'wait_until', 'packageID', 'packageName', 'plugin'] + + def init(self, fid=None, name=None, speed=None, eta=None, format_eta=None, bleft=None, size=None, format_size=None, percent=None, status=None, statusmsg=None, format_wait=None, wait_until=None, packageID=None, packageName=None, plugin=None): + self.fid = fid + self.name = name + self.speed = speed + self.eta = eta + self.format_eta = format_eta + self.bleft = bleft + self.size = size + self.format_size = format_size + self.percent = percent + self.status = status + self.statusmsg = statusmsg + self.format_wait = format_wait + self.wait_until = wait_until + self.packageID = packageID + self.packageName = packageName + self.plugin = plugin + +class EventInfo(BaseObject): + __slots__ = ['eventname', 'id', 'type', 'destination'] + + def init(self, eventname=None, id=None, type=None, destination=None): + self.eventname = eventname + self.id = id + self.type = type + self.destination = destination + +class FileData(BaseObject): + __slots__ = ['fid', 'url', 'name', 'plugin', 'size', 'format_size', 'status', 'statusmsg', 'packageID', 'error', 'order'] + + def init(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, packageID=None, error=None, order=None): + self.fid = fid + self.url = url + self.name = name + self.plugin = plugin + self.size = size + self.format_size = format_size + self.status = status + self.statusmsg = statusmsg + self.packageID = packageID + self.error = error + self.order = order + +class FileDoesNotExists(BaseException): + __slots__ = ['fid'] + + def init(self, fid=None): + self.fid = fid + +class OnlineCheck(BaseObject): + __slots__ = ['rid', 'data'] + + def init(self, rid=None, data=None): + self.rid = rid + self.data = data + +class OnlineStatus(BaseObject): + __slots__ = ['name', 'plugin', 'packagename', 'status', 'size'] + + def init(self, name=None, plugin=None, packagename=None, status=None, size=None): + self.name = name + self.plugin = plugin + self.packagename = packagename + self.status = status + self.size = size + +class PackageData(BaseObject): + __slots__ = ['pid', 'name', 'folder', 'site', 'password', 'dest', 'order', 'linksdone', 'sizedone', 'sizetotal', 'linkstotal', 'links', 'fids'] + + def init(self, pid=None, name=None, folder=None, site=None, password=None, dest=None, order=None, linksdone=None, sizedone=None, sizetotal=None, linkstotal=None, links=None, fids=None): + self.pid = pid + self.name = name + self.folder = folder + self.site = site + self.password = password + self.dest = dest + self.order = order + self.linksdone = linksdone + self.sizedone = sizedone + self.sizetotal = sizetotal + self.linkstotal = linkstotal + self.links = links + self.fids = fids + +class PackageDoesNotExists(BaseException): + __slots__ = ['pid'] + + def init(self, pid=None): + self.pid = pid + +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 ServiceCall(BaseObject): + __slots__ = ['plugin', 'func', 'arguments', 'parseArguments'] + + def init(self, plugin=None, func=None, arguments=None, parseArguments=None): + self.plugin = plugin + self.func = func + self.arguments = arguments + self.parseArguments = parseArguments + +class ServiceDoesNotExists(BaseException): + __slots__ = ['plugin', 'func'] + + def init(self, plugin=None, func=None): + self.plugin = plugin + self.func = func + +class ServiceException(BaseException): + __slots__ = ['msg'] + + def init(self, msg=None): + self.msg = msg + +class UserData(BaseObject): + __slots__ = ['name', 'email', 'role', 'permission', 'templateName'] + + def init(self, name=None, email=None, role=None, permission=None, templateName=None): + self.name = name + self.email = email + self.role = role + self.permission = permission + self.templateName = templateName + +class Iface: + def addFiles(): + pass + def addPackage(): + pass + def call(): + pass + def checkOnlineStatus(): + pass + def checkOnlineStatusContainer(): + pass + def checkURLs(): + pass + def deleteFiles(): + pass + def deleteFinished(): + pass + def deletePackages(): + pass + def freeSpace(): + pass + def generateAndAddPackages(): + pass + def generatePackages(): + pass + def getAccountTypes(): + pass + def getAccounts(): + pass + def getAllInfo(): + pass + def getAllUserData(): + pass + def getCaptchaTask(): + pass + def getCaptchaTaskStatus(): + pass + def getCollector(): + pass + def getCollectorData(): + pass + def getConfig(): + pass + def getConfigValue(): + pass + def getEvents(): + pass + def getFileData(): + pass + def getFileOrder(): + pass + def getInfoByPlugin(): + pass + def getLog(): + pass + def getPackageData(): + pass + def getPackageInfo(): + pass + def getPackageOrder(): + pass + def getPluginConfig(): + pass + def getQueue(): + pass + def getQueueData(): + pass + def getServerVersion(): + pass + def getServices(): + pass + def getUserData(): + pass + def hasService(): + pass + def isCaptchaWaiting(): + pass + def isTimeDownload(): + pass + def isTimeReconnect(): + pass + def kill(): + pass + def login(): + pass + def moveFiles(): + pass + def movePackage(): + pass + def orderFile(): + pass + def orderPackage(): + pass + def parseURLs(): + pass + def pauseServer(): + pass + def pollResults(): + pass + def pullFromQueue(): + pass + def pushToQueue(): + pass + def recheckPackage(): + pass + def removeAccount(): + pass + def restart(): + pass + def restartFailed(): + pass + def restartFile(): + pass + def restartPackage(): + pass + def setCaptchaResult(): + pass + def setConfigValue(): + pass + def setPackageData(): + pass + def setPackageName(): + pass + def statusDownloads(): + pass + def statusServer(): + pass + def stopAllDownloads(): + pass + def stopDownloads(): + pass + def togglePause(): + pass + def toggleReconnect(): + pass + def unpauseServer(): + pass + def updateAccount(): + pass + def uploadContainer(): + pass + |