Kodi Community Forum
[HOW TO] Library Node Examples - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (https://forum.kodi.tv/forumdisplay.php?fid=110)
+--- Thread: [HOW TO] Library Node Examples (/showthread.php?tid=257378)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-08

(2020-12-08, 02:53)LongMan Wrote: If all your 2160p movies are in the same folder, filter for that folder. There is then no need for exclusion.

ie
< ?xml version='1.0' encoding='UTF-8'?>
<node order="10" type="folder">
    <label>20382</label>
    <icon>DefaultRecentlyAddedMovies.png</icon>
    <path>videodb://recentlyaddedmovies/</path>
    <rule field="path" operator="contains">
        <value>movies/2160p</value>
    </rule>
</node>

< ?xml version='1.0' encoding='UTF-8'?>
<node order="10" type="folder">
    <label>20382</label>
    <icon>DefaultRecentlyAddedMovies.png</icon>
    <path>videodb://recentlyaddedmovies/</path>
    <rule field="path" operator="contains">
        <value>movies/4K</value>
    </rule>
</node>

Use option 1 or 2 depending on how you named the folders.

NB Since you are using path contains, there is no need for the full path, only the part of it that is distinct from the other folders

Hope that helps.
Cheers

Thanks, I thought that was the case but wanted to err on the side of being more restrictive just in case. All of the 4K movies live in /media/movies/4K/(whatever). I'd end up using the second one due to that, but like I said the "Recently Added" is only showing the non-4K movies and I can't figure out what I'm doing wrong.


RE: [HOW TO] Library Node Examples - DaveBlake - 2020-12-08

(2020-12-08, 09:30)Offsprin Wrote: ...the "Recently Added" is only showing the non-4K movies and I can't figure out what I'm doing wrong.
I see quite a bit of confusion in previous posts.

There are fundamentally 2 kinds of custom nodes - "folder" and "filter" - they are distinct and have different syntax and navigation behaviour.

1) "folder" type
These are very simple. They do NOT have <rule>, <content>, <group>, <match>, <limit> or <order> fields.
Only <label>, <icon> and <path> fields define a "folder" type node. They make use of a limited list of (internal to Kodi) virtual file paths which identify the node see https://kodi.wiki/view/Opening_Windows_and_Dialogs.

Example
Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="1" type="folder">
    <label>Recent Movies</label>
    <icon>DefaultRecentlyAddedMovies.png</icon>
    <path>videodb://recentlyaddedmovies/</path>
</node>
You can get some additional filtering on some folder type nodes by adding parameters to the path, but it is a side effect of how navigation within a node works internally and not intended as a user feature hence there is no official guide to how to use them. But they do have a use particularly if you want to filter artists or albums on the property of their songs.

2) "filter" type
These have the similar syntax to smart playlists and are defined by <label>, <icon> <rule>, <content>, <group>, <match>, <limit> or <order> fields. They do NOT have a <path> field. However some contents can have "path" rules that apply to a phyiscal music or video file location (but not to virtual file system paths)
For example (if all your 2160p movies are in the same folder, filter for that folder)
Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="9" type="filter">
    <label>Recent Movies 2160p</label>
    <content>movies</content>
    <match>all</match>
        <rule field="path" operator="contains">
        <value>2160p</value>
    </rule>
    <limit>25</limit>
    <order direction="descending">lastplayed</order>
</node>



RE: [HOW TO] Library Node Examples - LongMan - 2020-12-08

@DaveBlake,
You are absolutely right. I had missed that he was using a folder and not a filter type node. I was too focused on the rules part.

@Offsprin. Dave's explanation above is spot on. You should consider it when choosing the type of node to create. I would say if it is in your library use filter. If it is not scanned into the library, the use a folder node. My apologies for not noticing that you were using a folder node.

With that said, the node below should give you the desired list. Depending on the size list wanted, you can choose to modify or that have a limit at all.

