Skip to content

Commit

Permalink
Fix icons with installed addons but not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bittor7x0 committed Dec 29, 2022
1 parent d207575 commit 48f9162
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ def list_addons():
#get addon.xml content
xml_content=openfile(addon_xml_path)

#get icon from addon.xml because creating a xbmcaddon.Addon(individual_addon) object causes the exception "Unknown addon id 'xxxx'" with installed addons but not enabled
root = ET.fromstring(xml_content)
xml_icon = root.findall("./extension/assets/icon")
addon_icon_path = os.path.join(path_to_addon,xml_icon[0].text if xml_icon else 'icon.png')

if re.search(SERVICE_DISABLED,xml_content):
#addon with service off
addDir('[B][COLOR gold]%s[/B] (off)[/COLOR]' % (individual_addon),path_to_addon,1,xbmcaddon.Addon(individual_addon).getAddonInfo('icon'))
addDir('[B][COLOR gold]%s[/B] (off)[/COLOR]' % (individual_addon),path_to_addon,1,addon_icon_path)
elif re.search('point="xbmc.service"',xml_content):
#addon with service on
addDir('%s (on)' % (individual_addon),path_to_addon,1,xbmcaddon.Addon(individual_addon).getAddonInfo('icon'))
addDir('%s (on)' % (individual_addon),path_to_addon,1,addon_icon_path)
else:
#addon with no service
pass
Expand Down

0 comments on commit 48f9162

Please sign in to comment.