Hello everyone!
This is the first time form me developing a Kodi Addon and I am having a small issue to which I cannot find the solution elsewhere.
I am trying to list some elements but the picture does not show up.
This is the code that I am using:
li = xbmcgui.ListItem('Antenna Sicilia - Live', iconImage='resources/logos/antenna-sicilia.png')
If I use a Web URL then it works but I cannot get iconImage to work with a picture locally stored.
Does anyone have any suggestions?
Thanks everyone for your time!
I have a script addon using custom GUI. I put the images in resources\skins\Default\media
I refer to them using:
Code:
def xbmc_notify(line1, line2, time=3000, icon=''):
if icon and os.path.sep not in icon:
icon=os.path.join(addon.getAddonInfo('path'), 'resources','skins','Default','media', icon)
xbmcgui.Dialog().notification( line1, line2, icon, time)
also, to get in the official repo, the mods will ask you to use
li.setArt({"thumb": iconImage, "icon":iconImage, })
instead of
li = xbmcgui.ListItem('Antenna Sicilia - Live', iconImage='resources/logos/antenna-sicilia.png')
Thank for your reply!
Unfortunately it is not working for me, yet!
I kind of adapted your code for my purposes and here's what I did:
li = xbmcgui.ListItem('Antenna Sicilia - Live')
icon=os.path.join(addon.getAddonInfo('path'), 'resources','logos', 'antenna-sicilia.png')
li.setArt({ "thumb": icon, "icon":icon, })
But I get a weird error on this line:
icon=os.path.join(addon.getAddonInfo('path'), 'resources','logos', 'antenna-sicilia.png')
The error seems to occur on addon.getAddonInfo('path').
Any suggestion?
This works for me (hak5_list_episodes.py):
IMAGES_PATH = os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'resources', 'images')
...
list_item = xbmcgui.ListItem(LANGUAGE(30200), thumbnailImage=os.path.join(IMAGES_PATH, 'next-page.png'))
try this:
Code:
addon_id = 'plugin.video.your_addon_name'
selfAddon = xbmcaddon.Addon(id=addon_id)
addonfolder = selfAddon.getAddonInfo('path')
artfolder = addonfolder + '/resources/media/'
#root
myFanart = addonfolder + '/fanart.jpg'
#folder => 'C:\Users\Your_User\AppData\Roaming\Kodi\addons\plugin.video.your_addon_name\resources\media\cat'
myCategory = artfolder + 'cat/anime.jpg'
(2017-07-17, 19:40)Skipmode A1 Wrote: [ -> ]This works for me (hak5_list_episodes.py):
IMAGES_PATH = os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'resources', 'images')
...
list_item = xbmcgui.ListItem(LANGUAGE(30200), thumbnailImage=os.path.join(IMAGES_PATH, 'next-page.png'))
I will try your code soon, however I am curious what "LANGUAGE(30200)" means. Could you explain what does that mean?
It's a localized text string. In this case the link will be have the text 'Next page'.
SETTINGS = xbmcaddon.Addon()
LANGUAGE = SETTINGS.getLocalizedString
Strings.po:
...
msgctxt "#30200"
msgid "Next page"
msgstr ""
...
Also my first time posting, well about coding anyway, and currently working on a simple RetroArch frontend as a Kodi dev learning project.
This worked for me so I could display icons for an item without having to write a full path that would give problems depending on what OS or fork you are using, be it libreelec for Pi or Kodi for desktop/Android/iPad.
Code:
ADDON_ID = 'plugin.video.name'
addon = xbmcaddon.Addon(id=ADDON_ID)
addon_dir = xbmc.translatePath( addon.getAddonInfo('path') )
icon_file = os.path.join(addon_dir, "resources", "assets", "settings.png")
li = xbmcgui.ListItem('Antenna Sicilia - Live', iconImage=icon_file)
hope this helps.