2013-11-22, 23:38
Hi, I'm trying to add a plugin:// validator to my program.
I want to check if the plugin is installed, then check if the provided "shortcut" to the plugin is valid...
So far I have:
plugin = "plugin://plugin.video.jtv.archives/?url=&mode=2&name=military_history" <<arbitrary test link
I basically want to return a bool if this link is found...
everything works up till the json request, btw there is missing arguments for "sendJSON".
the command goes out but I'm stuck after that...
I'm not seeing a return from json to grab... i'm expecting to see "null" if found and error if not...
can someone help?
thanks...
I want to check if the plugin is installed, then check if the provided "shortcut" to the plugin is valid...
So far I have:
Code:
def plugin_ok(self, plugin):
self.PluginFound = False
self.PluginVaild = False
stream = plugin
self.log("plugin stream = " + stream)
id = plugin.split("/?")[0]
id = id.split('//', 1)[-1]
self.log("plugin id = " + id)
try:
xbmcaddon.Addon(id)
self.PluginFound = True
except Exception:
self.PluginFound = False
self.log("PluginFound = " + str(self.PluginFound))
if self.PluginFound == True:
try:
json_query = '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "files"}, "id": "1"}' % ( self.escapeDirJSON(stream),)
json_folder_detail = self.sendJSON(json_query)
#####################
self.PluginVaild = True
except Exception:
self.PluginVaild = False
plugin = "plugin://plugin.video.jtv.archives/?url=&mode=2&name=military_history" <<arbitrary test link
I basically want to return a bool if this link is found...
everything works up till the json request, btw there is missing arguments for "sendJSON".
the command goes out but I'm stuck after that...
I'm not seeing a return from json to grab... i'm expecting to see "null" if found and error if not...
can someone help?
thanks...