Solved Dynamic path interception? Is it possible to prevent 100's of rewrites?
#1
I am working on a mod to do dynamic icon replacement. My idea was to do xml path interception based on a static value held in settings.xml (which is working correctly in the admin, selection, file writing etc).

The original variable looks like:

xml:

    <variable name="MediaFlagsPathVar">
        <value condition="Skin.HasSetting(MediaFlagsColored)">flags/colored/</value>
        <value>flags/default/</value>
    </variable>

So it switches between colored media icon flags or the default. My hook is to replace a default color icon with an array of colors and my thought is to do dynamic path interception. There are so many lines of code to modify to allow unique color selection, so by intercepting the path, it would allow the core code to remain the same and hook the color folders I've assigned with all the updated icons.

The trick though is to only look for (in a singular case before I expand on it) for what icon is being called by its path and then dynamically assign the path and then execute and then revert back to the normal color path for all the other icons so there is no disruption to the original core paths for all the other media icons that are not to be affected.

So my thought as a simple test was to rewrite the variable like this:

xml:

    <variable name="MediaFlagsType">
        <value>videoresolution</value> <!-- Hardcoded for testing -->
    </variable>

<variable name="MediaFlagsPathVar">
    <value condition="Skin.HasSetting(MediaFlagsColored) + String.Contains(Skin.String(mediaflagrescolorsettingsvalue), red) + (String.Contains(Skin.String(MediaFlagsType), videoresolution))">flags/colored/videoresolution/1-Red/</value>
    <value condition="Skin.HasSetting(MediaFlagsColored)">flags/colored/</value>
    <value>flags/default/</value>
</variable>

So as 2 out of 3 are working (via testing):
  • Skin.HasSetting(MediaFlagsColored) = Works
  • String.Contains(Skin.String(mediaflagrescolorsettingsvalue), red) = Works
  • (String.Contains(Skin.String(MediaFlagsType), videoresolution)) = Does not work (many variants tried, not sure what I'm missing)
So I'm searching for "videoresolution" in the calling path and if it is present, sub the updated color icon path (in this case red) to call the red icon and then revert back to the normal path.

For some reason, it doesn't seem to switch off when videoresolution in the path is seen.

Here is an example of what I am scanning for:

xml:

<value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/576.png</value>

So based on that, I think my variable is set up to capture it, make the change of the folder path, and then revert for the rest.

Am I doing it wrong? Is it possible to what I'm trying to accomplish?

Thanks
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#2
You have a leading space after your comma in your string contains so it'd be matching " red" not "red" etc

Also you can't string compare a variable (your type var) A variable is not a skin string and not an infolabel.

String comparisons only accept info labels or raw values
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply
#3
I removed the leading space, still defaults to the 2nd condition. Good catch though, ty.

Still not pulling out the red icon... it is still using the default path...i.e. condition 2 (of 3)
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#4
(2024-11-25, 05:07)jurialmunkey Wrote: You have a leading space after your comma in your string contains so it'd be matching " red" not "red" etc

Also you can't string compare a variable (your type var) A variable is not a skin string and not an infolabel.

String comparisons only accept info labels or raw values
Ok, how else could I do this? At least I know why it isn't working.
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#5
(2024-11-25, 05:17)kittmaster Wrote:
(2024-11-25, 05:07)jurialmunkey Wrote: You have a leading space after your comma in your string contains so it'd be matching " red" not "red" etc

Also you can't string compare a variable (your type var) A variable is not a skin string and not an infolabel.

String comparisons only accept info labels or raw values
Ok, how else could I do this? At least I know why it isn't working.


Reorganise your path so that the colour type is before the content type (if you can't reorganise see the end of my comment for an alternative method)
i.e.
/flags/colored/1-Red/videoresolution/
/flags/colored/videoresolution/
/flags/default/videoresolution/

Then you get your base path from your variable and then use an additional variable for the types of flags that will have expanded choices with main variable as a fallback
xml:

<variable name="MediaFlagsPathVar">
<value condition="Skin.HasSetting(MediaFlagsColored)">flags/colored/</value>
<value>flags/default/</value>
</variable>
<variable name="MediaFlagsPathExpandedVar">
<value condition="Skin.HasSetting(MediaFlagsColored) + String.Contains(Skin.String(mediaflagrescolorsettingsvalue), red)">flags/colored/1-Red/</value>
<value>$VAR[MediaFlagsPathVar]</value>
</variable>

xml:

<value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathExpandedVar]videoresolution/576.png</value>

Use MediaFlagsPathExpandedVar for flags which allow dynamic colour sets and the plain MediaFlagsPathVar for the ones that don't. You should be able to manage that with a simple find and replace:
xml:

<!-- FIND -->
$VAR[MediaFlagsPathVar]videoresolution/
<!-- REPLACE -->
$VAR[MediaFlagsPathExpandedVar]videoresolution/


ALTERNATIVE:

IF you can't reorganise the path (i.e. you need flags/color/videoresolution/1-red/) then you could do something like this instead:

xml:

<variable name="MediaFlagsPathVar">
<value condition="Skin.HasSetting(MediaFlagsColored)">flags/colored/</value>
<value>flags/default/</value>
</variable>
<variable name="MediaFlagsPathExpandedVar">
<value condition="Skin.HasSetting(MediaFlagsColored) + String.Contains(Skin.String(mediaflagrescolorsettingsvalue), red)">1-Red/</value>
</variable>

xml:

<value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply
#6
Thank you for the guidance!

I like and used your alternative method and it works as I like it.

I started to implement it on other areas; the one that parses the file using the player info and then does a file match is where I have concern.

Here is what I had to do and it works as I've seen the flag switch from 1080p to 720p as expected:

xml:

    <variable name="MediaFlagsPathVar">
        <value condition="Skin.HasSetting(MediaFlagsColored)">flags/colored/</value>
        <value>flags/default/</value>
    </variable>
    <variable name="MediaFlagsPathExpandedVar">
        <value condition="Skin.HasSetting(MediaFlagsColored) + String.Contains(Skin.String(mediaflagrescolorsettingsvalue),red)">1-Red/</value>
    </variable>

Commented is original, bottom is what is active and works:
xml:

        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
         <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution].png</value>

