Hey everyone!
I started developing an add-on for personal use just a couple of days ago and I was plesantly surprise with how quick it was to get a working version up and running.
Basically, I’m using it to load JSON (dinamically generated on my server using PHP) to display a list of Movies and TV Episodes I can watch online (my own personal VUDU collection, Amazon, etc).
I realize the thread title is quite vague but I had three totally unrelated questions of issues I ran into:
1.
I want to open links in a browser (using a third party launcher) and thus, not use the built-in player at all.
I am able to launch the plugin sucessfully, but I always get the “Playback Failed” message. (“One of more items failed to play. Check the log for more information about this message.”).
I’m wondering what exactly is the right to call a plugin without Kodi thinking that I’m trying to obtain a stream/playlist from it?
I’ve tried several ways of doing/hacking it and with all three I had the same results.
li = xbmcgui.ListItem()
li.setPath(plugin_link)
xbmcplugin.setResolvedUrl(addon_handle, True, li)
xbmc.executebuiltin('PlayMedia(' + plugin_link + ')')
xbmc.executebuiltin('RunPlugin(' + plugin_link + ')')
I understand how the first two might be calling the player, but I don’t get why the third one is.
2.
When listing TV Show episodes, only the episode number is shown, instead of the usual “1×01, 1×02, …” format.
I’ve set the episode and season values using both the “setProperty” and “setInfo”, but still unsucessfully. They do show up on the left side as you can see on the screenshots.
When adding the sort method “SORT_METHOD_PRODUCTIONCODE”, I am able to see the season number, but the episodes are out of order.
Is there even a way to set the production code? I couldn’t seem to find a documentation on it.
This is how it looks like for me.
Using SORT_METHOD_PRODUCTIONCODE: https://drive.google.com/open?id=0B2Lx71…GxjN21pQ2M
Using SORT_METHOD_EPISODE: https://drive.google.com/open?id=0B2Lx71…WE2dlhUc0E
3.
The JSON file I’m currently generating has all the information I need to run the addon – all Movie, TV Show and Episode infos (and I understand how this is lazy programming and problematic, as it’s quite a huge file).
That being said, I couldn’t find a way to load it just once at the beginning (even if it takes while) and then be able to navigate the screens without delay.
As I understand it, each time I enter a folder, the plugin has to be called again (with different parameters), so as it is, I have to load the same JSON 3 times: Load TV Show Details, Load Episode Details, Load Available Sources.
if mode is None:
url = build_url({'mode': 'movies', 'foldername': 'Movies'})
li = xbmcgui.ListItem('Movies', iconImage='DefaultFolder.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
url = build_url({'mode': 'shows', 'foldername': 'TV Shows'})
li = xbmcgui.ListItem('TV Shows', iconImage='DefaultFolder.png')
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
listitem=li, isFolder=True)
xbmcplugin.endOfDirectory(addon_handle)
elif mode[0] == 'movies':
xbmcplugin.setContent(addon_handle, 'movies')
response = urllib2.urlopen(json_url_movies, timeout = 30)
data = json.loads(response.read())
(...)
elif mode[0] == 'shows':
xbmcplugin.setContent(addon_handle, 'tvshows')
response = urllib2.urlopen(json_url_shows, timeout = 30)
(...)
elif mode[0] == 'show_episodes':
xbmcplugin.setContent(addon_handle, 'episodes')
response = urllib2.urlopen(json_url_shows, timeout = 30)
(...)
elif mode[0] == 'streaming_sources':
type = args['type'][0]
if type == "movies":
response = urllib2.urlopen(json_url_movies, timeout = 30)
data = json.loads(response.read())
if type == "shows":
response = urllib2.urlopen(json_url_shows, timeout = 30)
Is there any way to achieve this?
Thanks!