Kodi Community Forum

Full Version: TVShow year, not seasons year
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I get the year tvshow was premiered in seasons page (View_Seasons.xml)? ListItem.Year displays seasons year but I want tv shows year. There is $INFO[container.showtitle] and $INFO[container.showplot] but is there a way to show "$INFO[container.showyear]"?
have you tried simply ".year"?

https://kodi.wiki/view/InfoLabels
Yes I have tried year but nothing.. I'm pretty sure it is possible somehow because I remember seeing it in some other skins. I can display selected seasons year but not tvshows year or what would be better, start and end year for example 1992-1999. Anyone?
The easiest way is with a second list that's empty:

xml:

<control type="list" id="6000">
  <visible>Container.Content(seasons)</visible>
  <itemlayout />
  <focusedlayout />
  <content sortby="year" sortorder="ascending">$INFO[Container.FolderPath]</content>
</control>

<control type="label">
  <top>300</top>
  <align>right</align>
  <label>$VAR[Seasons_Year_Label]</label>
</control>

<variable name="Seasons_Year_Label">
  <value condition="Integer.IsGreater(Container(6000).NumItems,1)">$INFO[Container(6000).ListItem(0).Year]$INFO[Container(6000).ListItem(-1).Year, - ]</value>
  <value>$INFO[Container(6000).ListItem(0).Year]</value>
</variable>

That will return the year range for the seasons of a show when you are on seasons level ("2020 - 2023"). I used a variable so if the list only has one item, i.e. it's only got one season, you can have it show as "2023" instead of "2023 - 2023". Beacause the list is sorted by ascending order, you can get the year the TV show started just by using "$INFO[Container(6000).ListItem(0).Year]" by itself.

The list uses the Container.FolderPath of the listitem selected in your main list to look up the information. The reason to use a second list instead of just doing $INFO[ListItemAbsolute(0).Year]$INFO[ListItemAbsolute(-1).Year, - ] is that then it doesn't matter how your main list is sorted. Our secondary list will also be in ascending year order.

As a bonus, you can use this method to get information about the child level items as well, e.g. get info about seasons on at the show level, or movies at the set level. All you need to do is change $INFO[Container.FolderPath] to $INFO[ListItem.FolderPath].

If you want to use this method for multiple scenarios, you can use a variable for the content path in the list, e.g.

xml:

<variable name="Hidden_List_Content_Path">
  <value condition="Container.Content(sets) | ListItem.IsCollection">$INFO[ListItem.FolderPath]</value> <!-- get info about child level e.g. movies at the set level or if a set is selected if you have sets enabled in the movies level -->
  <value condition="Container.Content(tvshows)">$INFO[ListItem.FolderPath]</value> 
  <value condition="Container.Content(seasons)">$INFO[Container.FolderPath]</value> <!-- get info about all your seasons e.g. year range at the seasons level -->
</variable>
Just to add, the reason I added a visibility condition to the list is because if you leave it so it is visible all the time, it will try to get information from the Container/ListItem folderpath of whatever you currently have selected. This can cause some issues especially with plugins, such as trying to autoplay content or popping up dialogs etc. Also from a resource perspective, I think the list won't try to update when it's hidden, so it's best to only have it working when you need it.