Boolean for whether a listitem is a favourite?
#1
Is there one?
www: deadendthrills.com
follow on twitter for updates, etc: @deadendthrills
Reply
#2
Hate to bump, but should I gather from the lack of replies that this can't be done?
www: deadendthrills.com
follow on twitter for updates, etc: @deadendthrills
Reply
#3
As far as I know there is no builtin function for that but you could do something like this :
(not the most elegant solution but probably the only one)

* Requires "script.favourites"
* String compare currently selected item (label/path) with all KODI favourites
 
Code:
String.isEqual(ListItem.Label,$INFO[Window(Home).Property(favourite.1.name)]) | String.isEqual(ListItem.Label,$INFO[Window(Home).Property(favourite.2.name)]) | ... up to 20 ...

or with PATH
(this method is more complicated because you have to compare different path infolabels based on content e.g. ListItem.Path, ListItem.FolderPath)

String.Contains(ListItem.Path,$INFO[Window(Home).Property(favourite.1.path)]) | String.Contains(ListItem.FolderPath,$INFO[Window(Home).Property(favourite.1.path)]) | ...
with variables:
Code:
<variable name="Is_Favourite">
   <value condition="String.Contains(ListItem.Path,$INFO[Window(Home).Property(favourite.1.path)])">Selected item is a favourite #1</value>
   <value condition="String.Contains(ListItem.FolderPath,$INFO[Window(Home).Property(favourite.1.path)])">Selected item is a favourite #1</value>
   ... up to 20 ...
   <value>Not a favourite</value>
</variable>

It's probably better to use PATH for comparison because users are able to edit the label/name of the favourite which would break the conditions ...
Reply
#4
Building on @bkury's method, you can do this without script.favourites.

Make a fake list with content set to favourites://
Code:
<control type="list" id="8801">
<itemlayout />
<focusedlayout />
<content>favourites://</content>
</control>

And then compare the strings with the fake list
Code:
String.IsEqual(ListItem.Label,Container(8801).ListItemAbsolute(0).Label) | String.IsEqual(ListItem.Label,Container(8801).ListItemAbsolute(1).Label) | String.IsEqual(ListItem.Label,Container(8801).ListItemAbsolute(2).Label)
etc..
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#5
Cheers for this, guys. How many favourites entries would I need to check? Is there a limit?
www: deadendthrills.com
follow on twitter for updates, etc: @deadendthrills
Reply

Logout Mark Read Team Forum Stats Members Help
Boolean for whether a listitem is a favourite?0