Skip to content

Instantly share code, notes, and snippets.

@garbear
Created February 20, 2013 02:47
Show Gist options
  • Save garbear/4992364 to your computer and use it in GitHub Desktop.
Save garbear/4992364 to your computer and use it in GitHub Desktop.
Addons.GetAddons( { "enabled": "uninstalled" } ) and xbmcaddon.Addon(installedOnly=False) test
import os, sys
import xbmc, xbmcaddon
import json
def log(msg):
xbmc.log('GETADDONS TEST: ' + str(msg), level=xbmc.LOGDEBUG)
if ( __name__ == "__main__" ):
installedAddons = []
installedJson = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 1, "method": "Addons.GetAddons", "params": { "type": "xbmc.gameclient", "enabled": "all" } }')
for addonObj in json.loads(installedJson)[u'result'][u'addons']:
id = addonObj[u'addonid']
addon = xbmcaddon.Addon(id)
# extensions and platforms are "|" separated, extensions may or may not have a leading "."
installedAddons.append({id: {'extensions': addon.getAddonInfo('extensions'), 'platforms': addon.getAddonInfo('platforms')}})
log(installedAddons)
uninstalledAddons = []
uninstalledJson = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "id": 2, "method": "Addons.GetAddons", "params": { "type": "xbmc.gameclient", "enabled": "uninstalled" } }')
for addonObj in json.loads(uninstalledJson)[u'result'][u'addons']:
id = addonObj[u'addonid']
addon = xbmcaddon.Addon(id, installedOnly=False)
uninstalledAddons.append({id: {'extensions': addon.getAddonInfo('extensions'), 'platforms': addon.getAddonInfo('platforms')}})
log(uninstalledAddons)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment