Kodi Community Forum

Full Version: Apply custom filtering to dynamic content?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Hi,

Does anyone know of a way to apply custom filtering to dynamic content in a way similar to a smart playlist?

I noticed that the Container.FolderPath of a custom node basically uses JSON style formating - but it doesn't seem to work if I use it as a content path:

e.g. a custom node for title matching Alien is
videodb://movies/titles/?xsp%7b%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22title%22%2c%22operator%22%3a%22is%22%2c%22value%22%3a%5b%22Alien%22%5d%7d%5d%7d%2c%22type%22%3a%22movies%22%7d

which is translates to:
videodb://movies/titles/?xsp{"rules":{"and":[{"field":"title","operator":"is","value":["Alien"]}]},"type":"movies"}

But if I stick either in <content> tags or call it with ActivateWindow(), the content is the all titles path (videodb://movies/titles).

Is this even something that is possible? A smartplaylist is out of the question because I need to have dynamically inputted values based upon a window property.
I know this is a long shot, but if something like this can be done then a lot of skinning possibilities open up!
It is possible, I use it a lot in Embuary. Especially for my "pseudo Globalsearch" integration, which is basically the same output of Globalsearch but only based on the skin engine and xsp paths. You just have to be sure to use the url encoded format.

Example:
Code:
    <variable name="Local.SearchMovies">
        <value condition="!String.IsEmpty(Skin.String(CustomSearchTerm)) + Library.HasContent(movies)">videodb://movies/titles/?xsp=%7B%22order%22%3A%7B%22direction%22%3A%22ascending%22%2C%22ignorefolders%22%3A0%2C%22method%22%3A%22sorttitle%22%7D%2C%22rules%22%3A%7B%22and%22%3A%5B%7B%22field%22%3A%22title%22%2C%22operator%22%3A%22contains%22%2C%22value%22%3A%5B%22$INFO[Skin.String(CustomSearchTerm)]%22%5D%7D%5D%7D%2C%22type%22%3A%22movies%22%7D</value>
    </variable>
    
<variable name="Local.SearchActorMovies">
        <value condition="!String.IsEmpty(Skin.String(CustomSearchTerm)) + Library.HasContent(movies)">videodb://movies/titles/?xsp=%7b%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22actor%22%2c%22operator%22%3a%22is%22%2c%22value%22%3a%5b%22$INFO[Skin.String(CustomSearchTerm)]%22%5d%7d%5d%7d%2c%22type%22%3a%22movies%22%7d</value>
    </variable>
Here is a example and proof Wink

wow, that's pretty amazing!
very nice :-)
@sualfred - Yours works perfectly! Thanks so much! I wonder why the path I grabbed from the node doesn't work though. Anyway, this works brilliantly for what I need. Big Grin
@ronie
hehe. Thx.

@jurialmunkey 

Because you had a "=" missing after ?xsp Wink
Quote:videodb://movies/titles/?xsp{"rules":{"and":[{"field":"title","operator":"is","value":["Alien"]}]},"type":"movies"}
(2019-03-05, 22:57)sualfred Wrote: [ -> ]Because you had a "=" missing after ?xsp Wink
Quote:videodb://movies/titles/?xsp{"rules":{"and":[{"field":"title","operator":"is","value":["Alien"]}]},"type":"movies"}

Ah! I'm such a fool! I was paying so much careful attention to all the url encoding that I completely missed the equals sign.

Anyway, this is such a fantastic tool to have. It's allowed me to replicate a lot of extendedinfo functionality using only local content.
Proof of concept:

Here's local video info being called from videoinfo dialog for movies in the set. This is done entirely with the skinning engine and local content. There is even a breadrcrumb memory so that you can backtrack.
Looks great.

Yep, the backtrack thing is a big plus. And xsp has no Python overhead and blacing fast.
Sadly I wasn't able to do everything with xsp and had to create my Embuary Helper script.
Oh man, using XSPs is smooth as eggsssss.... haha. you guys don't use mixed content containers at all?
for some unknown reason (to me at least) trying to create mixed content with xsp (using is playlist rules) doesn't work, although this works using the json api.
on top of that, sorting by year seems to not work outside library...
with this filter hack and mixed working, I could ditch most script sources (besides the recommended sort algorithm and a few more).

btw I've upgraded Skin widgets if you're still using it/or interested for ur own scripts...
https://github.com/cartmandos/script.ski...er.widgets
Code:
<content sortby="year" sortorder="descending">...</content>

Works well. And for mixed content I use my helper script. Like the screenshot attached.


Image
(2019-03-06, 15:03)sualfred Wrote: [ -> ]
Code:
<content sortby="year" sortorder="descending">...</content>

Works well. And for mixed content I use my helper script. Like the screenshot attached.


Image
 Yeah, but this not customizable, I just tried again, creating an .xsp
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>testmovies</name>
    <match>all</match>
   <order direction="descending">year</order>
</smartplaylist>

then setting it the container's content, returns <order direction="descending">title</order> instead by year.

also for mixed, why wouldn't it work to create, like in your ex., movies & genre is 'thriller', same for tvshows and then a third playlist with 'is playlist' for both and get mixed content for thriller...
It is customizable based on your skin implementation.
In my case I've just added a widget config dialog to set those things.

Image
(2019-03-06, 15:38)sualfred Wrote: [ -> ]It is customizable based on your skin implementation.
In my case I've just added a widget config dialog to set those things.

Image[/url]
 Just gave a quick peek at ur code and realized you've implemented an internal widget-select functionality, and using skin shortcuts just for menu,overriding action and building select-nodes, right?
that's neat. but really implementing that to titan is like doing an heart transplant at this point... Big Grin
Yep, I prefer it in this way and use just the select method of the script. Gives me more control what is going to happen and how. And I can easily bypass strange skinshortcuts bugs like a wrong detected content type etc.
Pages: 1 2 3 4 5 6