Addons.SetAddonEnabled not consistent
#1
Using the V6 API, if you call the method ''Addons.SetAddonEnabled" with the following params:

Code:
{
  "addonid": "",
  "enabled": true
}

Kodi will return a 200 OK. But if you change "enable" by false or "toggle", it will return:

Code:
"error": {
    "code": -32602,
    "message": "Invalid params."
}

I think all the results should be the same. If you have an error when trying to disable a non-existing addon, you should also have an error when trying to enable it IMO.
Reply
#2
sounds right. i assume your filling in the addonid...
so post your code and we can tell you if your doing it correctly.
Reply
#3
No, I'm not filling the addonid. I wanted to test what happened when targeting a non-existing addon using an empty addonid. That said, using a wrong addonid (like "donotexist" for example) will have the exact same result.

Enable request

Code:
{
  "url": "http://192.168.1.18:8000/jsonrpc",
  "method": "POST",
  "headers": {
    "Authorization": "Basic a29kaTprb2Rp",
    "Content-Type": "application/json"
  },
  "body": {
    "jsonrpc": "2.0",
    "id": 7,
    "method": "Addons.SetAddonEnabled",
    "params": {
      "addonid": "donotexist",
      "enabled": true
    }
  }
}

Enable response

Code:
{
  "id": 7,
  "jsonrpc": "2.0",
  "result": "OK"
}

Disable request

Code:
{
  "url": "http://192.168.1.18:8000/jsonrpc",
  "method": "POST",
  "headers": {
    "Authorization": "Basic a29kaTprb2Rp",
    "Content-Type": "application/json"
  },
  "body": {
    "jsonrpc": "2.0",
    "id": 8,
    "method": "Addons.SetAddonEnabled",
    "params": {
      "addonid": "donotexist",
      "enabled": false
    }
  }
}

Disable response

Code:
{
  "error": {
    "code": -32602,
    "message": "Invalid params."
  },
  "id": 8,
  "jsonrpc": "2.0"
}
Reply
#4
ya I suppose they both should fail the same. seems buggy.
Reply
#5
Looking at it this is a problem in our internal implementation of enabling/disabling addons. Enabling a non existing addon succeeds (but doesn't do anything) but disabling it fails. This is because we keep a list of disabled addons (and assume that all non-disabled addons are enabled) and when we try to enable addon and it's not part of the list of disabled addons it's assumed to already be enabled.

I'll add an additional check to see if an addon with that ID exists before calling these oddly implemented methods.
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
#6
Should be fixed with https://github.com/xbmc/xbmc/commit/2103...bd9e202e9a. The behaviour itself was never broken i.e. nothing was enabled/disabled that didn't exist, just the response was wrong.
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
#7
Thanks for the fix!
Reply

Logout Mark Read Team Forum Stats Members Help
Addons.SetAddonEnabled not consistent0