(2015-03-21, 00:50)spoyser Wrote: (2015-03-20, 19:34)sMystero Wrote: Hi spoyser
(2015-03-19, 22:03)spoyser Wrote: So according to your pseudocode the list items that led to param == A and param == C should have isFolder == True, whilst the other (ie B) should be False because that one doesn't create a new list)
I need to set isFolder to False because the when users press 'I' on an item, the skin shows different informations according to the isFolder status. Maybe ther's a way to force skin to behave like the isFolder is true...
(2015-03-19, 22:03)spoyser Wrote: Also you ask about preventing playing a playable item, that makes no sense, if it is playable them you shouldn't be trying to prevent it from playing!
I need to prevent playing because when I set the isPlayable status I don't yet know if the item will be playable. So I choose not to set isPlayable (I've found that setting isPlayable to False is the same that setting it to True), and manage the play manually, checking the existance of the url when it's choosed by the user.
(2015-03-19, 22:03)spoyser Wrote: Look in my Super Favourites addon for examples of virtually every possible way of creating list items, playable items, triggering other addons, using executebuiltin, etc
Thank a lot, I'll certainly take a look at it to get usefull techniques.
It might be easier to grasp what you are doing if you post the actual code (pastebin) rather than pseudocode.
What you have at the moment though (ie the B stuff), is definitely wrong (even if it works LOL)
With regards playback, if you are going to manage the playback yourself (presumably by calling xbmc.Player().play() at some stage) then you should always set isPlayable to False, this is because setting it to True only means Kodi expects xbmcplugin.setResolvedUrl to be called (by your addon) when the listitem is clicked.
This appears to be a common area of confusion with many addon developers, isPlayable doesn't really mean the item is a playable, it only means Kodi will wait for a call to xbmcplugin.setResolvedUrl and when this is called it will play the item. If you are going to play the item using xbmc.Player().play() then as far as Kodi is concerned it isn't playable.
(Super Favourites has code specifically to deal with addons erroneously coded in this way)
You're right. The B stuff has been replaced by
Code:
xbmc.executebuiltin('Container.Update(%s)' % url)
The previous code allow me to "route" the call, so I can choose whether or not to create the item folder.
pseudocode:
Code:
param = sys.argv[2]
....
if param == 'A':
li = xbmcgui.ListItem(label=item.title, label2=item.title)
url = "plugin://.....¶m = 'B'"
xbmcplugin.addDirectoryItem(config.get_handle(), url=url, listitem=li, isFolder=False, totalItems=0)
xbmcplugin.endOfDirectory(config.get_handle(), True, False)
elif param == 'B':
if chekIt() == True: #do some complex and time consuming checks to be done only if the end-user click on the item
url = "plugin://.....¶m = 'C'"
xbmc.executebuiltin('Container.Update(%s)' % url) #The history is well updated and everything works like a charm
else:
show_dialog_error("there's an error with the server")
# nothing else to do and no error on the xbmc.log like cguiwinodw::......
elif param == 'C'
title = "whatever you want"
li = xbmcgui.ListItem(label=item.title, label2=item.title)
url = "plugin://.....¶m = 'xxx'"
xbmcplugin.addDirectoryItem(config.get_handle(), url=url, listitem=li, isFolder=False, totalItems=0)
... repeat previous 4 lines x times
xbmcplugin.endOfDirectory(config.get_handle(), True, False)
#this list REPLACES the previous list build on A section. If end users goes back from this list, than the A list reconstructs perfectly
It's hard to post all the code because it's wrapped in some classes.
(2015-03-21, 00:50)spoyser Wrote: With regards playback, if you are going to manage the playback yourself (presumably by calling xbmc.Player().play() at some stage) then you should always set isPlayable to False, this is because setting it to True only means Kodi expects xbmcplugin.setResolvedUrl to be called (by your addon) when the listitem is clicked.
For the isPlayable issue I've noted that you shouldn't never set it to "false" otherwise it behaves like it has been set to true. To behave as "a non playable item" you should not set the property at all.
For the setResolvedUrl now (and only now, after spending hours and hours....
) it's very clear for me how it works but at the moment I prefere to call xbmc.Player().play() instead of using setResolvedUrl mechanism.
Again thank you very much.