diff options
Diffstat (limited to 'module/remote')
-rw-r--r-- | module/remote/json_converter.py | 4 | ||||
-rw-r--r-- | module/remote/pyload.thrift | 21 | ||||
-rw-r--r-- | module/remote/ttypes.py | 39 | ||||
-rw-r--r-- | module/remote/ttypes_debug.py | 11 |
4 files changed, 45 insertions, 30 deletions
diff --git a/module/remote/json_converter.py b/module/remote/json_converter.py index ad7645ccc..5b85f30cd 100644 --- a/module/remote/json_converter.py +++ b/module/remote/json_converter.py @@ -11,6 +11,9 @@ import ttypes from ttypes import BaseObject from ttypes import ExceptionObject +# compact json separator +separators = (',', ':') + # json encoder that accepts TBase objects class BaseEncoder(json.JSONEncoder): @@ -34,6 +37,7 @@ def convert_obj(dct): def dumps(*args, **kwargs): kwargs['cls'] = BaseEncoder + kwargs['separators'] = separators return json.dumps(*args, **kwargs) diff --git a/module/remote/pyload.thrift b/module/remote/pyload.thrift index 514c3215c..077810ecb 100644 --- a/module/remote/pyload.thrift +++ b/module/remote/pyload.thrift @@ -246,11 +246,12 @@ struct ConfigHolder { } struct ConfigInfo { - 1: string name, + 1: string name 2: string label, 3: string description, - 4: bool saved, - 5: bool activated, + 4: bool addon, + 5: bool user_context, + 6: optional bool activated, } struct EventInfo { @@ -353,10 +354,16 @@ service Pyload { /////////////////////// map<string, ConfigHolder> getConfig(), - list<ConfigInfo> getGlobalPlugins(), - list<ConfigInfo> getUserPlugins(), + string getConfigValue(1: string section, 2: string option), + + // two methods with ambigous classification, could be configuration or addon related + list<ConfigInfo> getCoreConfig(), + list<ConfigInfo> getPluginConfig(), + list<ConfigInfo> getAvailablePlugins(), ConfigHolder configurePlugin(1: PluginName plugin), + + void setConfigValue(1: string section, 2: string option, 3: string value), void saveConfig(1: ConfigHolder config), void deleteConfig(1: PluginName plugin), void setConfigHandler(1: PluginName plugin, 2: InteractionID iid, 3: JSONString value), @@ -511,8 +518,8 @@ service Pyload { // Addon Methods /////////////////////// - map<PluginName, list<AddonInfo>> getAllInfo(), - list<AddonInfo> getInfoByPlugin(1: PluginName plugin), + //map<PluginName, list<AddonInfo>> getAllInfo(), + //list<AddonInfo> getInfoByPlugin(1: PluginName plugin), map<PluginName, list<AddonService>> getAddonHandler(), bool hasAddonHandler(1: PluginName plugin, 2: string func), diff --git a/module/remote/ttypes.py b/module/remote/ttypes.py index 0b9faea98..e8ef26dd2 100644 --- a/module/remote/ttypes.py +++ b/module/remote/ttypes.py @@ -138,16 +138,6 @@ class ConfigHolder(BaseObject): 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'] @@ -282,6 +272,17 @@ class PackageStats(BaseObject): self.sizetotal = sizetotal self.sizedone = sizedone +class PluginInfo(BaseObject): + __slots__ = ['name', 'label', 'description', 'addon', 'user_context', 'activated'] + + def __init__(self, name=None, label=None, description=None, addon=None, user_context=None, activated=None): + self.name = name + self.label = label + self.description = description + self.addon = addon + self.user_context = user_context + self.activated = activated + class ProgressInfo(BaseObject): __slots__ = ['plugin', 'name', 'statusmsg', 'eta', 'done', 'total', 'download'] @@ -413,14 +414,18 @@ class Iface(object): pass def getAllFiles(self): pass - def getAllInfo(self): - pass def getAllUserData(self): pass + def getAvailablePlugins(self): + pass def getCollector(self): pass def getConfig(self): pass + def getConfigValue(self, section, option): + pass + def getCoreConfig(self): + pass def getEvents(self, uuid): pass def getFileInfo(self, fid): @@ -431,10 +436,6 @@ class Iface(object): pass def getFilteredFiles(self, state): pass - def getGlobalPlugins(self): - pass - def getInfoByPlugin(self, plugin): - pass def getInteractionTask(self, mode): pass def getLog(self, offset): @@ -445,6 +446,8 @@ class Iface(object): pass def getPackageInfo(self, pid): pass + def getPluginConfig(self): + pass def getProgressInfo(self): pass def getServerStatus(self): @@ -453,8 +456,6 @@ class Iface(object): pass def getUserData(self): pass - def getUserPlugins(self): - pass def getWSAddress(self): pass def hasAddonHandler(self, plugin, func): @@ -499,6 +500,8 @@ class Iface(object): pass def setConfigHandler(self, plugin, iid, value): pass + def setConfigValue(self, section, option, value): + pass def setInteractionResult(self, iid, result): pass def setPackageFolder(self, pid, path): diff --git a/module/remote/ttypes_debug.py b/module/remote/ttypes_debug.py index 03d619dd4..17d602f97 100644 --- a/module/remote/ttypes_debug.py +++ b/module/remote/ttypes_debug.py @@ -10,7 +10,6 @@ classes = { 'AddonInfo' : [basestring, basestring, basestring], 'AddonService' : [basestring, basestring, (list, basestring), (None, int)], 'ConfigHolder' : [basestring, basestring, basestring, basestring, (list, ConfigItem), (None, (list, AddonInfo)), (None, (list, InteractionTask))], - 'ConfigInfo' : [basestring, basestring, basestring, bool, bool], 'ConfigItem' : [basestring, basestring, basestring, basestring, (None, basestring), basestring], 'DownloadInfo' : [basestring, basestring, basestring, int, basestring, basestring], 'DownloadProgress' : [int, int, int, int], @@ -24,6 +23,7 @@ classes = { 'PackageDoesNotExists' : [int], 'PackageInfo' : [int, basestring, basestring, int, int, basestring, basestring, basestring, int, (list, basestring), int, int, PackageStats, (list, int), (list, int)], 'PackageStats' : [int, int, int, int], + 'PluginInfo' : [basestring, basestring, basestring, bool, bool, (None, bool)], 'ProgressInfo' : [basestring, basestring, basestring, int, int, int, (None, DownloadProgress)], 'ServerStatus' : [int, int, int, bool, bool, bool], 'ServiceDoesNotExists' : [basestring, basestring], @@ -64,27 +64,27 @@ methods = { 'getAccounts': (list, AccountInfo), 'getAddonHandler': (dict, basestring, list), 'getAllFiles': TreeCollection, - 'getAllInfo': (dict, basestring, list), 'getAllUserData': (dict, int, UserData), + 'getAvailablePlugins': (list, PluginInfo), 'getCollector': (list, LinkStatus), 'getConfig': (dict, basestring, ConfigHolder), + 'getConfigValue': basestring, + 'getCoreConfig': (list, PluginInfo), 'getEvents': (list, EventInfo), 'getFileInfo': FileInfo, 'getFileTree': TreeCollection, 'getFilteredFileTree': TreeCollection, 'getFilteredFiles': TreeCollection, - 'getGlobalPlugins': (list, ConfigInfo), - 'getInfoByPlugin': (list, AddonInfo), 'getInteractionTask': InteractionTask, 'getLog': (list, basestring), 'getNotifications': (list, InteractionTask), 'getPackageContent': TreeCollection, 'getPackageInfo': PackageInfo, + 'getPluginConfig': (list, PluginInfo), 'getProgressInfo': (list, ProgressInfo), 'getServerStatus': ServerStatus, 'getServerVersion': basestring, 'getUserData': UserData, - 'getUserPlugins': (list, ConfigInfo), 'getWSAddress': basestring, 'hasAddonHandler': bool, 'isInteractionWaiting': bool, @@ -107,6 +107,7 @@ methods = { 'restartPackage': None, 'saveConfig': None, 'setConfigHandler': None, + 'setConfigValue': None, 'setInteractionResult': None, 'setPackageFolder': bool, 'setPassword': bool, |