summaryrefslogtreecommitdiffstats
path: root/module/remote/thriftbackend
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-12-23 21:40:22 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-12-23 21:40:22 +0100
commit8da44b430b957b25e74dff63829d4198a52e7a0b (patch)
treef20fc60db6e7d9a93fe3ca60cd68a6e32b536fc6 /module/remote/thriftbackend
parentoron version increase (diff)
parentlittle fixes (diff)
downloadpyload-8da44b430b957b25e74dff63829d4198a52e7a0b.tar.xz
merge hotfixes in
Diffstat (limited to 'module/remote/thriftbackend')
-rw-r--r--module/remote/thriftbackend/pyload.thrift59
-rwxr-xr-xmodule/remote/thriftbackend/thriftgen/pyload/Pyload-remote23
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/Pyload.py152
-rw-r--r--module/remote/thriftbackend/thriftgen/pyload/ttypes.py212
4 files changed, 261 insertions, 185 deletions
diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift
index 1542e651a..414a1ebf2 100644
--- a/module/remote/thriftbackend/pyload.thrift
+++ b/module/remote/thriftbackend/pyload.thrift
@@ -34,11 +34,6 @@ enum Destination {
Queue
}
-enum ElementType {
- Package,
- File
-}
-
// 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
@@ -93,20 +88,6 @@ struct ServerStatus {
7: bool reconnect
}
-struct ConfigItem {
- 1: string name,
- 2: string description,
- 3: string value,
- 4: string type,
-}
-
-struct ConfigSection {
- 1: string name,
- 2: string description,
- 3: list<ConfigItem> items,
- 4: optional string outline
-}
-
struct FileData {
1: FileID fid,
2: string url,
@@ -149,6 +130,24 @@ struct InteractionTask {
9: string plugin,
}
+struct ConfigItem {
+ 1: string name,
+ 2: string long_name,
+ 3: string description,
+ 4: string type,
+ 5: string default_value,
+ 6: string value,
+}
+
+struct ConfigSection {
+ 1: string name,
+ 2: string long_name,
+ 3: string description,
+ 4: string long_description,
+ 5: optional list<ConfigItem> items,
+ 6: optional map<string, InteractionTask> handler,
+}
+
struct CaptchaTask {
1: i16 tid,
2: binary data,
@@ -158,9 +157,7 @@ struct CaptchaTask {
struct EventInfo {
1: string eventname,
- 2: optional i32 id,
- 3: optional ElementType type,
- 4: optional Destination destination
+ 2: list<string> event_args,
}
struct UserData {
@@ -172,14 +169,15 @@ struct UserData {
}
struct AccountInfo {
- 1: i64 validuntil,
- 2: string login,
- 3: map<string, list<string>> options,
- 4: bool valid,
+ 1: PluginName plugin,
+ 2: string loginname,
+ 3: bool valid,
+ 4: i64 validuntil,
5: i64 trafficleft,
6: i64 maxtraffic,
7: bool premium,
- 8: string type,
+ 8: bool activated,
+ 9: map<string, list<string>> options,
}
struct ServiceCall {
@@ -225,10 +223,11 @@ exception ServiceException{
service Pyload {
//config
- string getConfigValue(1: string category, 2: string option, 3: string section),
- void setConfigValue(1: string category, 2: string option, 3: string value, 4: string section),
+ string getConfigValue(1: string section, 2: string option),
+ void setConfigValue(1: string section, 2: string option, 3: string value),
map<string, ConfigSection> getConfig(),
- map<string, ConfigSection> getPluginConfig(),
+ map<PluginName, ConfigSection> getPluginConfig(),
+ ConfigSection configureSection(1: string section),
// server status
void pauseServer(),
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
index bfaf5b078..f8bcc2863 100755
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote
@@ -23,10 +23,11 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print 'Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
print ''
print 'Functions:'
- print ' string getConfigValue(string category, string option, string section)'
- print ' void setConfigValue(string category, string option, string value, string section)'
+ print ' string getConfigValue(string section, string option)'
+ print ' void setConfigValue(string section, string option, string value)'
print ' getConfig()'
print ' getPluginConfig()'
+ print ' ConfigSection configureSection(string section)'
print ' void pauseServer()'
print ' void unpauseServer()'
print ' bool togglePause()'
@@ -145,16 +146,16 @@ client = Pyload.Client(protocol)
transport.open()
if cmd == 'getConfigValue':
- if len(args) != 3:
- print 'getConfigValue requires 3 args'
+ if len(args) != 2:
+ print 'getConfigValue requires 2 args'
sys.exit(1)
- pp.pprint(client.getConfigValue(args[0],args[1],args[2],))
+ pp.pprint(client.getConfigValue(args[0],args[1],))
elif cmd == 'setConfigValue':
- if len(args) != 4:
- print 'setConfigValue requires 4 args'
+ if len(args) != 3:
+ print 'setConfigValue requires 3 args'
sys.exit(1)
- pp.pprint(client.setConfigValue(args[0],args[1],args[2],args[3],))
+ pp.pprint(client.setConfigValue(args[0],args[1],args[2],))
elif cmd == 'getConfig':
if len(args) != 0:
@@ -168,6 +169,12 @@ elif cmd == 'getPluginConfig':
sys.exit(1)
pp.pprint(client.getPluginConfig())
+elif cmd == 'configureSection':
+ if len(args) != 1:
+ print 'configureSection requires 1 args'
+ sys.exit(1)
+ pp.pprint(client.configureSection(args[0],))
+
elif cmd == 'pauseServer':
if len(args) != 0:
print 'pauseServer requires 0 args'
diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
index 78a42f16a..1e2f78b66 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py
@@ -13,22 +13,20 @@ from thrift.protocol.TBase import TBase, TExceptionBase
class Iface(object):
- def getConfigValue(self, category, option, section):
+ def getConfigValue(self, section, option):
"""
Parameters:
- - category
- - option
- section
+ - option
"""
pass
- def setConfigValue(self, category, option, value, section):
+ def setConfigValue(self, section, option, value):
"""
Parameters:
- - category
+ - section
- option
- value
- - section
"""
pass
@@ -38,6 +36,13 @@ class Iface(object):
def getPluginConfig(self, ):
pass
+ def configureSection(self, section):
+ """
+ Parameters:
+ - section
+ """
+ pass
+
def pauseServer(self, ):
pass
@@ -434,22 +439,20 @@ class Client(Iface):
self._oprot = oprot
self._seqid = 0
- def getConfigValue(self, category, option, section):
+ def getConfigValue(self, section, option):
"""
Parameters:
- - category
- - option
- section
+ - option
"""
- self.send_getConfigValue(category, option, section)
+ self.send_getConfigValue(section, option)
return self.recv_getConfigValue()
- def send_getConfigValue(self, category, option, section):
+ def send_getConfigValue(self, section, option):
self._oprot.writeMessageBegin('getConfigValue', TMessageType.CALL, self._seqid)
args = getConfigValue_args()
- args.category = category
- args.option = option
args.section = section
+ args.option = option
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -468,24 +471,22 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "getConfigValue failed: unknown result");
- def setConfigValue(self, category, option, value, section):
+ def setConfigValue(self, section, option, value):
"""
Parameters:
- - category
+ - section
- option
- value
- - section
"""
- self.send_setConfigValue(category, option, value, section)
+ self.send_setConfigValue(section, option, value)
self.recv_setConfigValue()
- def send_setConfigValue(self, category, option, value, section):
+ def send_setConfigValue(self, section, option, value):
self._oprot.writeMessageBegin('setConfigValue', TMessageType.CALL, self._seqid)
args = setConfigValue_args()
- args.category = category
+ args.section = section
args.option = option
args.value = value
- args.section = section
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
@@ -552,6 +553,36 @@ class Client(Iface):
return result.success
raise TApplicationException(TApplicationException.MISSING_RESULT, "getPluginConfig failed: unknown result");
+ def configureSection(self, section):
+ """
+ Parameters:
+ - section
+ """
+ self.send_configureSection(section)
+ return self.recv_configureSection()
+
+ def send_configureSection(self, section):
+ self._oprot.writeMessageBegin('configureSection', TMessageType.CALL, self._seqid)
+ args = configureSection_args()
+ args.section = section
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_configureSection(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = configureSection_result()
+ result.read(self._iprot)
+ self._iprot.readMessageEnd()
+ if result.success is not None:
+ return result.success
+ raise TApplicationException(TApplicationException.MISSING_RESULT, "configureSection failed: unknown result");
+
def pauseServer(self, ):
self.send_pauseServer()
self.recv_pauseServer()
@@ -2427,6 +2458,7 @@ class Processor(Iface, TProcessor):
self._processMap["setConfigValue"] = Processor.process_setConfigValue
self._processMap["getConfig"] = Processor.process_getConfig
self._processMap["getPluginConfig"] = Processor.process_getPluginConfig
+ self._processMap["configureSection"] = Processor.process_configureSection
self._processMap["pauseServer"] = Processor.process_pauseServer
self._processMap["unpauseServer"] = Processor.process_unpauseServer
self._processMap["togglePause"] = Processor.process_togglePause
@@ -2514,7 +2546,7 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = getConfigValue_result()
- result.success = self._handler.getConfigValue(args.category, args.option, args.section)
+ result.success = self._handler.getConfigValue(args.section, args.option)
oprot.writeMessageBegin("getConfigValue", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
@@ -2525,7 +2557,7 @@ class Processor(Iface, TProcessor):
args.read(iprot)
iprot.readMessageEnd()
result = setConfigValue_result()
- self._handler.setConfigValue(args.category, args.option, args.value, args.section)
+ self._handler.setConfigValue(args.section, args.option, args.value)
oprot.writeMessageBegin("setConfigValue", TMessageType.REPLY, seqid)
result.write(oprot)
oprot.writeMessageEnd()
@@ -2553,6 +2585,17 @@ class Processor(Iface, TProcessor):
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_configureSection(self, seqid, iprot, oprot):
+ args = configureSection_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = configureSection_result()
+ result.success = self._handler.configureSection(args.section)
+ oprot.writeMessageBegin("configureSection", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
def process_pauseServer(self, seqid, iprot, oprot):
args = pauseServer_args()
args.read(iprot)
@@ -3302,28 +3345,24 @@ class Processor(Iface, TProcessor):
class getConfigValue_args(TBase):
"""
Attributes:
- - category
- - option
- section
+ - option
"""
__slots__ = [
- 'category',
- 'option',
'section',
+ 'option',
]
thrift_spec = (
None, # 0
- (1, TType.STRING, 'category', None, None, ), # 1
+ (1, TType.STRING, 'section', None, None, ), # 1
(2, TType.STRING, 'option', None, None, ), # 2
- (3, TType.STRING, 'section', None, None, ), # 3
)
- def __init__(self, category=None, option=None, section=None,):
- self.category = category
- self.option = option
+ def __init__(self, section=None, option=None,):
self.section = section
+ self.option = option
class getConfigValue_result(TBase):
@@ -3347,32 +3386,28 @@ class getConfigValue_result(TBase):
class setConfigValue_args(TBase):
"""
Attributes:
- - category
+ - section
- option
- value
- - section
"""
__slots__ = [
- 'category',
+ 'section',
'option',
'value',
- 'section',
]
thrift_spec = (
None, # 0
- (1, TType.STRING, 'category', None, None, ), # 1
+ (1, TType.STRING, 'section', None, None, ), # 1
(2, TType.STRING, 'option', None, None, ), # 2
(3, TType.STRING, 'value', None, None, ), # 3
- (4, TType.STRING, 'section', None, None, ), # 4
)
- def __init__(self, category=None, option=None, value=None, section=None,):
- self.category = category
+ def __init__(self, section=None, option=None, value=None,):
+ self.section = section
self.option = option
self.value = value
- self.section = section
class setConfigValue_result(TBase):
@@ -3438,6 +3473,43 @@ class getPluginConfig_result(TBase):
self.success = success
+class configureSection_args(TBase):
+ """
+ Attributes:
+ - section
+ """
+
+ __slots__ = [
+ 'section',
+ ]
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'section', None, None, ), # 1
+ )
+
+ def __init__(self, section=None,):
+ self.section = section
+
+
+class configureSection_result(TBase):
+ """
+ Attributes:
+ - success
+ """
+
+ __slots__ = [
+ 'success',
+ ]
+
+ thrift_spec = (
+ (0, TType.STRUCT, 'success', (ConfigSection, ConfigSection.thrift_spec), None, ), # 0
+ )
+
+ def __init__(self, success=None,):
+ self.success = success
+
+
class pauseServer_args(TBase):
__slots__ = [
diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
index 1299b515d..1925029ed 100644
--- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
+++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py
@@ -78,20 +78,6 @@ class Destination(TBase):
"Queue": 1,
}
-class ElementType(TBase):
- Package = 0
- File = 1
-
- _VALUES_TO_NAMES = {
- 0: "Package",
- 1: "File",
- }
-
- _NAMES_TO_VALUES = {
- "Package": 0,
- "File": 1,
- }
-
class Input(TBase):
NONE = 0
TEXT = 1
@@ -270,68 +256,6 @@ class ServerStatus(TBase):
self.reconnect = reconnect
-class ConfigItem(TBase):
- """
- Attributes:
- - name
- - description
- - value
- - type
- """
-
- __slots__ = [
- 'name',
- 'description',
- 'value',
- 'type',
- ]
-
- thrift_spec = (
- None, # 0
- (1, TType.STRING, 'name', None, None, ), # 1
- (2, TType.STRING, 'description', None, None, ), # 2
- (3, TType.STRING, 'value', None, None, ), # 3
- (4, TType.STRING, 'type', None, None, ), # 4
- )
-
- 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(TBase):
- """
- Attributes:
- - name
- - description
- - items
- - outline
- """
-
- __slots__ = [
- 'name',
- 'description',
- 'items',
- 'outline',
- ]
-
- thrift_spec = (
- None, # 0
- (1, TType.STRING, 'name', None, None, ), # 1
- (2, TType.STRING, 'description', None, None, ), # 2
- (3, TType.LIST, 'items', (TType.STRUCT,(ConfigItem, ConfigItem.thrift_spec)), None, ), # 3
- (4, TType.STRING, 'outline', None, None, ), # 4
- )
-
- def __init__(self, name=None, description=None, items=None, outline=None,):
- self.name = name
- self.description = description
- self.items = items
- self.outline = outline
-
-
class FileData(TBase):
"""
Attributes:
@@ -509,6 +433,84 @@ class InteractionTask(TBase):
self.plugin = plugin
+class ConfigItem(TBase):
+ """
+ Attributes:
+ - name
+ - long_name
+ - description
+ - type
+ - default_value
+ - value
+ """
+
+ __slots__ = [
+ 'name',
+ 'long_name',
+ 'description',
+ 'type',
+ 'default_value',
+ 'value',
+ ]
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.STRING, 'long_name', 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, long_name=None, description=None, type=None, default_value=None, value=None,):
+ self.name = name
+ self.long_name = long_name
+ self.description = description
+ self.type = type
+ self.default_value = default_value
+ self.value = value
+
+
+class ConfigSection(TBase):
+ """
+ Attributes:
+ - name
+ - long_name
+ - description
+ - long_description
+ - items
+ - handler
+ """
+
+ __slots__ = [
+ 'name',
+ 'long_name',
+ 'description',
+ 'long_description',
+ 'items',
+ 'handler',
+ ]
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.STRING, 'long_name', 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.MAP, 'handler', (TType.STRING,None,TType.STRUCT,(InteractionTask, InteractionTask.thrift_spec)), None, ), # 6
+ )
+
+ def __init__(self, name=None, long_name=None, description=None, long_description=None, items=None, handler=None,):
+ self.name = name
+ self.long_name = long_name
+ self.description = description
+ self.long_description = long_description
+ self.items = items
+ self.handler = handler
+
+
class CaptchaTask(TBase):
"""
Attributes:
@@ -544,31 +546,23 @@ class EventInfo(TBase):
"""
Attributes:
- eventname
- - id
- - type
- - destination
+ - event_args
"""
__slots__ = [
'eventname',
- 'id',
- 'type',
- 'destination',
+ 'event_args',
]
thrift_spec = (
None, # 0
(1, TType.STRING, 'eventname', None, None, ), # 1
- (2, TType.I32, 'id', None, None, ), # 2
- (3, TType.I32, 'type', None, None, ), # 3
- (4, TType.I32, 'destination', None, None, ), # 4
+ (2, TType.LIST, 'event_args', (TType.STRING,None), None, ), # 2
)
- def __init__(self, eventname=None, id=None, type=None, destination=None,):
+ def __init__(self, eventname=None, event_args=None,):
self.eventname = eventname
- self.id = id
- self.type = type
- self.destination = destination
+ self.event_args = event_args
class UserData(TBase):
@@ -609,48 +603,52 @@ class UserData(TBase):
class AccountInfo(TBase):
"""
Attributes:
- - validuntil
- - login
- - options
+ - plugin
+ - loginname
- valid
+ - validuntil
- trafficleft
- maxtraffic
- premium
- - type
+ - activated
+ - options
"""
__slots__ = [
- 'validuntil',
- 'login',
- 'options',
+ 'plugin',
+ 'loginname',
'valid',
+ 'validuntil',
'trafficleft',
'maxtraffic',
'premium',
- 'type',
+ 'activated',
+ 'options',
]
thrift_spec = (
None, # 0
- (1, TType.I64, 'validuntil', None, None, ), # 1
- (2, TType.STRING, 'login', None, None, ), # 2
- (3, TType.MAP, 'options', (TType.STRING,None,TType.LIST,(TType.STRING,None)), None, ), # 3
- (4, TType.BOOL, 'valid', None, None, ), # 4
+ (1, TType.STRING, 'plugin', None, None, ), # 1
+ (2, TType.STRING, 'loginname', None, None, ), # 2
+ (3, TType.BOOL, 'valid', None, None, ), # 3
+ (4, TType.I64, 'validuntil', None, None, ), # 4
(5, TType.I64, 'trafficleft', None, None, ), # 5
(6, TType.I64, 'maxtraffic', None, None, ), # 6
(7, TType.BOOL, 'premium', None, None, ), # 7
- (8, TType.STRING, 'type', None, None, ), # 8
+ (8, TType.BOOL, 'activated', None, None, ), # 8
+ (9, TType.MAP, 'options', (TType.STRING,None,TType.LIST,(TType.STRING,None)), None, ), # 9
)
- 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
+ def __init__(self, plugin=None, loginname=None, valid=None, validuntil=None, trafficleft=None, maxtraffic=None, premium=None, activated=None, options=None,):
+ self.plugin = plugin
+ self.loginname = loginname
self.valid = valid
+ self.validuntil = validuntil
self.trafficleft = trafficleft
self.maxtraffic = maxtraffic
self.premium = premium
- self.type = type
+ self.activated = activated
+ self.options = options
class ServiceCall(TBase):