diff options
Diffstat (limited to 'pyload/remote')
-rw-r--r-- | pyload/remote/apitypes.py | 69 | ||||
-rw-r--r-- | pyload/remote/apitypes_debug.py | 8 | ||||
-rw-r--r-- | pyload/remote/pyload.thrift | 47 | ||||
-rw-r--r-- | pyload/remote/wsbackend/AsyncHandler.py | 8 |
4 files changed, 77 insertions, 55 deletions
diff --git a/pyload/remote/apitypes.py b/pyload/remote/apitypes.py index ab68116c3..4c66800c6 100644 --- a/pyload/remote/apitypes.py +++ b/pyload/remote/apitypes.py @@ -36,10 +36,11 @@ class DownloadStatus: NotPossible = 13 Missing = 14 FileMismatch = 15 - Decrypting = 16 - Processing = 17 - Custom = 18 - Unknown = 19 + Occupied = 16 + Decrypting = 17 + Processing = 18 + Custom = 19 + Unknown = 20 class FileStatus: Ok = 0 @@ -55,13 +56,15 @@ class InputType: Textbox = 5 Password = 6 Time = 7 - Bool = 8 - Click = 9 - Select = 10 - Multiple = 11 - List = 12 - PluginList = 13 - Table = 14 + TimeSpan = 8 + ByteSize = 9 + Bool = 10 + Click = 11 + Select = 12 + Multiple = 13 + List = 14 + PluginList = 15 + Table = 16 class Interaction: All = 0 @@ -109,9 +112,10 @@ class Role: User = 1 class AccountInfo(BaseObject): - __slots__ = ['plugin', 'loginname', 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'shared', 'config'] + __slots__ = ['aid', 'plugin', 'loginname', 'owner', 'valid', 'validuntil', 'trafficleft', 'maxtraffic', 'premium', 'activated', 'shared', 'config'] - def __init__(self, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, config=None): + def __init__(self, aid=None, plugin=None, loginname=None, owner=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, shared=None, config=None): + self.aid = aid self.plugin = plugin self.loginname = loginname self.owner = owner @@ -322,20 +326,6 @@ class ProgressInfo(BaseObject): self.type = type self.download = download -class ServerStatus(BaseObject): - __slots__ = ['speed', 'linkstotal', 'linksqueue', 'sizetotal', 'sizequeue', 'notifications', 'paused', 'download', 'reconnect'] - - def __init__(self, speed=None, linkstotal=None, linksqueue=None, sizetotal=None, sizequeue=None, notifications=None, paused=None, download=None, reconnect=None): - self.speed = speed - self.linkstotal = linkstotal - self.linksqueue = linksqueue - self.sizetotal = sizetotal - self.sizequeue = sizequeue - self.notifications = notifications - self.paused = paused - self.download = download - self.reconnect = reconnect - class ServiceDoesNotExist(ExceptionObject): __slots__ = ['plugin', 'func'] @@ -349,6 +339,21 @@ class ServiceException(ExceptionObject): def __init__(self, msg=None): self.msg = msg +class StatusInfo(BaseObject): + __slots__ = ['speed', 'linkstotal', 'linksqueue', 'sizetotal', 'sizequeue', 'notifications', 'paused', 'download', 'reconnect', 'quota'] + + def __init__(self, speed=None, linkstotal=None, linksqueue=None, sizetotal=None, sizequeue=None, notifications=None, paused=None, download=None, reconnect=None, quota=None): + self.speed = speed + self.linkstotal = linkstotal + self.linksqueue = linksqueue + self.sizetotal = sizetotal + self.sizequeue = sizequeue + self.notifications = notifications + self.paused = paused + self.download = download + self.reconnect = reconnect + self.quota = quota + class TreeCollection(BaseObject): __slots__ = ['root', 'files', 'packages'] @@ -402,6 +407,8 @@ class Iface(object): pass def checkLinks(self, links): pass + def createAccount(self, plugin, loginname, password): + pass def createPackage(self, name, folder, root, password, site, comment, paused): pass def deleteConfig(self, plugin): @@ -420,7 +427,7 @@ class Iface(object): pass def generatePackages(self, links): pass - def getAccountInfo(self, plugin, loginname, refresh): + def getAccountInfo(self, aid, plugin, refresh): pass def getAccountTypes(self): pass @@ -464,10 +471,12 @@ class Iface(object): pass def getProgressInfo(self): pass - def getServerStatus(self): + def getQuota(self): pass def getServerVersion(self): pass + def getStatusInfo(self): + pass def getUserData(self): pass def getWSAddress(self): @@ -538,7 +547,7 @@ class Iface(object): pass def unpauseServer(self): pass - def updateAccount(self, plugin, loginname, password): + def updateAccount(self, aid, plugin, loginname, password): pass def updateAccountInfo(self, account): pass diff --git a/pyload/remote/apitypes_debug.py b/pyload/remote/apitypes_debug.py index d5e5f36a0..a30009bad 100644 --- a/pyload/remote/apitypes_debug.py +++ b/pyload/remote/apitypes_debug.py @@ -19,7 +19,7 @@ enums = [ ] classes = { - 'AccountInfo' : [basestring, basestring, int, bool, int, int, int, bool, bool, bool, (list, ConfigItem)], + 'AccountInfo' : [int, basestring, basestring, int, bool, int, int, int, bool, bool, bool, (list, ConfigItem)], 'AddonInfo' : [basestring, basestring, basestring], 'AddonService' : [basestring, basestring, basestring, (list, basestring), bool, int], 'ConfigHolder' : [basestring, basestring, basestring, basestring, (list, ConfigItem), (None, (list, AddonInfo))], @@ -39,9 +39,9 @@ classes = { 'PackageInfo' : [int, basestring, basestring, int, int, basestring, basestring, basestring, int, (list, basestring), int, bool, int, PackageStats, (list, int), (list, int)], 'PackageStats' : [int, int, int, int], 'ProgressInfo' : [basestring, basestring, basestring, int, int, int, int, int, (None, DownloadProgress)], - 'ServerStatus' : [int, int, int, int, int, bool, bool, bool, bool], 'ServiceDoesNotExist' : [basestring, basestring], 'ServiceException' : [basestring], + 'StatusInfo' : [int, int, int, int, int, bool, bool, bool, bool, int], 'TreeCollection' : [PackageInfo, (dict, int, FileInfo), (dict, int, PackageInfo)], 'UserData' : [int, basestring, basestring, int, int, basestring, int, int, basestring, int, int, basestring], 'UserDoesNotExist' : [basestring], @@ -57,6 +57,7 @@ methods = { 'checkContainer': OnlineCheck, 'checkHTML': OnlineCheck, 'checkLinks': OnlineCheck, + 'createAccount': AccountInfo, 'createPackage': int, 'deleteConfig': None, 'deleteFiles': bool, @@ -88,8 +89,9 @@ methods = { 'getPackageInfo': PackageInfo, 'getPluginConfig': (list, ConfigInfo), 'getProgressInfo': (list, ProgressInfo), - 'getServerStatus': ServerStatus, + 'getQuota': int, 'getServerVersion': basestring, + 'getStatusInfo': StatusInfo, 'getUserData': UserData, 'getWSAddress': basestring, 'invokeAddon': basestring, diff --git a/pyload/remote/pyload.thrift b/pyload/remote/pyload.thrift index a9431ea7c..9d400c4e2 100644 --- a/pyload/remote/pyload.thrift +++ b/pyload/remote/pyload.thrift @@ -5,6 +5,7 @@ typedef i32 PackageID typedef i32 ResultID typedef i32 InteractionID typedef i32 UserID +typedef i32 AccountID typedef i64 UTCDate typedef i64 ByteCount typedef list<string> LinkList @@ -28,6 +29,7 @@ enum DownloadStatus { NotPossible, Missing, FileMismatch, + Occupied, Decrypting, Processing, Custom, @@ -71,7 +73,6 @@ enum PackageStatus { // 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, ip, s.o. enum InputType { NA, Text, @@ -81,6 +82,8 @@ enum InputType { Textbox, Password, Time, + TimeSpan, + ByteSize, // size in bytes Bool, // confirm like, yes or no dialog Click, // for positional captchas Select, // select from list @@ -217,7 +220,7 @@ struct LinkStatus { 6: optional string hash } -struct ServerStatus { +struct StatusInfo { 1: ByteCount speed, 2: i16 linkstotal, 3: i16 linksqueue, @@ -227,6 +230,7 @@ struct ServerStatus { 7: bool paused, 8: bool download, 9: bool reconnect, + 10: ByteCount quota } struct InteractionTask { @@ -300,17 +304,18 @@ struct UserData { } 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: list <ConfigItem> config, + 1: AccountID aid, + 2: PluginName plugin, + 3: string loginname, + 4: UserID owner, + 5: bool valid, + 6: UTCDate validuntil, + 7: ByteCount trafficleft, + 8: ByteCount maxtraffic, + 9: bool premium, + 10: bool activated, + 11: bool shared, + 13: list <ConfigItem> config, } struct OnlineCheck { @@ -363,7 +368,7 @@ service Pyload { string getServerVersion(), string getWSAddress(), - ServerStatus getServerStatus(), + StatusInfo getStatusInfo(), list<ProgressInfo> getProgressInfo(), list<string> getLog(1: i32 offset), @@ -500,9 +505,10 @@ service Pyload { list<string> getAccountTypes(), list<AccountInfo> getAccounts(), - AccountInfo getAccountInfo(1: PluginName plugin, 2: string loginname, 3: bool refresh), + AccountInfo getAccountInfo(1: AccountID aid, 2: PluginName plugin, 3: bool refresh), - AccountInfo updateAccount(1: PluginName plugin, 2: string loginname, 3: string password), + AccountInfo createAccount(1: PluginName plugin, 2: string loginname, 3: string password), + AccountInfo updateAccount(1:AccountID aid, 2: PluginName plugin, 3: string loginname, 4: string password), void updateAccountInfo(1: AccountInfo account), void removeAccount(1: AccountInfo account), @@ -542,6 +548,15 @@ service Pyload { JSONString invokeAddonHandler(1: PluginName plugin, 2: string func, 3: PackageID pid_or_fid) throws (1: ServiceDoesNotExist e, 2: ServiceException ex), + + /////////////////////// + // Statistics Api + /////////////////////// + + ByteCount getQuota(), + + + /////////////////////// // Media finder /////////////////////// diff --git a/pyload/remote/wsbackend/AsyncHandler.py b/pyload/remote/wsbackend/AsyncHandler.py index c7a26cd6b..bf931d70d 100644 --- a/pyload/remote/wsbackend/AsyncHandler.py +++ b/pyload/remote/wsbackend/AsyncHandler.py @@ -171,12 +171,8 @@ class AsyncHandler(AbstractHandler): pass if req.t <= time(): - # TODO: server status is not enough - # modify core api to include progress? think of other needed information to show - # eta is quite wrong currently - # notifications - self.send(req, self.api.getServerStatus()) - self.send(req, self.api.getProgressInfo()) + self.send(req, req.api.getStatusInfo()) + self.send(req, req.api.getProgressInfo()) # update time for next update req.t = time() + req.interval
\ No newline at end of file |