Skip to content

Instantly share code, notes, and snippets.

@Hellowlol
Forked from garbear/default.py
Created July 10, 2014 10:26
Show Gist options
  • Save Hellowlol/3a5f762c57887277a6f8 to your computer and use it in GitHub Desktop.
Save Hellowlol/3a5f762c57887277a6f8 to your computer and use it in GitHub Desktop.
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