2024-11-25, 04:41
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:
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:
So as 2 out of 3 are working (via testing):
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:
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
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)
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