summaryrefslogtreecommitdiffstats
path: root/module/remote
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-12-04 13:39:42 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-12-04 13:39:42 +0100
commitd2e3afceb738af20aeb8e41f9aad12150cf1e8a7 (patch)
tree91a1ce5bc7fb51be6c3d188aed11552662d6f4bf /module/remote
parentclosed #440 (diff)
downloadpyload-d2e3afceb738af20aeb8e41f9aad12150cf1e8a7.tar.xz
Better download connection handling: Detect server error earlier, fallback to single connection if possible
Diffstat (limited to 'module/remote')
-rw-r--r--module/remote/socketbackend/create_ttypes.py2
-rw-r--r--module/remote/socketbackend/ttypes.py65
2 files changed, 49 insertions, 18 deletions
diff --git a/module/remote/socketbackend/create_ttypes.py b/module/remote/socketbackend/create_ttypes.py
index 1bf8856a2..05662cb50 100644
--- a/module/remote/socketbackend/create_ttypes.py
+++ b/module/remote/socketbackend/create_ttypes.py
@@ -68,7 +68,7 @@ class BaseObject(object):
#create init
args = ["self"] + ["%s=None" % x for x in klass.__slots__]
- f.write("\tdef init(%s):\n" % ", ".join(args))
+ f.write("\tdef __init__(%s):\n" % ", ".join(args))
for attr in klass.__slots__:
f.write("\t\tself.%s = %s\n" % (attr, attr))
diff --git a/module/remote/socketbackend/ttypes.py b/module/remote/socketbackend/ttypes.py
index 58e638689..f8ea121fa 100644
--- a/module/remote/socketbackend/ttypes.py
+++ b/module/remote/socketbackend/ttypes.py
@@ -31,10 +31,27 @@ class ElementType:
File = 1
Package = 0
+class Input:
+ BOOL = 4
+ CHOICE = 6
+ CLICK = 5
+ LIST = 8
+ MULTIPLE = 7
+ NONE = 0
+ PASSWORD = 3
+ TABLE = 9
+ TEXT = 1
+ TEXTBOX = 2
+
+class Output:
+ CAPTCHA = 1
+ NOTIFICATION = 4
+ QUESTION = 2
+
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):
+ 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
@@ -47,7 +64,7 @@ class AccountInfo(BaseObject):
class CaptchaTask(BaseObject):
__slots__ = ['tid', 'data', 'type', 'resultType']
- def init(self, tid=None, data=None, type=None, resultType=None):
+ def __init__(self, tid=None, data=None, type=None, resultType=None):
self.tid = tid
self.data = data
self.type = type
@@ -56,7 +73,7 @@ class CaptchaTask(BaseObject):
class ConfigItem(BaseObject):
__slots__ = ['name', 'description', 'value', 'type']
- def init(self, name=None, description=None, value=None, type=None):
+ def __init__(self, name=None, description=None, value=None, type=None):
self.name = name
self.description = description
self.value = value
@@ -65,7 +82,7 @@ class ConfigItem(BaseObject):
class ConfigSection(BaseObject):
__slots__ = ['name', 'description', 'items', 'outline']
- def init(self, name=None, description=None, items=None, outline=None):
+ def __init__(self, name=None, description=None, items=None, outline=None):
self.name = name
self.description = description
self.items = items
@@ -74,7 +91,7 @@ class ConfigSection(BaseObject):
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):
+ 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
@@ -95,7 +112,7 @@ class DownloadInfo(BaseObject):
class EventInfo(BaseObject):
__slots__ = ['eventname', 'id', 'type', 'destination']
- def init(self, eventname=None, id=None, type=None, destination=None):
+ def __init__(self, eventname=None, id=None, type=None, destination=None):
self.eventname = eventname
self.id = id
self.type = type
@@ -104,7 +121,7 @@ class EventInfo(BaseObject):
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):
+ 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
@@ -120,20 +137,34 @@ class FileData(BaseObject):
class FileDoesNotExists(Exception):
__slots__ = ['fid']
- def init(self, fid=None):
+ def __init__(self, fid=None):
self.fid = fid
+class InteractionTask(BaseObject):
+ __slots__ = ['iid', 'input', 'structure', 'preset', 'output', 'data', 'title', 'description', 'plugin']
+
+ def __init__(self, iid=None, input=None, structure=None, preset=None, output=None, data=None, title=None, description=None, plugin=None):
+ self.iid = iid
+ self.input = input
+ self.structure = structure
+ self.preset = preset
+ self.output = output
+ self.data = data
+ self.title = title
+ self.description = description
+ self.plugin = plugin
+
class OnlineCheck(BaseObject):
__slots__ = ['rid', 'data']
- def init(self, rid=None, data=None):
+ 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):
+ def __init__(self, name=None, plugin=None, packagename=None, status=None, size=None):
self.name = name
self.plugin = plugin
self.packagename = packagename
@@ -143,7 +174,7 @@ class OnlineStatus(BaseObject):
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):
+ 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
@@ -161,13 +192,13 @@ class PackageData(BaseObject):
class PackageDoesNotExists(Exception):
__slots__ = ['pid']
- def init(self, pid=None):
+ 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):
+ 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
@@ -179,7 +210,7 @@ class ServerStatus(BaseObject):
class ServiceCall(BaseObject):
__slots__ = ['plugin', 'func', 'arguments', 'parseArguments']
- def init(self, plugin=None, func=None, arguments=None, parseArguments=None):
+ def __init__(self, plugin=None, func=None, arguments=None, parseArguments=None):
self.plugin = plugin
self.func = func
self.arguments = arguments
@@ -188,20 +219,20 @@ class ServiceCall(BaseObject):
class ServiceDoesNotExists(Exception):
__slots__ = ['plugin', 'func']
- def init(self, plugin=None, func=None):
+ def __init__(self, plugin=None, func=None):
self.plugin = plugin
self.func = func
class ServiceException(Exception):
__slots__ = ['msg']
- def init(self, msg=None):
+ 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):
+ def __init__(self, name=None, email=None, role=None, permission=None, templateName=None):
self.name = name
self.email = email
self.role = role