<?xml version='1.0' encoding='UTF-8'?>
<node order="9" type="filter">
    <label>Recent Movies 4K</label>
    <content>movies</content>
    <match>all</match>
        <rule field="path" operator="contains">
        <value>movies/4K</value>
    </rule>
    <limit>25</limit>
    <order direction="descending">dateadded</order>
</node>


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-08

OK, thanks. To give you an idea of what I'm trying to do: I want to have the primary options of Movies, TV Shows and add 4K Movies and 4K TV Shows and copy the functionality of what Estuary currently shows by using the nodes. Clearly I'm mixing stuff up, which is great to know and thanks for all the help. If there was a way to literally just copy and paste what shows up with Estuary by default, then tweak from there, that might actually be easier. Is that something that can be done?


RE: [HOW TO] Library Node Examples - LongMan - 2020-12-08

That would be a bit more involved. You will need a node for the main menu item as well as nodes for the each of the widgets. The Main node and the modifications required for each widget is outlined below for 4K movies. With those nodes I would advice you to use one of the modded Estuary skins that allows you to use nodes. If you want to roll your own you will need to modify Home.xml for main menu and widgets.

Main

<?xml version='1.0' encoding='UTF-8'?>
<node order="9" type="filter">
    <label>Recent Movies 4K</label>
    <content>movies</content>
    <match>all</match>
        <rule field="path" operator="contains">
        <value>movies/4K</value>
    </rule>
    <order direction="asscending">title</order>
</node>

In Progress Movies
<rule field="inprogress" operator="true">
               <value></value>
           </rule>
       <limit>25</limit>
       <order direction="descending">lastplayed</order>

Recently/Last Added
<limit>25</limit>
    <order direction="descending">dateadded</order>

Unwatched Movies
<rule field="playcount" operator="is">
               <value>0</value>
           </rule>
       <limit>25</limit>
       <order direction="descending">random</order>

Random Movies
      <limit>25</limit>
       <order direction="descending">random</order>

Movie Sets
<group>sets</group>
      <limit>25</limit>
       <order direction="ascending">set</order>  OR <order direction="descending">random</order>

Hope that helps


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-08

(2020-12-08, 17:53)LongMan Wrote: That would be a bit more involved. You will need a node for the main menu item as well as nodes for the each of the widgets. The Main node and the modifications required for each widget is outlined below for 4K movies. With those nodes I would advice you to use one of the modded Estuary skins that allows you to use nodes. If you want to roll your own you will need to modify Home.xml for main menu and widgets.

Main

<?xml version='1.0' encoding='UTF-8'?>
<node order="9" type="filter">
    <label>Recent Movies 4K</label>
    <content>movies</content>
    <match>all</match>
        <rule field="path" operator="contains">
        <value>movies/4K</value>
    </rule>
    <order direction="asscending">title</order>
</node>

In Progress Movies
<rule field="inprogress" operator="true">
               <value></value>
           </rule>
       <limit>25</limit>
       <order direction="descending">lastplayed</order>

Recently/Last Added
<limit>25</limit>
    <order direction="descending">dateadded</order>

Unwatched Movies
<rule field="playcount" operator="is">
               <value>0</value>
           </rule>
       <limit>25</limit>
       <order direction="descending">random</order>

Random Movies
      <limit>25</limit>
       <order direction="descending">random</order>

Movie Sets
<group>sets</group>
      <limit>25</limit>
       <order direction="ascending">set</order>  OR <order direction="descending">random</order>

Hope that helps

Awesome, thanks. I'm using Amber since it allows the modification of nodes and whatnot, so I think this is exactly what I'm looking for. Thank you very much.


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-18

Just to follow up on this, when you say the Main node, you're talking about index.xml, right? If I tweak that one to add the different rules for contains/doesnotcontain, I won't need to tweak each of the subsequent nodes such as actors/genres/etc, right?

Also, for the recently added TV shows I switched from folder to filter, and it's showing the actual shows that've been added rather than the individual episodes. Is there any way to use the folder node type and tell it to only look at non-4K vs. 4K? There was mention of some limited functionality by @DaveBlake but looking at the wiki I'm not seeing anything that would do what I want, and I totally understand there's a reason why there's no guide for this, and it shouldn't be done by users.


