Kodi Community Forum
Best way for plugin list item that is not a folder and not playable? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Best way for plugin list item that is not a folder and not playable? (/showthread.php?tid=334677)



Best way for plugin list item that is not a folder and not playable? - matthuisman - 2018-08-16

I have a few items that are not a folder, and not playable.
eg. Login / Logout or Settings shortcut.

I have tried the below methods but all have some downside

Method 1:
isFolder = False, Playable=(not set or False).
This works pretty good except the list item still has a "Play / Mark as Watched" context menu items.
Maybe that is a bug?
If the user clicks Play, then you get an endless loading loop (KODI 18).
You also eventually get the "Failed to play" warning.
You also don't get a loading dialog while the action is doing it's work.

Method 2 (currently using):
isFolder = True, Playable(not set or False).
No Play context menu item = good.
But, once the plugin is called, you get an endless loading loop (KODI 18).
I need to add xbmcplugin.endOfDirectory with succeeded=False to fix that.
This causes a warning in the log.
If you use succeeded=True, then the plugin shows an empty directory.

KODI 18 seems to show this endless loading loop for any items marked as a Folder that don't have endOfDirectory called.
eg. if an error occurs during loading the content.
KODI 17 doesn't though.


Best way for plugin list item that is not a folder and not playable? - enen92 - 2018-08-17

What if you replace the context menu items in a) with an empty list?

listItem.addContextMenuItems([], replaceItems=True)

If this does not work please provide samples so anyone can debug


RE: Best way for plugin list item that is not a folder and not playable? - matthuisman - 2018-08-17

Thanks for the suggestion.

It looks like replaceItems was removed in Kodi 17 API
https://forum.kodi.tv/showthread.php?tid=270648
https://codedocs.xyz/AlwinEsch/kodi/group__python__xbmcgui__listitem.html#ga76a5f710e5c08dc2033a09e23a1a78c2

I'll move convo over to that forum as it appears to be a bug


RE: Best way for plugin list item that is not a folder and not playable? - enen92 - 2018-08-17

My bad, yes it was removed.
If you still find any bug please provide a PoC plugin which reproduces the error