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


[HOW TO] Library Node Examples - zag - 2016-01-22

This is a thread dedicated to showing off examples of nodes that you have created for Kodi.
A node is basically a filtered library. So for example only show Kids Movies, or browse music by composer or a particular year.
Nodes work for both Video and Audio now. Any smart playlist can be turned into a node. They use a very similar xml format.

http://kodi.wiki/view/Video_nodes
http://kodi.wiki/view/Audio_nodes

To test out these nodes, you will need to create an XML text file, and copy it to your userdata/library folder.

Top IMDB 250 video node
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<node order="1" type="filter">
<label>IMDB Top 250</label>
<content>movies</content>
<match>all</match>
<icon>IMDB.png</icon>
<limit>250</limit>
<rule field="path" operator="contains"><value>Top250</value></rule>
</node>
Notes: Simply put all your IMDB movies in a single folder called for example C:\Movies\IMDB Top250

Electronic Music audio only
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<node order="10" type="filter">
<label>Genre Electronic</label>
<content>artists</content>
  <match>all</match>
   <rule field="genre" operator="is">
       <value>Electronic</value>
   </rule>
</node>
Notes: As you can see this is just a very simple Genre node. Don't forget you can add as many rules as you like to filter it more.

Those are just 2 examples, please post your own below.


RE: Library Node Examples - DaveBlake - 2016-01-22

There are rule type nodes, where you use same syntax as for smart playlist rules, and folder type which are more like the default nodes. Here is an example of a folder type music node that will work in Krypton onwards.

Let's presume that you are intereted in music producers, and have tagged your music with the producer e.g. PRODUCER in FLAC or TIPL name (Producer) in ID3. This node will list those producers.

Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="6" type="folder">
<label>Producers</label>
<icon>DefaultMusicArtists.png</icon>
<path>musicdb://artists/?role=Producer&amp;albumartistsonly=false</path>
</node>

Can do the same with any artist role e.g. composer, conductor, DJMixer etc. The standard roles are: Composer, Conductor, Orchestra, Lyricist, Remixer, Arranger, Engineer, Producer, DJMixer, Mixer. But use of the PERFORMER or TMCL and TIPL tags can create others e.g. Soloist, Drummer etc. that can be used in juts the same way.

Note the use of "albumartistsonly" to override the system albumartistsonly setting in case it is enabled, and always show all producers. If this was albumartistsonly=true it would only show those producers that were also listed as an album artist. Limiting to a role and album artist makes sense when you want to list say just composers for classical music albums rather than the composer of every song.


RE: Library Node Examples - zag - 2016-01-22

A-Z first letter nodes

All items starting with A:

Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="1" type="filter">
    <label>A</label>
    <content>artists</content>
    <rule field="artist" operator="startswith">
        <value>A</value>
    </rule>
</node>

...and to show all items starting with B:

Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="2" type="filter">
    <label>B</label>
    <content>artists</content>
    <rule field="artist" operator="startswith">
        <value>B</value>
    </rule>
</node>

Notes: This is used to break your library down into nodes of starting letter. Particularly useful for people with large libraries.

You can see the full list here https://github.com/xbmc/xbmc/pull/7518/files


RE: Library Node Examples - DaveBlake - 2016-01-24

Want to separate your FLAC files from your mp3 etc., a general way to look at sound quality perhaps?
Here is an "mp3 only" node.

Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="1" type="filter">
      <label>mp3 Songs Only</label>
      <icon>DefaultMusicSongs.png</icon>
      <content>songs</content>
      <rule field="filename" operator="endswith"><value>.mp3</value></rule>
</node>



RE: Library Node Examples - tkgafs - 2016-01-26

Would it be possible to have a rule that say found all the tracks over 30 minutes long ?


RE: Library Node Examples - DarkHelmet - 2016-01-26

That's already possible through a new smart playlist. Put length greater than 30 minutes in the rule and that should result in what you want.


RE: Library Node Examples - zag - 2016-01-26

Please post an example if you get it working, so it helps everyone


RE: Library Node Examples - DarkHelmet - 2016-01-26

Code:
<smartplaylist type="songs">
    <name>Songs longer than 30 minutes</name>
    <match>all</match>
    <rule field="time" operator="greaterthan">
        <value>30:00</value>
    </rule>
</smartplaylist>

Put that in a text file, name it "songs longer than 30 minutes.xsp" and put in the userdata/playlist folder under music. It works for me.


RE: Library Node Examples - zag - 2016-01-26

Thanks! So the corresponding node in music would be:

C:\Users\username\AppData\Roaming\Kodi\userdata\library\music\LongTracks.xml

Code:
<?xml version='1.0' encoding='UTF-8'?>
<node order="3" type="filter">
    <label>Long Tracks</label>
    <match>all</match>
    <content>songs</content>
    <rule field="time" operator="greaterthan"><value>30:00</value></rule>
</node>

Haven't tested it yet.

EDIT: works perfectly! Awesome, now we have a node for Live DJ sets Smile

Image


RE: Library Node Examples - tkgafs - 2016-01-31

is there any way the output can be sorted by say artist, or duration etc ?

at the moment the long tracks example seem to come out in order track number.artist


RE: Library Node Examples - DaveBlake - 2016-01-31

Can't you just choose the sort you want on the side blade?
Would be nice to set the default sort as pasrt of the node though.


RE: Library Node Examples - DarkHelmet - 2016-01-31

Try adding

Code:
<order direction="descending">playcount</order>
after "rule field..."

You should be able to use "descending", "ascending" after "order direction". Other possibility would be <order>random</order> to generate a shuffled list.

If you use "descending" or "ascending", you should be able to use "title", "track", "file", "path", "lastplayed", "rating", "year", "artist", "duration", "genre" or "album" to sort by.

Please note that this a guess but these codes work in smart playlists and from zag's transformation from my smart playlist example to a node I take it that nodes and smart playlists share basically the same code.


RE: Library Node Examples - DaveBlake - 2016-01-31

Yes rule type nodes and smart playlists use the same rule syntax. Thanks for reminding me of the <order> xml tag, so good to be sharing information here Smile


RE: Library Node Examples - DaveBlake - 2016-01-31

Hey @zag it seems a shame that this thread is hidden away under application development. It is more an (advanced perhaps) user hints, tips and guide thing. Your average user isn't going to look in the dev forum. Just a thought.


RE: Library Node Examples - zag - 2016-01-31

Moved to guides and tips section