My concern is that I needed to "remove" the "comma" so ,.png became .png. I'm unclear why this works without it and does not work with it and before I change out a bunch of others like it, is there reason for my concern? 

I realize that Kodi uses the listitem and dumps it for a string then does a file match, but unclear why this is working without the comma or do I need to rewrite it differently?

Here is an entire variable block with the method and info of concern above:

xml:

    <variable name="VideoResolutionFlagVar"> <!-- Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>        
        <value condition="String.IsEqual(ListItem.VideoResolution,4K) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(ListItem.VideoResolution,720) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
         <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution].png</value>
    </variable>

Thoughts?
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#7
The comma is used by label parsing to define prefix and postfix labels for a $INFO or $VAR when it resolves. See: https://kodi.wiki/view/Label_Parsing

After first comma is prefix and after second is postfix

e.g. these two are equivalent

Code:

$INFO[ListItem.VideoResolution,prefix,postfix]
==
prefix$INFO[ListItem.VideoResolution]postfix

The main difference is that prefix/postfixis only added if the label resolves. If the label is empty then using the comma method means the prefix/postfix are not added

e.g. suppose a variable that will always be empty because the condition is false
xml:

<variable name="MyEmptyVariable">
<value condition="false">variabletext</value>
</variable>

Then
"$VAR[MyEmptyVariable,prefix,postfix]" == ""

Whereas
"prefix$VAR[MyEmptyVariable]postfix" == "prefixpostfix"


Whereas if condition="true" for the variable value then we'd get "prefixvariabletextpostfix" in both instances.


You can't use another variable/info as prefix/postfix unfortunately, so there's no way to retain the original syntax. The closest you could get is doing a string.isempty check like this
xml:


<!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
<value condition="!String.IsEmpty(ListItem.VideoResolution)>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution,,.png]</value>

Either way, if there's no videoresolution you won't get an image. The advantage of the string.isempty check is that the variable resolves empty which might be useful in some edge cases but for the most part it shouldn't make much difference.
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply
#8
(2024-11-26, 10:10)jurialmunkey Wrote: The comma is used by label parsing to define prefix and postfix labels for a $INFO or $VAR when it resolves. See: https://kodi.wiki/view/Label_Parsing

