jurialmunkey / script.skinvariables

A helper script for Kodi skinners to construct multiple variables
GNU General Public License v3.0
36 stars 16 forks source link

[BUG] $INFO labels are not passed when creating dynamic nodes due to "names" vs "label" #56

Open OfficerKD637 opened 1 week ago

OfficerKD637 commented 1 week ago

Hi J!

I might have butchered the title here so apologies in advance.

$INFO labels won't work in the "name" field in dynamic nodes.

But that's not the case in something like the skinvariables-shortcut-sidemenu.json file which utilizes "label" instead of "names"

Here's a post I made on the AF2 page about this.

Would it be possible to allow $INFO labels to work within dynamic nodes as well?

Thank you!

jurialmunkey commented 1 week ago

It's passed fine. The problem is that Kodi will not evaluate a $INFO inside another $INFO so you get the literal text. That's nothing to do with SkinVariables or the skin, it's simply how Kodi evaluates info (otherwise you could never have a dollar sign).

SkinVariables stores the name into ListItem.Property(widget) so that skins can retrieve it via $INFO[Container(ID).ListItem.Property(widget)] -- Kodi will then print that literal text of that info label. There is no way to tell Kodi then to evaluate the text inside the infolabel again.

jurialmunkey commented 1 week ago

Even if I were to evaluate the label in SkinVariables and pass the evaluated label to ListItem.Property(widget) that could potentially be wrong.

As a simple (albeit dumb) example, suppose the infolabel is $INFO[System.Time] -- this will mean that the time shown will be the time that SkinVariables evaluated the label. The time will never change or update and will immediately be wrong when it is displayed

OfficerKD637 commented 1 week ago

Thanks for taking the time to explain all this! I truly appreciate it.

I think I understand most of what you said haha.

But are the normal skin widgets (i.e. the ones found in addon_data > script.skinvariables > nodes > skin.arctic.fuse.2 > skinvariables-shortcut-sidemenu.json) created differently than the dynamic nodes?

The normal skin widgets can have a dollar sign in their names whilst also evaluating an $INFO label. But the dynamic nodes pass the $INFO label as literal text (like you explained). So how are the normal widgets able to pass the $INFO label? Are "label" (used in shortcut-sidemenu.json) and "names" (dynamic nodes) different things?

Here's an example with both a dollar sign and a custom $INFO label as the widget title in a normal skin widget image

I have a few dynamic nodes that utilize fallback paths so was hoping I could use $INFO labels here as well.

EDIT: If I had to guess, "names" is ListItem.Property(widget) and "label" is ListItem.Label? Any particular reason that dynamic nodes don't use the same?

jurialmunkey commented 1 week ago

Because in normal widgets it is just one time. When you're using the dynamic path, it's double because sv is getting whatever you're making the name and putting it in the widget property. So skin evaluates widget property which has the $info you put as the name.

jurialmunkey commented 1 week ago

Think of it this way - $INFO[ListItem.Property(widget)] is like a coupon you can redeem for a cup of coffee. The coupon itself isn't a cup of coffee, you have to redeem it first. When you show it to barista at the cafe, they know that means to give you a coffee.

When you put a name in SV, you're telling it to make a coupon that can be redeemed when the widget is shown so that you can see the name of that widget.

If you put a $INFO in the name, then you're effectively making a coupon that says "redeem this coupon for one coupon"

OfficerKD637 commented 1 week ago

Woah... tenor

I don't have anything else to say... but you're truly a wizard at this stuff. Like how you magically came up with this (a recurring bug report since the AF1 days lol). So if you ever think of a workaround or Kodi changes how it evaluates $INFO labels, please let me know haha

BTW How does TMDb Helper achieve the dynamic titles in widgets? In normal skin widgets, it'll show 'Based on Recently Watched Movies' when setting it up in the Customize Widgets screen, but will display 'Because you watched NAME OF THE MOVIE' when looking at the actual widget on the home screen.

And in dynamic nodes, leaving the "name" field blank will fetch the dynamic title as well. No need to input any custom $INFO label at all!

3rd party video plugins will have a static title everywhere unless the custom $INFO label is used. And hence won't work with dynamic nodes.

jurialmunkey commented 1 week ago

In tmdbhelper it uses the exact same method as skin variables - it puts the "based on x" widget label in ListItem.Property(widget)

By leaving the name field blank, SV doesn't change that widget property to the name. So when the skin puts $INFO[ListItem.Property(widget)] in the widget label, you get whatever was originally there instead of it being overwritten by the name in SV

If other addons do the same thing of storing the "based on x" in ListItem.Property(widget) then it should pass through for them too.