Kodi Community Forum

Full Version: Conditional visibility of media flags in particular view not working as expected
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
For the Madnox skin when using Portrait Icon Info layout, when you link a Movie to a TV Show (new one on me but ok)... when you browse the TV show and both the Movie you linked and the seasons of the TV show are present, what is happening is the media flags are overlapping each other. I found the code that is doing it, I modified it to what I thought would be a conditional selection based on what object in the panel is selected i.e. the movie, or any of the remaining TV show series... which should by the logic I cobbled together, switch between either one of the two media flag sets depending on which thing is "in focus" or selected... i.e. the movie or the show.

The original code looks like this:

Code:

        <!-- Media flags -->
        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
            <include condition="Window.IsVisible(MyVideoNav.xml)">MediaFlagsTVShows</include>
            <include condition="Window.IsVisible(MyVideoNav.xml)">MediaFlagsVideos4</include>
        </control>

I rewrote it to look like this based on numerous examples through various threads on the site and reasonable deduction:

Code:

        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
            <include condition="Window.IsVisible(MyVideoNav.xml) + Container.Content(tvshows)">MediaFlagsTVShows</include>
            <include condition="Window.IsVisible(MyVideoNav.xml) + Container.Content(movies)">MediaFlagsVideos4</include>
            <visible>Window.IsVisible(MyVideoNav.xml) + [Container.Content(tvshows) | Container.Content(movies)]</visible>
        </control>

Neither of the media flags show up under either condition. If I remove my rewrite and use the original functions, either one or the other commented out works individually.. i.e. the movie works for movie and tv for tv... 

So I don't think what I'm asking the skin to do is unreasonable... is there something I am missing?

Thank you.
Chris
Includes are checked only when the window first loads.
Oh, so the debug "F5" refresh doesn't do it? 

Errr... is that the only real gottcha with that?

TY.
Also, I exited Kodi and restarted it and tried again with the rewritten code and none of the media flags show at all. So there's that still. Is there anything wrong with the rewritten code that you can see?

TY.
The problem is when the window loads and checks the includes the content is unknown so neither of your includes are loaded.
Is there a way to determine what each of them is? When the author wrote the 2 original lines I guess there is no assumption of intelligence and it just pushes all the flags because it says to do so.

Does Kodi have any intelligence of what each object is? Should I be looking for something else to determine if I can switch between the media flag types? 

Any suggestions to do this a different way?

TY.
Have a look at including visible conditions to the code MediaFlagsTVShows and MediaFlagsVideos4.
(2024-02-16, 01:42)kittmaster Wrote: [ -> ]Any suggestions to do this a different way?

Include both. Then wrap each separately in its own group control. Then use your Container.Content as visibility conditions for each group.

To expand on Hitcher's comment, the reason your include condition is always false is because includes indicate which skin code to *include* for the window and a window can only be constructed after its skin code exists. Because the view container is *inside* the window, the container cannot exist before the window does and therefore the content type is always none at that point.

Basically, include conditions only work for external values, whereas visibility can be conditional on internal values.
(2024-02-16, 04:59)jurialmunkey Wrote: [ -> ]
(2024-02-16, 01:42)kittmaster Wrote: [ -> ]Any suggestions to do this a different way?

Include both. Then wrap each separately in its own group control. Then use your Container.Content as visibility conditions for each group.

To expand on Hitcher's comment, the reason your include condition is always false is because includes indicate which skin code to *include* for the window and a window can only be constructed after its skin code exists. Because the view container is *inside* the window, the container cannot exist before the window does and therefore the content type is always none at that point.

Basically, include conditions only work for external values, whereas visibility can be conditional on internal values.
Thanks for the additional info. I tried two different methods based on your response, both still did not show the flags. I'll post both methods I used, maybe I did not interpret your response correctly. Please let me know. TY.

v1
Code:

        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
            <control type="group">
                <visible>Window.IsVisible(MyVideoNav.xml)</visible>
                <include condition="Container.Content(tvshows)">MediaFlagsTVShows</include>
            </control>
            <control type="group">
                <visible>Window.IsVisible(MyVideoNav.xml)</visible>
                <include condition="Container.Content(movies)">MediaFlagsVideos4</include>
            </control>
        </control>

v2
Code:

        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
        </control>
        <control type="group">
            <visible>Window.IsVisible(MyVideoNav.xml)</visible>
            <include condition="Container.Content(tvshows)">MediaFlagsTVShows</include>
        </control>
        <control type="group">
            <visible>Window.IsVisible(MyVideoNav.xml)</visible>
            <include condition="Container.Content(movies)">MediaFlagsVideos4</include>
        </control>

v3
Code:

        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
            <control type="group">
                <visible>Container.Content(tvshows)</visible>
                <include>MediaFlagsTVShows</include>
            </control>
            <control type="group">
                <visible>Container.Content(movies)</visible>
                <include>MediaFlagsVideos4</include>
            </control>
        </control>
Like I said before Container does not exist at include build time so your conditions are always false.

Container content needs to go into visible, and window.isvisible needs to go into include condition.

Window.IsVisible is a bit of a misnomer because it is actually true from when the Window is told to open, not only when it is rendered.

