-
-
Save Hellowlol/3a5f762c57887277a6f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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