Smart playlists: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>Udepub
No edit summary
(112 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{see also|Playlists}}
{{:Smart_playlists/Contents}}
<section begin="intro"/>XBMC supports '''smart playlists''' for all types of media (excluding pictures), which essentially use a set of rules to limit the results from the [[XBMC_databases|databases]]. This means that to be able to create a smart playlist in the GUI, music/video ''must'' first be added to the libraries using a [[Scrapers|scraper]] [[Add-ons|addon]] or by creating [[NFO_files|NFO files]]. Smart playlist can be created either by using the built-in GUI smart playlist editor accessible from the [[Playlists|Playlists]] section, or by creating an [[w:XML|XML]] file with the extension XSP ('''X'''BMC '''S'''mart '''P'''laylist).<section end="intro"/>
{{mininav|[[Playlists]] }}


==Creating a smart playlist in the GUI==
{{incomplete}}
===Smart playlist for music===
;<big>{{highlight|Music -> Playlists -> New smart playlist|bordered=yes}}</big>
<gallery widths=500px heights=280px>
Image:Musicxsp1.png|''' Step 1: '''Select "Music" on main menu
Image:Musicxsp2.png|''' Step 2: '''Select "Playlists" from the options
Image:Musicxsp3.png|''' Step 3: '''Select "New smart playlist" from the options
Image:Musicxsp4.png|''' Step 4: '''Fill in with the desired options and when done press {{keypress|OK}}
</gallery>


===Smart playlist for video===
== Introduction ==
;<big>{{highlight|Video -> Playlists -> New smart playlist|bordered=yes}}</big>
<section begin="intro"/>Smart Playlists are a versatile feature that allow you to create customised lists of media that may be more suited to your browsing preference. They are a set of rules/filters that allow you to display a sub set of the media in your library.<section end="intro"/>
<gallery widths=500px heights=280px>
Image:Videoxsp1.png|''' Step 1: '''Select "Videos" on main menu
Image:Videoxsp2.png|''' Step 2: '''Select "Playlists" from the options
Image:Videoxsp3.png|''' Step 3: '''Select "New smart playlist" from the options
Image:Videoxsp4.png|''' Step 4: '''Fill in with the desired options and when done press {{keypress|OK}}
</gallery>


== Format of a smart playlist file ==
Once a smart playlist is created, it can be browsed like any other list in the {{kodi}} library.  
Smart playlists are plain text files that can be parsed by an XML reader (e.g. [[w:Visual_studio|Visual Studio]] and [[w:Notepad%2B%2B|Notepad++]]). Any text editor can be used to create them. They should be saved with the extension XPS and placed in your [[Userdata]] directory (smart playlist XSP files cannot be read off of remote shares at present).


The format is as follows:
A Smart Playlist can also be set as a menu item on the main menu using any compatible skin. See: '''''[[Custom home items]]'''''
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>All U2 from after 1990</name>
    <match>all</match>
    <rule field="artist" operator="is">
        <value>U2</value>
    </rule>
    <rule field="year" operator="greaterthan">
        <value>1990</value>
    </rule>
    <limit>50</limit>
    <order direction="descending">playcount</order>
</smartplaylist>
</source>


=== Types ===
'''Notes:'''
Smart playlists can be of one of the following types:
* Smart Playlists work by using the information in the databases. A correctly scanned/scraped library is required for accurate results
* songs (default)
* It is not possible to combine different classes of media into a playlist. eg you cannot combine Movies and TV Shows. The only combining allowed is Music and Music Videos as these may share a common Artist
* albums
* movies
* tvshows
* episodes
* musicvideos
* mixed (audio and music videos)


<source lang="xml">
These pages are a basic guide to help you understand the process of creating a smart playlist. The easiest way to discover the power of smart playlists is to create and test. Create as many as you like, they can all be deleted and there is no effect on the rest of your setup.
<smartplaylist type="songs">
</source>


