[HOW TO] Library Node Examples

  Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
zag Offline
Retired Team-Kodi Member
Posts: 4,006
Joined: Oct 2007
Reputation: 75
Location: UK
Post: #1
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.

Video_nodes (wiki)
Audio_nodes (wiki)

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.
(This post was last modified: 2016-01-31 15:04 by zag.)
find quote
DaveBlake Offline
Team-Kodi Member
Posts: 2,150
Joined: Jun 2015
Reputation: 56
Location: South West England
Post: #2
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.
(This post was last modified: 2017-01-04 14:18 by DaveBlake.)
find quote
zag Offline
Retired Team-Kodi Member
Posts: 4,006
Joined: Oct 2007
Reputation: 75
Location: UK
Post: #3
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
(This post was last modified: 2016-01-22 15:14 by zag.)
find quote
DaveBlake Offline
Team-Kodi Member
Posts: 2,150
Joined: Jun 2015
Reputation: 56
Location: South West England
Post: #4
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>
find quote
tkgafs Offline
Senior Member
Posts: 115
Joined: May 2008
Reputation: 2
Post: #5
Would it be possible to have a rule that say found all the tracks over 30 minutes long ?
find quote
DarkHelmet Offline
Posting Freak
Posts: 800
Joined: Jul 2008
Reputation: 4
Location: Hamburg, Germany
Post: #6
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.
(This post was last modified: 2016-01-26 13:09 by DarkHelmet.)
find quote
zag Offline
Retired Team-Kodi Member
Posts: 4,006
Joined: Oct 2007
Reputation: 75
Location: UK
Post: #7
Please post an example if you get it working, so it helps everyone
find quote
DarkHelmet Offline
Posting Freak
Posts: 800
Joined: Jul 2008
Reputation: 4
Location: Hamburg, Germany
Post: #8
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.
find quote
zag Offline
Retired Team-Kodi Member
Posts: 4,006
Joined: Oct 2007
Reputation: 75
Location: UK
Post: #9
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: screenshot002.png]
(This post was last modified: 2016-01-26 15:44 by zag.)
find quote
tkgafs Offline
Senior Member
Posts: 115
Joined: May 2008
Reputation: 2
Post: #10
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
find quote
DaveBlake Offline
Team-Kodi Member
Posts: 2,150
Joined: Jun 2015
Reputation: 56
Location: South West England
Post: #11
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.
find quote
DarkHelmet Offline
Posting Freak
Posts: 800
Joined: Jul 2008
Reputation: 4
Location: Hamburg, Germany
Post: #12
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.
find quote
DaveBlake Offline
Team-Kodi Member
Posts: 2,150
Joined: Jun 2015
Reputation: 56
Location: South West England
Post: #13
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
find quote
DaveBlake Offline
Team-Kodi Member
Posts: 2,150
Joined: Jun 2015
Reputation: 56
Location: South West England
Post: #14
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.
find quote
zag Offline
Retired Team-Kodi Member
Posts: 4,006
Joined: Oct 2007
Reputation: 75
Location: UK
Post: #15
Moved to guides and tips section
find quote
Post Reply