Req Change the date color based on the release date
#1
Video 
Is it possible to change the text color of a movie's release date, based on today's date?

That is, if a movie is released after today's date it will show the red color, if it was released earlier it will show the green color.     
    
    
xml:
    <item>
       <label>$LOCALIZE[31322]:</label>
       <label2>[COLOR $VAR[FontColorVar]] $INFO[ListItem.Premiered] [/COLOR]</label2>
       <visible>!String.IsEmpty(ListItem.Premiered)</visible>
    </item>
    
  
   <variable name="FontColorVar">
      <value condition= "$INFO[System.Date(dd/mm/yyyy)] > $INFO[ListItem.Premiered]"> $VAR[green] </value>
      <value condition= "$INFO[System.Date(dd/mm/yyyy)] < $INFO[ListItem.Premiered]"> $VAR[red] </value>
   </variable>
   
    <variable name="green">
      <value>green</value>
   </variable>
   
   <variable name="red">
      <value>red</value>
   </variable>
   
   
The code inside the "FontColorVar" variable obviously doesn't work that way, but it's the best way to show what I mean.


Any help would be appreaciatted 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#2
You might need to do something like:

<value condition="Integer.IsGreater(ListItem.Premiered,System.Date")>$VAR[red]</value>
<value>$VAR[green]</value>

With variables each value is evaluated in turn, so you don't need to worry about reversing your condition in the second value, as it will automatically only go to the second value if your first condition is not true.

I assume dates will all be stored in some sort of numerical format, so hopefully it's possible to compare them.

If Kodi doesn't like comparing them against each other, you might benefit from some of the new features in Nexus, allowing two info integers to be compared against each other: https://forum.kodi.tv/showthread.php?tid...pid3096995
Reply
#3
@QuizKid

Unfortunately it does not work, I had already tried this way, it is too simple, I think something more complex is needed.

Always returns the red date.


Thanks anyway for your help.
(+1 you deserve it all the same)
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#4
Quote:That is, if a movie is released after today's date it will show the red color, if it was released earlier it will show the green color.

@"alberto1998" Might not help you but for items returned from themovieDB.helper addon you can use the ListItem.Status info label:-

Code:
<variable name="FontColorVar">
  <value condition="String.IsEqual(ListItem.Status,Released)">Green</value>
  <value>Red</value>
</variable>

Won't work for library content without using themoviedb.helper's service monitor but then again why would your library contain unreleased items.
Reply
#5
@roidy

Yes I know listitem.status, but I don't know if it's as reliable as listitem.premiered, that's why I asked for this other method.
Does listitem.status also take into account the movie release country?
Do you find it reliable enough?


Thanks for your help
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#6
Quote:Yes I know listitem.status, but I don't know if it's as reliable as listitem.premiered, that's why I asked for this other method.

It doesn't matter how reliable ListItem.Premiered is, it's unusable for what you want to do. ListItem.Premiered is a string and System.Date is also a string so you will never be able to compare them in any meaningful way such as less than or greater than.
Quote:Does listitem.status also take into account the movie release country?

Sorry, no idea.
Quote:Do you find it reliable enough?

I don't use it, so I don't know how reliable it is.

I did say in my first post but might not of been clear I'm not talking about the standard Kodi ListItem.Status. That, as far as I know, is only valid for TV Shows and suffers from a major issue that makes it practically useless. It's only ever set when a TV Show is first scanned into the library and it's value never changes, unless you delete the show and rescan it.

What I'm talking about is the version of ListItem.Status that is set by themovieDB.helper addon, that version is set for any widget item from themovieDB.helper addon or for any Kodi ListItem if you use the service monitor.
Reply
#7
@roidy

Ok, I got it.
Thanks for the information, i will do what you indicated to me, and if there is no other way i will wait for the release of kodi 20.
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#8
(2022-10-02, 23:53)alberto1998 Wrote: and if there is no other way i will wait for the release of kodi 20.

I don't think there are any changes in Kodi 20 that will help with this.

What would be needed is for Kodi to treat date info labels as proper date objects and not strings then you would need a set of comparison functions that work with dates:-

Code:
Date.IsEqual(info, info)
Date.IsLess(info, info)
Date.IsGreater(info, info)

or the ability to split dates like you can with ListItem.Duration, then you could integer compare the individual parts of the date.

Code:
ListItem.Premiered(yy)
ListItem.Premiered(mm)
ListItem.Premiered(dd)
System.Date(yy)
System.Date(mm)
System.Date(dd)
Reply
#9
@roidy
ok, thank you, I'll try to use listitem.status by themovieDB.helper addon. 😌
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply

Logout Mark Read Team Forum Stats Members Help
Change the date color based on the release date0