=== Name and Match ===
Basically there are two header tags, <code><name></code> and <code><match></code> and then a set of <code><rule></code> tags that define the rules to use, along with an <code><order></code> tag to allow sorting and a <code><limit></code> tag to limit the returned results. Note that the tags and attributes are all case-sensitive. The <code><name></code> tag is the name of the playlist and the <code><match></code> tag indicates how the <code><rule></code> tags should be matched. If <code><match>all</match></code> like in the above example, then only songs which satisfy all the <code><rule></code>'s will be included. If <code><match>one</match></code> is specified, then songs that satisfy any one (or more) of the <code><rule></code>'s will be included.


<source lang="xml">
== Methods ==
<name>All U2 from after 1990</name>
Playlists can be created and edited using either of the two following methods :
<match>all</match>
</source>


=== Rules ===
{{big|'''[[Smart_playlists/GUI Method|GUI Method]]'''}} - Create and edit playlists directly in {{kodi}} using the playlist editor
The <code><rule></code> tags, of which there can be as many as you wish, have two attributes (<code>field</code> and <code>operator</code>) and a <code><value></code> tag.


<source lang="xml">
{{big|'''[[Smart_playlists/XSP Method|XSP Method]]'''}} - Advanced users can create and edit the XSP files located in the '''[[userdata]]\playlists''' folder
<rule field="artist" operator="is">
    <value>U2</value>
</rule>
</source>


==== Fields ====
Also...
Depending on the type of the smart playlist different <code>field</code>s are available:
{| class="wikitable" style="margin-right: 0;"
!colspan="2"|<code>field</code>
!colspan="3"|music
!colspan="4"|video
!colspan="1"|
|-
!style="padding-left: 5px; padding-right: 10px;"|Name
!style="padding-left: 10px; padding-right: 10px;"|Data type
!style="padding-left: 10px; padding-right: 10px;"|songs
!style="padding-left: 10px; padding-right: 10px;"|albums
!style="padding-left: 10px; padding-right: 10px;"|artists
!style="padding-left: 10px; padding-right: 10px;"|movies
!style="padding-left: 10px; padding-right: 10px;"|tvshows
!style="padding-left: 10px; padding-right: 10px;"|episodes
!style="padding-left: 10px; padding-right: 10px;"|musicvideos
!style="padding-left: 10px; padding-right: 10px;"|mixed
|-
|style="padding-left: 5px;"|genre
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|album
|string
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|artist
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|albumartist
|string
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|title
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|year
|number
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|time
|number
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|tracknumber
|number
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|filename
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|path
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|playcount
|number
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|lastplayed
|date
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|inprogress
|boolean
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|rating
|number
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|comment
|string
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|dateadded
|date
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|plot
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|plotoutline
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tagline
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|mpaarating
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|top250
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|status
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|votes
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|director
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|actor
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|studio
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|country
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|numepisodes
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|numwatched
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|writers
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|airdate
|date
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|episode
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|season
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tvshow
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|episodetitle
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|review
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|themes
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|moods
|string
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|styles
|string
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|type
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|label
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|hastrailer
|boolean
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|videoresolution
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiochannels
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|videocodec
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiocodec
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiolanguage
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|subtitlelanguage
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|videoaspect
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|set
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tag
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}<ref name="gotham">{{gotham note|Coming in XBMC v13, Gotham}}</ref>
|{{no}}
|{{no}}<ref name="gotham"/>
|{{no}}<ref name="gotham"/>
|-
|style="padding-left: 5px;"|instruments
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|biography
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|born
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|band formed
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|disbanded
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|died
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|playlist
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|}


==== Operators ====
: '''[[Smart_playlists/Rules_and_groupings|Rules & Groupings]]''' - A list of Rules, Fields, Operators and Values that can be used in the XSP files
The <code>operator</code> attribute specifies the rule that should be used to match the parameter to the <code>field</code>. All matching is done case-insensitive. The allowed <code>operator</code>s are:
; contains : True if the field contains the parameter as a substring
; doesnotcontain : True if the field does not contain the parameter as a substring
; is : True if the field matches the parameter exactly
; isnot : True if the field does not match the parameter exactly
; startswith : True if the start of the field matches the parameter
; endswith : True if the end of the field matches the parameter
; lessthan : True if the content of the field is less than the parameter
; greaterthan : True if the content of the field is greater than the parameter
; after : True if the content of the field comes after the parameter
; before : True if the content of the field comes before the parameter
; inthelast : True if the field falls in the last range specified by the parameter. Only applicable for a date field.
; notinthelast : True if the field does not fall in the last range specified by the parameter. Only applicable for a date field.


