Kodi Community Forum
How to use Label2 for TV Shows? - 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: How to use Label2 for TV Shows? (/showthread.php?tid=347646)



How to use Label2 for TV Shows? - vl_maksime - 2019-09-29

I'm set label2mask property for the sorth method with xbmcplugin.addSortMethod.
For movies 'Label2' is filled correctly.
Image
But for the TV shows 'Label2' is not filled.
Image
Here is example of my code:
python:
def list_movies():

# Movie item
list_item = xbmcgui.ListItem(label='Movie Item')

list_item.setInfo('video', {'title': 'Movie Item',
'year': 2019,
'mpaa': '18+',
'mediatype': 'movie'})

list_item.setProperty('IsPlayable', 'true')
url = ''
is_folder = False

xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)

# Folder settings
xbmcplugin.setContent(_handle, 'movies')
xbmcplugin.setPluginCategory(_handle, 'Movies')
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE, '%Y / %O')

xbmcplugin.endOfDirectory(_handle)


def list_tvshows():

# TV Show item
list_item = xbmcgui.ListItem(label='TV Show Item')

list_item.setInfo('video', {'title': 'TV Show Item',
'year': 2019,
'mpaa': '18+',
'mediatype': 'movie'})

url = ''
is_folder = True

xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)

# Folder settings
xbmcplugin.setContent(_handle, 'tvshows')
xbmcplugin.setPluginCategory(_handle, 'TV Shows')
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE, '%Y / %O')

xbmcplugin.endOfDirectory(_handle)
Here is full addon: plugin.video.testlabel2.zip
What I need to do so that 'Label2' is filled for a TV show?


RE: How to use Label2 for TV Shows? - ronie - 2019-09-29

the functionality to set label2 for folder items was recently added to Kodi (https://github.com/xbmc/xbmc/pull/16433),
so make sure you're running at least Kodi 18.4

i'm not sure which sort methods can be used for tv show folders... but at least this one works:
python:
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_TITLE, '%Y / %O')



RE: How to use Label2 for TV Shows? - vl_maksime - 2019-09-29

(2019-09-29, 19:08)ronie Wrote: so make sure you're running at least Kodi 18.4
I'm using stable build of Kodi 18.4
 
(2019-09-29, 19:08)ronie Wrote: i'm not sure which sort methods can be used for tv show folders... but at least this one works:
python:
xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_TITLE, '%Y / %O')
Yes, this sorting method works. But only year value is shown, MPAA value is not showed.
Looks like label2mask value is ignored for folders. When I'm set the sort method to "xbmcplugin.SORT_METHOD_MPAA_RATING" it's show only MPAA value.


RE: How to use Label2 for TV Shows? - vl_maksime - 2019-10-04

Should be fixed by PR #16705