RE: [HOW TO] Library Node Examples - DaveBlake - 2020-12-19

Quote:Is there any way to use the folder node type and tell it to only look at non-4K vs. 4K?
No.
BTW it is not that user's "shouldn't" use folder type nodes, happy for users to be as creative with Kodi as they can manage. It is just that it was not created as a user feature and is just a useful side effect in certain situations.

Anyway you can do it with a filter type node:
Recently added 4k episodes (assuming under a "4k" folder)
Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="10" type="filter">
    <label>4k Episodes</label>
    <content>episodes</content>
    <match>all</match>
    <rule field="path" operator="contains">
        <value>4K</value>
    </rule>
     <limit>25</limit>
       <order direction="descending">dateadded</order>
</node>

You do seem confused @Offsprin about what @LongMan is saying, but I will let him clarify.

Perhaps you should explore smart playlists to see what you can achieve with filter rules, you can create custom nodes with the same rule combination (the definition syntax of xml files is slightly different to xsp, but rules are the same).


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-19

I've used smart playlists, and that's actually where I started off but it wasn't doing what I wanted, so I figured it was nodes I needed to play with. Looks like you already explained what I was doing wrong as well, as I put the content as "tvshows" rather than "episodes" which, now that I think of it makes a lot of sense.


RE: [HOW TO] Library Node Examples - LongMan - 2020-12-19

Seems like you have figured most things out. Happy to hear that.

With regards to the Main node, that would be used in the Main Menu in the same way that you have Movies, and TV Shows in Estuary on the left. The other nodes I referenced are for the widgets. The other ones you are asking about are for the sub menus. These are already present as default video nodes for movies and tv shows in userdata/library/videos. My advice, copy those and add your rule.
eg.
    <rule field="path" operator="contains">
        <value>4K</value>
    </rule>

With regards to filter vs folder, as stated above I use filter for stuff scanned into the library and folder for things that are not.

eg.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<node order="3" type="folder" visible="True">
       <label>Home Videos</label>
       <icon>DefaultAddonVideo.png</icon>
       <path pathversion="1">smb://NAS/Home Videos/</path>
</node>

I see that you have figured out that unlike movies which have just one value for content, tv shows can have two , namely tv shows or episodes. You will ind a similar thing for music if you venture there. Content can be artists, albums or songs. @DaveBlake have done a lot of work on music library making it real easy and flexible. I think there is still some work left with ordering but, for the most part, it is on par with and in some cases better that video right now


The power of Kodi is that you can make it your Kodi as oppose to being handed what someone thinks is best for you. I for example don't use the in progress node, I use a last viewed. Often times I will watch the first 20-30 minutes of a show and then the show watch me for the hour. The show is complete and marked as watched so no longer in progress but I have seen only 20 minutes of it. By having a last viewed node, the last video that I 'watched' is right there for me to continue.

So keep experimenting until you make your Kodi.

Hope this helps.
Cheers,
LongMan


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-19

Thanks LongMan. I guess the thing I'm confused by, mostly, is where "main" comes into play. I see the index.xml, and all of the other XML files which is how I've been piecing together how everything works. I love that Kodi is so powerful in terms of letting me tinker, unlike most other software.

One question I had, and I'm not sure if this is due to Kodi or (again), my misunderstanding: I copied all of my /userdata/library files from one machine to another, but on the other machine when I go to the new nodes I created, they just take me to the files options, like Movies, TV Shows, 4K Movies, 4K TV Shows as opposed to the direct view I expected. So for example:

I click on TV Shows, I expect to see the list of the shows I have. Instead, I'm being taken to the menu that lets me then choose which section I want, thus causing an extra click. Is that due to me not having copied over my whole Kodi folder, or is that due to something else?


RE: [HOW TO] Library Node Examples - LongMan - 2020-12-19