IsVisible is true from before windowopen animation starts until after windowclose animation completes.
IsActive is true from before windowopen animation starts until window close animation begins.
Leave the include code as it was originally. Then find the code for MediaFlagsTVShows and MediaFlagsVideos4 and wrap them in their own group (if they aren't already) and add visible conditions to each group.
(2024-02-16, 11:02)Hitcher Wrote: [ -> ]Leave the include code as it was originally. Then find the code for MediaFlagsTVShows and MediaFlagsVideos4 and wrap them in their own group (if they aren't already) and add visible conditions to each group.

Correct me if I'm wrong, but it seems like the original author already did this using "grouplist" and "visible"... and if so, is it a matter of changing how he call is made at this point for this one and only particular view option?

Only showing of the two as they both follow the same formatting with grouplist/visible structure.

This is located in the Includes_MediaFlags.xml file.

Code:

    <include name="MediaFlagsTVShows">
        <param name="bottom">25</param>
        <param name="left">125</param>
        <param name="right">125</param>
        <param name="align">right</param>
        <definition>
            <control type="grouplist">
                <visible>!ListItem.IsParentFolder + [Container.Content(tvshows) | Container.Content(seasons) | String.IsEqual(ListItem.DBTYPE,tvshow)]</visible>
                <bottom>$PARAM[bottom]</bottom>
                <left>$PARAM[left]</left>
                <right>$PARAM[right]</right>
                <height>80</height>
                <align>$PARAM</align>
                <itemgap>10</itemgap>
                <orientation>horizontal</orientation>
                <usecontrolcoords>true</usecontrolcoords>
                <control type="label">
                    <visible>!String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Next_Aired)) | !String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Last_Aired))</visible>
                    <include>MediaFlagLabelFull</include>
                    <label>$VAR[TVShowAirDateLabelVar]</label>
                </control>
                <control type="label">
                    <visible>!String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Status))</visible>
                    <width>135.5</width>
                    <include>MediaFlagLabel</include>
                    <label>$VAR[NextAiredStausLabelVar]</label>
                </control>
                <control type="image">
                    <visible>!String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Status))</visible>
                    <left>-145.5</left>
                    <width>135.5</width>
                    <include>MediaFlagImage</include>
                    <texture>$VAR[MediaFlagsPathVar]nextaired/$INFO[Window(Home).Property(TMDbHelper.ListItem.Status)].png</texture>
                </control>
                <control type="image">
                    <visible>!String.IsEmpty(ListItem.FolderName)</visible>
                    <texture>$VAR[MediaFlagsPathVar]mpaa/$VAR[RatingFlagVar]</texture>
                    <include>MediaFlagImage</include>
                </control>
                <control type="image">
                    <visible>!String.IsEqual(Control.GetLabel(811112),none) + ![Control.IsVisible(50) | Control.IsVisible(55)]</visible>
                    <bordersize>0,10,0,10</bordersize>
                    <texture>$VAR[StudioIconsVar]</texture>
                    <include>MediaFlagImage</include>
                </control>
            </control>
        </definition>
    </include>
You might want to just use ListItem.DBTYPE instead of Container.Content then.

Quote:ListItem.DBTYPE
Shows the database type of the ListItem.DBID for videos (video, movie, set, tvshow, season, episode, musicvideo) or for audio (music, song, album, artist). Beware with season, the "*all seasons" entry does give a DBTYPE "season" and a DBID, but you can't get the details of that entry since it's a virtual entry in the Video Library.
(2024-02-16, 15:58)Hitcher Wrote: [ -> ]You might want to just use ListItem.DBTYPE instead of Container.Content then.
Quote:ListItem.DBTYPE
Shows the database type of the ListItem.DBID for videos (video, movie, set, tvshow, season, episode, musicvideo) or for audio (music, song, album, artist). Beware with season, the "*all seasons" entry does give a DBTYPE "season" and a DBID, but you can't get the details of that entry since it's a virtual entry in the Video Library.

Hoping I'm following the breadcrumbs correctly, this is what I thought would get me there, but still the flags are not showing up. 

This is in the PortraitIconInfo.xml file (1st post code modded)

Code:

        <control type="group">
            <visible>Control.IsVisible(530)</visible>
            <include content="AnimationSlideBottomWindow">
                <param name="slide">220</param>
            </include>
            <include condition="Window.IsVisible(MyVideoNav.xml) + ListItem.DBType,tvshow">MediaFlagsTVShows</include>
            <include condition="Window.IsVisible(MyVideoNav.xml) + ListItem.DBType,movie">MediaFlagsVideos4</include>
        </control>
This thing is driving me nuts... so I wrote a small debug to see what the hell is really happening and sure enough things are 1/2 right. When I hover over the movie, it is movie, but over the tvshows... its returning seasons... not tvshows.... ok fair enough.

So that means if I follow the latest suggestion, I should be able to do a string comparison against the object DBTYPE and then fire the media flags based on the string selection yes? So I rewrote the code as shown, but that isn't working either. Open to more breadcrumbs before I start tossing shit around my office... err... frustrating. I'm sure in a year I'll be chuckling about this... but today... not so much.

This is just to try and get it going I'll clean it up once I get the logic right... just trying to make it work.

Debug code to get the info:

Code:

<control type="label">
    <left>650</left>
    <top>650</top>
    <width>2000</width>
    <height>200</height> <!-- Adjust height as needed to accommodate the multiline content -->
    <label>DEBUG INFO:[CR]DBType: $INFO[ListItem.DBType]  [CR]Title: $INFO[ListItem.Title] [CR]ContentType: $INFO[ListItem.ContentType]</label>
    <font>Font12</font>
    <textcolor>white</textcolor>
    <visible>true</visible>
    <align>left</align>
</control>  

I would think this string comparison to the DBType would work when the hover occurs on each object as it does when the debug label sees it... shouldn't that fire the media flags in tandem? And I've restarted Kodi to ensure everything was a fresh start before this executed.

Code:

<control type="group">
    <visible>Control.IsVisible(530)</visible>
    <include condition="String.IsEqual(ListItem.DBType,movie)">MediaFlagsVideos4</include>
    <include condition="String.IsEqual(ListItem.DBType,season)">MediaFlagsTVShows</include>
</control>

Image

Image
Pages: 1 2