=== Limit and Order ===
: '''[[Smart_playlists/Examples|Example XSP files]]''' - Example XSP files that can be copied into your own setup
The <code><limit></code> tag simply takes a number of songs as it's limit. A missing limit tag, or <code><limit>0</limit></code> will retrieve all matching songs. The <code><order></code> tag has a <code>direction</code> attribute, the values of which can be <code>ascending</code> or <code>descending</code>, and it's value is a field as above, or can be <code><order>random</order></code> if you want a random ordering returned. Note that random should be used with care - it is quite slow if the returned results from the <code><rule></code> sets is large (more than 500 items).


The above example, therefore selects all songs whose artist field is U2 and whose year field is greater than 1990, orders them by the number of times they've been played (most played first) then limits it to just 50. Thus, the top 50 songs you've played from all U2 songs published after 1990.


<source lang="xml">
<limit>50</limit>
<order direction="descending">playcount</order>
</source>


=== Grouping ===
{{updated|18}}
 
[[Category:Index]]
{{Gotham}}
[[Category:Guides]]
 
[[Category:Manual]]
The <code><group></code> tag allows to group the resulting list of media items by a specific category. The final list will consist of folder nodes containing matching media items. Depending on the type of the Smart Playlist the following grouping categories exist:
[[Category:Karellen]]
 
[[Category:Video library]]
{| class="wikitable" style="margin-right: 0;"
[[Category:Music library]]
!colspan="2"|<code>field</code>
[[Category:Advanced topics]]
!colspan="3"|music
!colspan="4"|video
!colspan="1"|
|-
!style="padding-left: 5px; padding-right: 10px;"|Name
!style="padding-left: 10px; padding-right: 10px;"|Data type
!style="padding-left: 10px; padding-right: 10px;"|songs
!style="padding-left: 10px; padding-right: 10px;"|albums
!style="padding-left: 10px; padding-right: 10px;"|artists
!style="padding-left: 10px; padding-right: 10px;"|movies
!style="padding-left: 10px; padding-right: 10px;"|tvshows
!style="padding-left: 10px; padding-right: 10px;"|episodes
!style="padding-left: 10px; padding-right: 10px;"|musicvideos
!style="padding-left: 10px; padding-right: 10px;"|mixed
|-
|style="padding-left: 5px;"|none
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|genres
|string
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|years
|string
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|actors
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|artists
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|directors
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|writers
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|studios
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|countries
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|sets
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|tags
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|}
 