I forgot about the index file. It contains the identifying info for a folder of nodes. Take for example, the sub menu nodes that i suggested that you copy and modify. the folder for movies contains an index file with label, 342, which I suspect is movies in English and get translated to the equivalent word or expression in other languages. When you copy for your 4K movies you might want to change that label. The truth I only find that index file useful when browsing nested nodes ie a folder within a folder.
Quote:One question I had, and I'm not sure if this is due to Kodi or (again), my misunderstanding: I copied all of my /userdata/library files from one machine to another, but on the other machine when I go to the new nodes I created, they just take me to the files options, like Movies, TV Shows, 4K Movies, 4K TV Shows as opposed to the direct view I expected.
Remember I pointed out that the setup you see in Estuary has three separate pieces.
Main Node (Given Above) btw this is the titles nodes in the default set
Nodes for Widgets (necessary modifications given Above)
and a folder of nodes that you that you see labeled Categories for the top row. (copy the default and modify)

You need a Main Node 4K Movies, the nodes for the widgets, and a copy of the default nodes modified with your rule for the Categories widget.

I am not sure that it is worth the effort for the categories. Maybe just point to the defaults. I find I use the main and widgets most of the time


RE: [HOW TO] Library Node Examples - houser - 2020-12-20

Hello,
Trying to add a node filter that sorts movies by composer. 
If it is possible, would appreciate a hint. Maybe someone has already done this?
Many thanks


RE: [HOW TO] Library Node Examples - Offsprin - 2020-12-23

(2020-12-19, 22:57)LongMan Wrote: I forgot about the index file. It contains the identifying info for a folder of nodes. Take for example, the sub menu nodes that i suggested that you copy and modify. the folder for movies contains an index file with label, 342, which I suspect is movies in English and get translated to the equivalent word or expression in other languages. When you copy for your 4K movies you might want to change that label. The truth I only find that index file useful when browsing nested nodes ie a folder within a folder.
Quote:One question I had, and I'm not sure if this is due to Kodi or (again), my misunderstanding: I copied all of my /userdata/library files from one machine to another, but on the other machine when I go to the new nodes I created, they just take me to the files options, like Movies, TV Shows, 4K Movies, 4K TV Shows as opposed to the direct view I expected.
Remember I pointed out that the setup you see in Estuary has three separate pieces.
Main Node (Given Above) btw this is the titles nodes in the default set
Nodes for Widgets (necessary modifications given Above)
and a folder of nodes that you that you see labeled Categories for the top row. (copy the default and modify)

You need a Main Node 4K Movies, the nodes for the widgets, and a copy of the default nodes modified with your rule for the Categories widget.

I am not sure that it is worth the effort for the categories. Maybe just point to the defaults. I find I use the main and widgets most of the time

Yeah, ok, that makes sense. I was copying the node folder, and that was seemingly not working. I've pretty much gotten it setup, however now I'm finding something that I can't understand and I'm hoping maybe you can help. For any TV shows that I have both 1080p and 4K, Kodi's only showing the TV show episodes in the 4K folder, and duplicating them. For example: Chernobyl has 5 episodes, and I have it in both 1080p and 4K. When I look at my library, I don't see Chernobyl in the 1080p library, but I see it in the 4K library, and when I go into that folder it shows 10 episodes, with 2 copies of each episode.

I tried to manually re-import the 1080p episodes and now they've just outright disappeared, but I'd like to figure out what's causing this because I end up having both the 4K and 1080p versions of both for different screens. Thanks again for all the help, @LongMan.


RE: [HOW TO] Library Node Examples - LongMan - 2020-12-24

@Offsprin,
You might might not be able to get around that with tv shows. I think Kodi automatically add new episodes to an existing tv show even if the path is different. That is to handle the case where say Season 1 is on HD 1 which fills before season 2 starts. This results in season 2 being placed on HD 2. In that case you would still only one tv show entry in the library. That decision was made long before current setups which also storage pools for continuous storage expansion.

Hopefully at some point a Source property is added to video similar to the one added to music, which also for such distinction.

Cannot offer a solution but hopefully the explanation helps.
Cheers,
LongMan