2020-07-10, 23:25
Im trying to add some data from a library item to a plugin listitem and after retrieving the artwork using the JSONRPC request i have had to encode the image url and put in my login details in order to get it to successfully load in the plugin.
So for example the artwork is being returned from the tvshowid via json RPC and comes back in the format like:
image://%2fhome%2f.kodi%2fuserdata%2faddon_data%2fplugin.video.somevideoplugin%2fTVShows%2f311711%2ffanart.jpg/
Initially i was just adding that within the fanart listitem property, as I would for a normal URL from tvdb or tmdb but that wouldn't actually load the image:// URL and i got nothing but grey boxes.
To get it to work I've had to strip off the trailing "/" then encode the image url "image://...." eg urllib.quote_plus(str('image://fkjhjkfhf...')[:-1]) and further i've had to append that to a url string containing my kodi login and port details before the image could be retrieved:
http://USERNAME:[email protected]:XXXX/image/ + urllib.quote_plus(str('image://fkjhjkfhf...')[:-1])
So i've got it to work, however should i not be able to reference the library images directly within the plugin?
Or if not directly can they not be loaded as a special path so you don't need to provide authentication or port details?
Ive tried searching but searching for image:// url kodi isnt really useful and the docs are not too useful either in this regard (and actually wrong, i had to inspect the kodi web interface before i could figure out the correct url).
So for example the artwork is being returned from the tvshowid via json RPC and comes back in the format like:
image://%2fhome%2f.kodi%2fuserdata%2faddon_data%2fplugin.video.somevideoplugin%2fTVShows%2f311711%2ffanart.jpg/
Initially i was just adding that within the fanart listitem property, as I would for a normal URL from tvdb or tmdb but that wouldn't actually load the image:// URL and i got nothing but grey boxes.
To get it to work I've had to strip off the trailing "/" then encode the image url "image://...." eg urllib.quote_plus(str('image://fkjhjkfhf...')[:-1]) and further i've had to append that to a url string containing my kodi login and port details before the image could be retrieved:
http://USERNAME:[email protected]:XXXX/image/ + urllib.quote_plus(str('image://fkjhjkfhf...')[:-1])
So i've got it to work, however should i not be able to reference the library images directly within the plugin?
Or if not directly can they not be loaded as a special path so you don't need to provide authentication or port details?
Ive tried searching but searching for image:// url kodi isnt really useful and the docs are not too useful either in this regard (and actually wrong, i had to inspect the kodi web interface before i could figure out the correct url).