{{Notice|There's an important difference between not providing a <code><group></code> tag (or providing an empty <code><group></code> tag) and setting the value of the <code><group></code> tag to '''none''': The latter will overrule any mixed grouping that would be applied by default to a list of media items (specifically for a mixed list of movies and [[movie sets]] if the setting ''Group movies into sets'' is enabled).}}
 
==== Mixed grouping ====
 
For the '''sets''' grouping category there is support for additional so called mixed grouping. The difference to normal grouping is that the resulting list will not just be a list of grouped folders but a mix of media items and grouped folders. Mixed grouping can be controlled using the '''mixed''' attribute in the <code><group></code> tag with a boolean value (''true'' or ''false'').
 
== Combining playlists ==
The <code>playlist</code> <code>field</code> can be used to combine several playlists together. When playlists are combined, the <code><limit></code> and <code><order></code> tags of the included playlists are ignored; only the <code><order></code> and <code><limit></code> of the final playlist are used.
 
As a simple example, lets create a new playlist combining the "Rock Music from the 1970s" and "Recently Played Songs" playlists above, to produce a playlist with the recently played rock songs from the 1970s.
 
'''Recently played rock tracks from the 1970s'''
<source lang="xml">
<?xml version="1.0"?>
<smartplaylist type="songs">
  <name>Recently played  Rock Tracks from the 1970s</name>
  <match>all</match>
  <rule field="playlist" operator="is">Rock Music from the 1970s</rule>
  <rule field="playlist" operator="is">Recently Played Songs</rule>
</smartplaylist>
</source>
 
Using this system allows very complex queries to be built. Note that in a single playlist, you can only match ALL of the rules, or ONE (or more) of the rules. This is basically either ANDing the conditions together, or ORing them together. You cannot mix AND with OR in a single playlist. To build up a playlist with both AND and OR operations on the rules, you use multiple playlists to group the AND operations and the OR operations, then combine them as above.
 
== Examples ==
===Music examples===
==== Recently played songs ====
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Recently Played Songs</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>2 weeks</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</source>
 
==== Top 100 songs ====
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Top 100 Songs</name>
    <match>all</match>
    <rule field="playcount" operator="greaterthan">
        <value>0</value>
    </rule>
    <order direction="descending">playcount</order>
    <limit>100</limit>
</smartplaylist>
</source>
 
==== Rock music from the 1970s ====
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Rock Music from the 1970s</name>
    <match>all</match>
    <rule field="genre" operator="is">
        <value>Rock</value>
    </rule>
    <rule field="year" operator="greaterthan">
        <value>1969</value>
    </rule>
    <rule field="year" operator="lessthan">
        <value>1980</value>
    </rule>
</smartplaylist>
</source>
 
===Movie examples===
====Random movie (only ''one'' movie shown)====
 
This isn't possible to create in the GUI because the lower limit is 10.<br />
Even though the limit is only ''one'' you still need to set ''random'' order.
 
<source lang=xml>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>Random movie</name>
    <match>all</match>
    <rule field="playcount" operator="is">
        <value>0</value>
    </rule>
    <limit>1</limit>
    <order direction="ascending">random</order>
</smartplaylist>
</source>
 
===TV show examples===
====Last played episodes (history)====
Not ''in progress'' episodes and ''playcount'' > 0.
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Last played episodes (history)</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>6 months</value>
    </rule>
    <rule field="inprogress" operator="false" />
    <rule field="playcount" operator="greaterthan">
        <value>0</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</source>
 
====Last played TV shows====
Including TV shows with ''in progress'' episodes.
 
<source lang="xml">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>Last played TV shows</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>6 months</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</source>
 
==Notes==
<references/>
 
 
[[Category:Video Library]]
[[Category:Music Library]]

Revision as of 20:20, 16 November 2020

Smart Playlists Contents

Home icon grey.png   ▶ Playlists ▶ Smart playlists


Introduction

Smart Playlists are a versatile feature that allow you to create customised lists of media that may be more suited to your browsing preference. They are a set of rules/filters that allow you to display a sub set of the media in your library.

Once a smart playlist is created, it can be browsed like any other list in the Kodi library.

A Smart Playlist can also be set as a menu item on the main menu using any compatible skin. See: Custom home items

Notes:

  • Smart Playlists work by using the information in the databases. A correctly scanned/scraped library is required for accurate results
  • It is not possible to combine different classes of media into a playlist. eg you cannot combine Movies and TV Shows. The only combining allowed is Music and Music Videos as these may share a common Artist

These pages are a basic guide to help you understand the process of creating a smart playlist. The easiest way to discover the power of smart playlists is to create and test. Create as many as you like, they can all be deleted and there is no effect on the rest of your setup.


Methods

Playlists can be created and edited using either of the two following methods :

GUI Method - Create and edit playlists directly in Kodi using the playlist editor

XSP Method - Advanced users can create and edit the XSP files located in the userdata\playlists folder

Also...

Rules & Groupings - A list of Rules, Fields, Operators and Values that can be used in the XSP files
Example XSP files - Example XSP files that can be copied into your own setup