After first comma is prefix and after second is postfix

e.g. these two are equivalent

Code:

$INFO[ListItem.VideoResolution,prefix,postfix]
==
prefix$INFO[ListItem.VideoResolution]postfix

The main difference is that prefix/postfixis only added if the label resolves. If the label is empty then using the comma method means the prefix/postfix are not added

e.g. suppose a variable that will always be empty because the condition is false
xml:

<variable name="MyEmptyVariable">
<value condition="false">variabletext</value>
</variable>

Then
"$VAR[MyEmptyVariable,prefix,postfix]" == ""

Whereas
"prefix$VAR[MyEmptyVariable]postfix" == "prefixpostfix"


Whereas if condition="true" for the variable value then we'd get "prefixvariabletextpostfix" in both instances.


You can't use another variable/info as prefix/postfix unfortunately, so there's no way to retain the original syntax. The closest you could get is doing a string.isempty check like this
xml:


<!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
<value condition="!String.IsEmpty(ListItem.VideoResolution)>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution,,.png]</value>

Either way, if there's no videoresolution you won't get an image. The advantage of the string.isempty check is that the variable resolves empty which might be useful in some edge cases but for the most part it shouldn't make much difference.

Understood & great explanation, learning a lot this week... LOL.

Thank you for that.

I do want to run a simpler question by you on this same topic... since my variable block is all conditionals until it makes it to that last value which is now the default value when nothing else is found. If I were to adapt (i.e. I will if my thought works out) the main conditions, your modified string adjust with !String.IsEmpty, as a conditional, and a final catch of "not-found" icon (which I'll create in the same vein, i.e. outline icon with say a "red X" denoting "not found" that I will create, I think that would cover the gamut including all the edge cases where an icon, any icon found/not found would hold the place based on all the conditions if all the conditionals evaluate as false.

Would you agree with this thought process?

Modified example shown below:

xml:

    <variable name="VideoResolutionFlagVar"> <!-- Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>        
        <value condition="String.IsEqual(ListItem.VideoResolution,4K) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(ListItem.VideoResolution,720) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <value condition="!String.IsEmpty(ListItem.VideoResolution)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution,,.png]</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
        <!-- <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution].png</value> -->
        <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value>      
    </variable>

Image
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#9
Also, because I'm an impatient bastard, I assumed and went ahead and rewrote it based on my unconfirmed theory. These are the 3 blocks affected (for now), looking at the last conditions, do the mods look correct based on your suggested rewrite? Also, FYI, I commented out every resolution matching condition leaving only the error flag on the initial block to verify the <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value> and it does work so no need to waste time there:

