Need help with json request
#1
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:

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...
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#2
70 Views... nothing Sad

Is it my json command?

What would be the correct command query if a folder or link exists within a plugins folder?
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
The JSON-RPC request looks correct but I can't comment on the python code.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply

Logout Mark Read Team Forum Stats Members Help
Need help with json request0