43 lines
32 KiB
HTML
43 lines
32 KiB
HTML
<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay devices (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio. "><meta name=author content="OwnTone maintainers"><link href=https://owntone.github.io/owntone-server/smart-playlists/ rel=canonical><link href=../playlists/ rel=prev><link href=../integrations/spotify/ rel=next><link rel=icon href=../assets/favicon.ico><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.5.49"><title>Smart Playlists - OwnTone</title><link rel=stylesheet href=../assets/stylesheets/main.6f8fc17f.min.css><link rel=stylesheet href=../assets/stylesheets/palette.06af60db.min.css><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback"><style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style><link rel=stylesheet href=../assets/extra.css><script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=white data-md-color-accent=teal> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#smart-playlists class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=.. title=OwnTone class="md-header__button md-logo" aria-label=OwnTone data-md-component=logo> <img src=../assets/logo.svg alt=logo> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> OwnTone </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> Smart Playlists </span> </div> </div> </div> <form class=md-header__option data-md-component=palette> <input class=md-option data-md-color-media data-md-color-scheme=default data-md-color-primary=white data-md-color-accent=teal aria-label="Switch to dark mode" type=radio name=__palette id=__palette_0> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_1 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3"/></svg> </label> <input class=md-option data-md-color-media data-md-color-scheme=slate data-md-color-primary=blue-grey data-md-color-accent=teal aria-label="Switch to light mode" type=radio name=__palette id=__palette_1> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_0 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4M7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"/></svg> </label> </form> <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script> <label class="md-header__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> </label> <div class=md-search data-md-component=search role=dialog> <label class=md-search__overlay for=__search></label> <div class=md-search__inner role=search> <form class=md-search__form name=search> <input type=text class=md-search__input name=query aria-label=Search placeholder=Search autocapitalize=off autocorrect=off autocomplete=off spellcheck=false data-md-component=search-query required> <label class="md-search__icon md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg> </label> <nav class=md-search__options aria-label=Search> <button type=reset class="md-search__icon md-icon" title=Clear aria-label=Clear tabindex=-1> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg> </button> </nav> </form> <div class=md-search__output> <div class=md-search__scrollwrap tabindex=0 data-md-scrollfix> <div class=md-search-result data-md-component=search-result> <div class=md-search-result__meta> Initializing search </div> <ol class=md-search-result__list role=presentation></ol> </div> </div> </div> </div> </div> <div class=md-header__source> <a href=https://github.com/owntone/owntone-server title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><!-- Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg> </div> <div class=md-source__repository> owntone/owntone-server </div> </a> </div> </nav> </header> <div class=md-container data-md-component=container> <nav class=md-tabs aria-label=Tabs data-md-component=tabs> <div class=md-grid> <ul class=md-tabs__list> <li class=md-tabs__item> <a href=.. class=md-tabs__link> Home </a> </li> <li class="md-tabs__item md-tabs__item--active"> <a href=../getting-started/ class=md-tabs__link> Documentation </a> </li> <li class=md-tabs__item> <a href=../json-api/ class=md-tabs__link> JSON API </a> </li> </ul> </div> </nav> <main class=md-main data-md-component=main> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component=sidebar data-md-type=navigation> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--primary md-nav--lifted" aria-label=Navigation data-md-level=0> <label class=md-nav__title for=__drawer> <a href=.. title=OwnTone class="md-nav__button md-logo" aria-label=OwnTone data-md-component=logo> <img src=../assets/logo.svg alt=logo> </a> OwnTone </label> <div class=md-nav__source> <a href=https://github.com/owntone/owntone-server title="Go to repository" class=md-source data-md-component=source> <div class="md-source__icon md-icon"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 448 512"><!-- Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg> </div> <div class=md-source__repository> owntone/owntone-server </div> </a> </div> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=.. class=md-nav__link> <span class=md-ellipsis> Home </span> </a> </li> <li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2 checked> <label class=md-nav__link for=__nav_2 id=__nav_2_label tabindex> <span class=md-ellipsis> Documentation </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=1 aria-labelledby=__nav_2_label aria-expanded=true> <label class=md-nav__title for=__nav_2> <span class="md-nav__icon md-icon"></span> Documentation </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../getting-started/ class=md-nav__link> <span class=md-ellipsis> Getting Started </span> </a> </li> <li class=md-nav__item> <a href=../installation/ class=md-nav__link> <span class=md-ellipsis> Installation </span> </a> </li> <li class=md-nav__item> <a href=../configuration/ class=md-nav__link> <span class=md-ellipsis> Configuration </span> </a> </li> <li class=md-nav__item> <a href=../building/ class=md-nav__link> <span class=md-ellipsis> Building </span> </a> </li> <li class=md-nav__item> <a href=../library/ class=md-nav__link> <span class=md-ellipsis> Library </span> </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2_6> <label class=md-nav__link for=__nav_2_6 id=__nav_2_6_label tabindex=0> <span class=md-ellipsis> Control </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_2_6_label aria-expanded=false> <label class=md-nav__title for=__nav_2_6> <span class="md-nav__icon md-icon"></span> Control </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../control-clients/mobile/ class=md-nav__link> <span class=md-ellipsis> Mobile Device </span> </a> </li> <li class=md-nav__item> <a href=../control-clients/desktop/ class=md-nav__link> <span class=md-ellipsis> Desktop </span> </a> </li> <li class=md-nav__item> <a href=../control-clients/web/ class=md-nav__link> <span class=md-ellipsis> Browser </span> </a> </li> <li class=md-nav__item> <a href=../control-clients/cli-api/ class=md-nav__link> <span class=md-ellipsis> API and CLI </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2_7> <label class=md-nav__link for=__nav_2_7 id=__nav_2_7_label tabindex=0> <span class=md-ellipsis> Audio Outputs </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_2_7_label aria-expanded=false> <label class=md-nav__title for=__nav_2_7> <span class="md-nav__icon md-icon"></span> Audio Outputs </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../audio-outputs/airplay/ class=md-nav__link> <span class=md-ellipsis> AirPlay </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/chromecast/ class=md-nav__link> <span class=md-ellipsis> Chromecast </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/local-audio/ class=md-nav__link> <span class=md-ellipsis> Local Audio </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/mobile/ class=md-nav__link> <span class=md-ellipsis> Mobile Device </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/web/ class=md-nav__link> <span class=md-ellipsis> Web </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/roku/ class=md-nav__link> <span class=md-ellipsis> Roku </span> </a> </li> <li class=md-nav__item> <a href=../audio-outputs/streaming/ class=md-nav__link> <span class=md-ellipsis> Streaming </span> </a> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../media-clients/ class=md-nav__link> <span class=md-ellipsis> Media Clients </span> </a> </li> <li class=md-nav__item> <a href=../artwork/ class=md-nav__link> <span class=md-ellipsis> Artwork </span> </a> </li> <li class=md-nav__item> <a href=../playlists/ class=md-nav__link> <span class=md-ellipsis> Playlists and Radio </span> </a> </li> <li class="md-nav__item md-nav__item--active"> <input class="md-nav__toggle md-toggle" type=checkbox id=__toc> <label class="md-nav__link md-nav__link--active" for=__toc> <span class=md-ellipsis> Smart Playlists </span> <span class="md-nav__icon md-icon"></span> </label> <a href=./ class="md-nav__link md-nav__link--active"> <span class=md-ellipsis> Smart Playlists </span> </a> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class=md-nav__list data-md-component=toc data-md-scrollfix> <li class=md-nav__item> <a href=#syntax class=md-nav__link> <span class=md-ellipsis> Syntax </span> </a> </li> <li class=md-nav__item> <a href=#examples class=md-nav__link> <span class=md-ellipsis> Examples </span> </a> </li> <li class=md-nav__item> <a href=#date-operand-syntax class=md-nav__link> <span class=md-ellipsis> Date Operand Syntax </span> </a> </li> <li class=md-nav__item> <a href=#differences-with-mt-daapd-smart-playlists class=md-nav__link> <span class=md-ellipsis> Differences with MT-daapd Smart Playlists </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2_12> <label class=md-nav__link for=__nav_2_12 id=__nav_2_12_label tabindex=0> <span class=md-ellipsis> Services Integration </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_2_12_label aria-expanded=false> <label class=md-nav__title for=__nav_2_12> <span class="md-nav__icon md-icon"></span> Services Integration </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../integrations/spotify/ class=md-nav__link> <span class=md-ellipsis> Spotify </span> </a> </li> <li class=md-nav__item> <a href=../integrations/lastfm/ class=md-nav__link> <span class=md-ellipsis> LastFM </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type=checkbox id=__nav_2_13> <label class=md-nav__link for=__nav_2_13 id=__nav_2_13_label tabindex=0> <span class=md-ellipsis> Advanced Setup </span> <span class="md-nav__icon md-icon"></span> </label> <nav class=md-nav data-md-level=2 aria-labelledby=__nav_2_13_label aria-expanded=false> <label class=md-nav__title for=__nav_2_13> <span class="md-nav__icon md-icon"></span> Advanced Setup </label> <ul class=md-nav__list data-md-scrollfix> <li class=md-nav__item> <a href=../advanced/outputs-alsa/ class=md-nav__link> <span class=md-ellipsis> ALSA </span> </a> </li> <li class=md-nav__item> <a href=../advanced/outputs-pulse/ class=md-nav__link> <span class=md-ellipsis> PulseAudio </span> </a> </li> <li class=md-nav__item> <a href=../advanced/radio-streams/ class=md-nav__link> <span class=md-ellipsis> Radio Streams </span> </a> </li> <li class=md-nav__item> <a href=../advanced/remote-access/ class=md-nav__link> <span class=md-ellipsis> Remote Access </span> </a> </li> <li class=md-nav__item> <a href=../advanced/multiple-instances/ class=md-nav__link> <span class=md-ellipsis> Multiple Instances </span> </a> </li> </ul> </nav> </li> </ul> </nav> </li> <li class=md-nav__item> <a href=../json-api/ class=md-nav__link> <span class=md-ellipsis> JSON API </span> </a> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component=sidebar data-md-type=toc> <div class=md-sidebar__scrollwrap> <div class=md-sidebar__inner> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class=md-nav__title for=__toc> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class=md-nav__list data-md-component=toc data-md-scrollfix> <li class=md-nav__item> <a href=#syntax class=md-nav__link> <span class=md-ellipsis> Syntax </span> </a> </li> <li class=md-nav__item> <a href=#examples class=md-nav__link> <span class=md-ellipsis> Examples </span> </a> </li> <li class=md-nav__item> <a href=#date-operand-syntax class=md-nav__link> <span class=md-ellipsis> Date Operand Syntax </span> </a> </li> <li class=md-nav__item> <a href=#differences-with-mt-daapd-smart-playlists class=md-nav__link> <span class=md-ellipsis> Differences with MT-daapd Smart Playlists </span> </a> </li> </ul> </nav> </div> </div> </div> <div class=md-content data-md-component=content> <article class="md-content__inner md-typeset"> <h1 id=smart-playlists>Smart Playlists<a class=headerlink href=#smart-playlists title="Permanent link">¶</a></h1> <p>To add a smart playlist to the server, create a new text file with a filename ending with .smartpl; the filename doesn't matter, only the .smartpl ending does. The file must be placed somewhere in your library folder.</p> <h2 id=syntax>Syntax<a class=headerlink href=#syntax title="Permanent link">¶</a></h2> <p>The contents of a smart playlist must follow the syntax:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a>"Playlist Name" { expression }
|
|
</code></pre></div> <p>There is exactly one smart playlist allowed for a .smartpl file.</p> <p>An expression consists of:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a>field-name operator operand
|
|
</code></pre></div> <p>Where valid field-names (with their types) are:</p> <ul> <li><code>artist</code> (string)</li> <li><code>album_artist</code> (string)</li> <li><code>album</code> (string)</li> <li><code>title</code> (string)</li> <li><code>genre</code> (string)</li> <li><code>composer</code> (string)</li> <li><code>comment</code> (string)</li> <li><code>path</code> (string)</li> <li><code>type</code> (string)</li> <li><code>grouping</code> (string)</li> <li><code>data_kind</code> (enumeration)</li> <li><code>media_kind</code> (enumeration)</li> <li><code>play_count</code> (integer)</li> <li><code>skip_count</code> (integer)</li> <li><code>rating</code> (integer)</li> <li><code>year</code> (integer)</li> <li><code>compilation</code> (integer)</li> <li><code>track</code> (integer)</li> <li><code>disc</code> (integer)</li> <li><code>time_added</code> (date)</li> <li><code>time_modified</code> (date)</li> <li><code>time_played</code> (date)</li> <li><code>time_skipped</code> (date)</li> <li><code>random</code> (special)</li> <li><code>file_size</code> (integer)</li> </ul> <p>Valid operators include:</p> <ul> <li><code>is</code>, <code>includes</code>, <code>starts with</code>, <code>ends with</code> (string)</li> <li><code>></code>, <code><</code>, <code><=</code>, <code>>=</code>, <code>=</code> (int)</li> <li><code>after</code>, <code>before</code> (date)</li> <li><code>is</code> (enumeration)</li> </ul> <p>The <code>is</code> operator must exactly match the field value, while the <code>includes</code> operator matches a substring. The <code>starts with</code> operator matches, if the value starts with the given prefix, and <code>ends with</code> matches the opposite. All these matches are case-insensitive.</p> <p>Valid operands include:</p> <ul> <li>"string value" (string)</li> <li>integer (int)</li> </ul> <p>Valid operands for the enumeration <code>data_kind</code> are:</p> <ul> <li><code>file</code></li> <li><code>url</code></li> <li><code>spotify</code></li> <li><code>pipe</code></li> </ul> <p>Valid operands for the enumeration <code>media_kind</code> are:</p> <ul> <li><code>music</code></li> <li><code>movie</code></li> <li><code>podcast</code></li> <li><code>audiobook</code></li> <li><code>tvshow</code></li> </ul> <p>Multiple expressions can be anded or ored together, using the keywords <code>OR</code> and <code>AND</code>. The unary not operator is also supported using the keyword <code>NOT</code>.</p> <p>It is possible to define the sort order and limit the number of items by adding an order clause and/or a limit clause after the last expression:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-2-1 name=__codelineno-2-1 href=#__codelineno-2-1></a>"Playlist Name" { expression ORDER BY field-name sort-direction LIMIT limit }
|
|
</code></pre></div> <p>"sort-direction" is either <code>ASC</code> (ascending) or <code>DESC</code> (descending). "limit" is the maximum number of items.</p> <p>There is additionally a special <code>random</code> <em>field-name</em> that can be used in conjunction with <code>limit</code> to select a random number of items based on current expression.</p> <h2 id=examples>Examples<a class=headerlink href=#examples title="Permanent link">¶</a></h2> <div class=highlight><pre><span></span><code><a id=__codelineno-3-1 name=__codelineno-3-1 href=#__codelineno-3-1></a>"techno" {
|
|
<a id=__codelineno-3-2 name=__codelineno-3-2 href=#__codelineno-3-2></a> genre includes "techno"
|
|
<a id=__codelineno-3-3 name=__codelineno-3-3 href=#__codelineno-3-3></a> and artist includes "zombie"
|
|
<a id=__codelineno-3-4 name=__codelineno-3-4 href=#__codelineno-3-4></a>}
|
|
</code></pre></div> <p>This would match songs by "Rob Zombie" or "White Zombie", as well as those with a genre of "Techno-Industrial" or "Trance/Techno", for example.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-4-1 name=__codelineno-4-1 href=#__codelineno-4-1></a>"techno 2015" {
|
|
<a id=__codelineno-4-2 name=__codelineno-4-2 href=#__codelineno-4-2></a> genre includes "techno"
|
|
<a id=__codelineno-4-3 name=__codelineno-4-3 href=#__codelineno-4-3></a> and artist includes "zombie"
|
|
<a id=__codelineno-4-4 name=__codelineno-4-4 href=#__codelineno-4-4></a> and not genre includes "industrial"
|
|
<a id=__codelineno-4-5 name=__codelineno-4-5 href=#__codelineno-4-5></a>}
|
|
</code></pre></div> <p>This would exclude e. g. songs with the genre "Techno-Industrial".</p> <div class=highlight><pre><span></span><code><a id=__codelineno-5-1 name=__codelineno-5-1 href=#__codelineno-5-1></a>"Local music" {
|
|
<a id=__codelineno-5-2 name=__codelineno-5-2 href=#__codelineno-5-2></a> data_kind is file
|
|
<a id=__codelineno-5-3 name=__codelineno-5-3 href=#__codelineno-5-3></a> and media_kind is music
|
|
<a id=__codelineno-5-4 name=__codelineno-5-4 href=#__codelineno-5-4></a>}
|
|
</code></pre></div> <p>This would match all songs added as files to the library that are not placed under the folders for podcasts, audiobooks.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-6-1 name=__codelineno-6-1 href=#__codelineno-6-1></a>"Unplayed podcasts and audiobooks" {
|
|
<a id=__codelineno-6-2 name=__codelineno-6-2 href=#__codelineno-6-2></a> play_count = 0
|
|
<a id=__codelineno-6-3 name=__codelineno-6-3 href=#__codelineno-6-3></a> and (media_kind is podcast or media_kind is audiobook)
|
|
<a id=__codelineno-6-4 name=__codelineno-6-4 href=#__codelineno-6-4></a>}
|
|
</code></pre></div> <p>This would match any podcast and audiobook file that was never played.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-7-1 name=__codelineno-7-1 href=#__codelineno-7-1></a>"Recently added music" {
|
|
<a id=__codelineno-7-2 name=__codelineno-7-2 href=#__codelineno-7-2></a> media_kind is music
|
|
<a id=__codelineno-7-3 name=__codelineno-7-3 href=#__codelineno-7-3></a> order by time_added desc
|
|
<a id=__codelineno-7-4 name=__codelineno-7-4 href=#__codelineno-7-4></a> limit 10
|
|
<a id=__codelineno-7-5 name=__codelineno-7-5 href=#__codelineno-7-5></a>}
|
|
</code></pre></div> <p>This would match the last 10 music files added to the library.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-8-1 name=__codelineno-8-1 href=#__codelineno-8-1></a>"Random 10 Rated Pop songs" {
|
|
<a id=__codelineno-8-2 name=__codelineno-8-2 href=#__codelineno-8-2></a> rating > 0 and
|
|
<a id=__codelineno-8-3 name=__codelineno-8-3 href=#__codelineno-8-3></a> genre is "Pop" and
|
|
<a id=__codelineno-8-4 name=__codelineno-8-4 href=#__codelineno-8-4></a> media_kind is music
|
|
<a id=__codelineno-8-5 name=__codelineno-8-5 href=#__codelineno-8-5></a> order by random desc
|
|
<a id=__codelineno-8-6 name=__codelineno-8-6 href=#__codelineno-8-6></a> limit 10
|
|
<a id=__codelineno-8-7 name=__codelineno-8-7 href=#__codelineno-8-7></a>}
|
|
</code></pre></div> <p>This generates a random set of, maximum of 10, rated Pop music tracks every time the playlist is queried.</p> <h2 id=date-operand-syntax>Date Operand Syntax<a class=headerlink href=#date-operand-syntax title="Permanent link">¶</a></h2> <p>One example of a valid date is a date in yyyy-mm-dd format:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-9-1 name=__codelineno-9-1 href=#__codelineno-9-1></a>"Files added after January 1, 2004" {
|
|
<a id=__codelineno-9-2 name=__codelineno-9-2 href=#__codelineno-9-2></a> time_added after 2004-01-01
|
|
<a id=__codelineno-9-3 name=__codelineno-9-3 href=#__codelineno-9-3></a>}
|
|
</code></pre></div> <p>There are also some special date keywords:</p> <ul> <li><code>today</code>, <code>yesterday</code>, <code>this week</code>, <code>last week</code>, <code>last month</code>, <code>last year</code></li> </ul> <p>These dates refer to the <em>start</em> of that period; <code>today</code> means 00:00hrs of today, <code>this week</code> means current Monday 00:00hrs, <code>last week</code> means the previous Monday 00:00hrs, <code>last month</code> is the first day of the previous month at 00:00hrs etc.</p> <p>A valid date can also be made by applying an interval to a date. Intervals can be defined as <code>days</code>, <code>weeks</code>, <code>months</code>, <code>years</code>. As an example, a valid date might be:</p> <p><code>3 weeks before today</code> or <code>3 weeks ago</code></p> <p>Examples:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-10-1 name=__codelineno-10-1 href=#__codelineno-10-1></a>"Recently Added" {
|
|
<a id=__codelineno-10-2 name=__codelineno-10-2 href=#__codelineno-10-2></a> time_added after 2 weeks ago
|
|
<a id=__codelineno-10-3 name=__codelineno-10-3 href=#__codelineno-10-3></a>}
|
|
</code></pre></div> <p>This matches all songs added in the last 2 weeks.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-11-1 name=__codelineno-11-1 href=#__codelineno-11-1></a>"Recently played audiobooks" {
|
|
<a id=__codelineno-11-2 name=__codelineno-11-2 href=#__codelineno-11-2></a> time_played after last week
|
|
<a id=__codelineno-11-3 name=__codelineno-11-3 href=#__codelineno-11-3></a> and media_kind is audiobook
|
|
<a id=__codelineno-11-4 name=__codelineno-11-4 href=#__codelineno-11-4></a>}
|
|
</code></pre></div> <p>This matches all audiobooks played since the start of the last Monday 00:00AM.</p> <p>All dates, except for <code>YYYY-DD-HH</code>, are relative to the day of when the server evaluates the smartpl query; <code>time_added after today</code> run on a Monday would match against items added since Monday 00:00hrs and evaluating the same smartpl on Friday would only match against added on Friday 00:00hrs.</p> <p>Note that <code>time_added after 4 weeks ago</code> and <code>time_added after last month</code> are subtly different; the former is exactly 4 weeks ago (from today) whereas the latter is the first day of the previous month.</p> <h2 id=differences-with-mt-daapd-smart-playlists>Differences with MT-daapd Smart Playlists<a class=headerlink href=#differences-with-mt-daapd-smart-playlists title="Permanent link">¶</a></h2> <p>The syntax is really close to the mt-daapd smart playlist syntax (see <a href=https://sourceforge.net/p/mt-daapd/code/HEAD/tree/tags/release-0.2.4.2/contrib/mt-daapd.playlist>Multi-Threaded DAAP Daemon Code</a>.</p> <p>Even this documentation is based on the document linked above.</p> <p>Some differences are:</p> <ul> <li>only one smart playlist per file</li> <li>the not operator must be placed before an expression and not before the operator</li> <li><code>||</code>, <code>&&</code>, <code>!</code> are not supported (use <code>or</code>, <code>and</code>, <code>not</code>)</li> <li>comments are not supported</li> </ul> </article> </div> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> <div class=md-social> <a href=https://github.com/owntone/owntone-server target=_blank rel=noopener title=github.com class=md-social__link> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 496 512"><!-- Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg> </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "..", "features": ["navigation.tabs", "navigation.top"], "search": "../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script> <script src=../assets/javascripts/bundle.88dd0f4e.min.js></script> <script src=../assets/extra.js></script> </body> </html> |