xml:

    <variable name="VideoResolutionFlagVar"> <!-- Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>        
        <value condition="String.IsEqual(ListItem.VideoResolution,4K) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(ListItem.VideoResolution,720) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <value condition="!String.IsEmpty(ListItem.VideoResolution)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution,,.png]</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
        <!-- <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution].png</value> -->
        <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value>
    </variable>
    <variable name="Container7005VideoResolutionFlagVar"> <!-- Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Container(7005).Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Container(7005).Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>    
        <value condition="String.IsEqual(Container(7005).ListItem.VideoResolution,4K) + String.Contains(Container(7005).ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(Container(7005).ListItem.VideoResolution,720) + String.Contains(Container(7005).ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(Container(7005).ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[Container(7005).ListItem.VideoResolution,videoresolution/,.png]</value> -->
        <!-- <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[Container(7005).ListItem.VideoResolution].png</value> -->
        <value condition="!String.IsEmpty(Container(7005).ListItem.VideoResolution)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[Container(7005).ListItem.VideoResolution,,.png]</value>
        <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value>
    </variable>
    <variable name="PlayerVideoResolutionFlagVar"> <!-- Main Menu > Videos > Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.IsEqual(VideoPlayer.VideoResolution,4K) + String.Contains(Player.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(VideoPlayer.VideoResolution,720) + String.Contains(Player.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(Player.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[VideoPlayer.VideoResolution,videoresolution/,.png]</value> -->
        <!-- <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[VideoPlayer.VideoResolution].png</value> -->
        <value condition="!String.IsEmpty(VideoPlayer.VideoResolution)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[VideoPlayer.VideoResolution,,.png]</value>
        <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value>
    </variable>

If you sign off on these 3, then I can mark this solved and will carry on with the other areas I plan to modify for feature enhancements. Smile
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#10
Yeah that looks right to me.

The only place you might run into trouble is if VideoResolution is *not* empty but you don't have a corresponding icon for that specific resolution (e.g. say it returned some weird value like 6K instead of 4K and you don't have a 6K.png). Then you'd have a blank space because the !String.IsEmpty condition is true but the filename it gives doesn't match an image available in the skin.

You can avoid this scenario by using a fallback in the texture tag instead e.g.
Code:

<texture fallback="flags/default/videoresolution/Video-Res-Not-Found-X.png">$VAR[VideoResolutionFlagVar]</texture>
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply
#11
(2024-11-27, 04:43)jurialmunkey Wrote: Yeah that looks right to me.

The only place you might run into trouble is if VideoResolution is *not* empty but you don't have a corresponding icon for that specific resolution (e.g. say it returned some weird value like 6K instead of 4K and you don't have a 6K.png). Then you'd have a blank space because the !String.IsEmpty condition is true but the filename it gives doesn't match an image available in the skin.

You can avoid this scenario by using a fallback in the texture tag instead e.g.
Code:

<texture fallback="flags/default/videoresolution/Video-Res-Not-Found-X.png">$VAR[VideoResolutionFlagVar]</texture>

So where does this go? At the end of <value>? 

I thought <value> acts as the fallback if none of the conditions are met as the default?

I'll add the line, just curious where it needs to go.

Like this?: 

xml:

    <variable name="VideoResolutionFlagVar"> <!-- Media VIDEORESOLUTION Flags -->
        <value condition="String.Contains(Player.Filename,288) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]288.png</value>
        <value condition="String.Contains(Player.Filename,360) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]360.png</value>
        <value condition="String.Contains(Player.Filename,480) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]480.png</value>
        <value condition="String.Contains(Player.Filename,540) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]540.png</value>
        <value condition="String.Contains(Player.Filename,576) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]576.png</value>
        <value condition="String.Contains(Player.Filename,720) ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]720.png</value>
        <value condition="String.Contains(Player.Filename,1080)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]1080.png</value>
        <value condition="String.Contains(Player.Filename,2160)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>
        <value condition="String.Contains(Player.Filename,4K)  ">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kuhd.png</value>        
        <value condition="String.IsEqual(ListItem.VideoResolution,4K) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]4kremux.png</value>
        <value condition="Integer.IsLess(ListItem.VideoResolution,720) + String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]sdremux.png</value>
        <value condition="String.Contains(ListItem.Filename,remux)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]hdremux.png</value>
        <value condition="!String.IsEmpty(ListItem.VideoResolution)">$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution,,.png]</value>
        <!-- <value>$VAR[MediaFlagsPathVar]$INFO[ListItem.VideoResolution,videoresolution/,.png]</value> -->
        <!-- <value>$VAR[MediaFlagsPathVar]videoresolution/$VAR[MediaFlagsPathExpandedVar]$INFO[ListItem.VideoResolution].png</value> -->
        <value>flags/default/videoresolution/Video-Res-Not-Found-X.png</value>
        <texture fallback="flags/default/videoresolution/Video-Res-Not-Found-X.png">$VAR[VideoResolutionFlagVar]</texture>

    </variable>
Kodi: Nexus v20.5 | Skin Dev: Madnox Omega/Nexus: v20.01.02 | Madnox ForumRoot | Madnox Repov1.0.09 | Mr. V'sSource | Kodi Texture Tool (Takeover): v3.0.1 | Batch Texture Resize (Irfanview): Tutorial
Working On
: Replacing Embruary >> TMDB Helper || Start: 6/3/2024 End: God knows || Status Complete: Movies: 80% TV Shows: 40% Music: 20%
Reply
#12
No in your image control where you use the variable.
Arctic Fuse 2 - Alpha now available. Support me on Ko-fi.
Reply

Logout Mark Read Team Forum Stats Members Help
Dynamic path interception? Is it possible to prevent 100's of rewrites?0