MyVideoNav - switch playlist without closing - replicate button 10
#1
I am attempting to replicate the built in control (10) on the MyVideoNav.xml

This button cycles through All videos - Watched - Unwatched, but I would like to customize it to cycle through custom playlists which filter my video library based on if the movie is "New" or not.

For example, I have 3 playlists created - All Movies - Library - NEW

What I have come up with works with the exception that when the playlist opens, MyVideoNav window and the window behind it close, and then the playlist is opened as a new window. I am using <onclick>ReplaceWindow()</onclick>

So the question is - Is there any way switch/change playlists without MyVideoNav closing? I just want the video list behind it to change based on which playlist is toggled, in the same way button 10 functions.

Here is the code I came up with:
MyVideoNav.xml:
<control type="button" id="1">
     <description>Custom Library Toggle</description>
     <textwidth>255</textwidth>
     <label>$VAR[CustomLibraryToggle]</label>    
     <include>ButtonCommonValues</include>
     <onclick condition="String.IsEqual(Container.FolderName,1. All Movies)">ReplaceWindow(Videos,special://profile/playlists/video/2. Library.xsp,return)</onclick>
     <onclick condition="String.IsEqual(Container.FolderName,2. Library)">ReplaceWindow(Videos,special://profile/playlists/video/3. New.xsp,return)</onclick>
     <onclick condition="String.IsEqual(Container.FolderName,3. New)">ReplaceWindow(Videos,special://profile/playlists/video/1. All Movies.xsp,return)</onclick>
     <label2>[COLOR $VAR[ThemeLabelColor]]$INFO[Container.NumItems][/COLOR]</label2>
     <visible>Container.Content(movies)</visible>
</control>
Variables.xml:
<variable name="CustomLibraryToggle">
     <value condition="String.IsEqual(Container.FolderName,1. All Movies)">All Movies</value>
     <value condition="String.IsEqual(Container.FolderName,2. Library)">Library</value>
     <value condition="String.IsEqual(Container.FolderName,3. New)">NEW</value>
</variable>    

Thanks in advance!
Reply
#2
You should be able to do it with Container.Update. but I would create a new button instead of trying to change the behavior of an existing one as some of them have hard coded functionality
Reply
#3
@realcopacetic  thanks for the input.

I did actually create a new button. The code in my original post is the new button which activates the playlists.

However, what it is doing is essentially opening a new window, which closes MyVideoNav, closes the movie list behind it, and then opens the playlist.

So I am not sure how to apply the Container.Update function. Could you please explain further?

Is the use of playlists to do this the best way or is there a way to filter the "container" (movies) based on the item's path?
For example, my 3 playlists are built as follows:
1. All Movies:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>1. All Movies</name>
    <match>all</match>
    <rule field="path" operator="startswith">
        <value>smb://(IP Address)/Videos/Movies/</value>
    </rule>
    <order direction="ascending">sorttitle</order>
</smartplaylist>
2. Library:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>2. Library</name>
    <match>all</match>
    <rule field="path" operator="startswith">
        <value>smb://(IP Address)/Videos/Movies/</value>
    </rule>
    <rule field="path" operator="doesnotcontain">
        <value>smb://(IP Address)/Videos/Movies/New/</value>
    </rule>
    <order direction="ascending">sorttitle</order>
</smartplaylist>
3. New:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>3. New</name>
    <match>all</match>
    <rule field="path" operator="startswith">
        <value>smb://(IP Address)/Videos/Movies/New/</value>
    </rule>
    <order direction="ascending">sorttitle</order>
</smartplaylist>
Reply
#4
https://kodi.wiki/view/List_of_built-in_...built-in's

It's very literally the same concept as what you're doing with replacewindow, but you're just using the container.update command to update the path in the window instead of replacing the entire window with the same window.

xml:

<onclick condition="String.IsEqual(Container.FolderName,1. All Movies)">Container.Update(special://profile/playlists/video/2. Library.xsp)</onclick>
<onclick condition="String.IsEqual(Container.FolderName,2. Library)">Container.Update(special://profile/playlists/video/3. New.xsp)</onclick>
<onclick condition="String.IsEqual(Container.FolderName,3. New)">Container.Update(special://profile/playlists/video/1. All Movies.xsp)</onclick>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#5
@jurialmunkey thanks, that did it! Unfortunately it takes about 3 seconds to load and gives me a waiting animation while it loads, so its not snappy. But I can live with that unless anyone knows of a fix for that as well
Reply

Logout Mark Read Team Forum Stats Members Help
MyVideoNav - switch playlist without closing - replicate button 100