Skip to content

Smart Playlists #1417

Description

@deluan

Smart playlists can be created as a json object into a file with .nsp extension and Navidrome will create a dynamic/query based playlist and keep it updated. These .nsp files will be imported the same way as normal playlists, i.e. at scan time. See comment below for a complete list of fields and operators available.

Some examples:

  • Recently Played:
{
  "name": "Recently Played",
  "comment": "Recently played tracks",
  "all": [
    {"inTheLast": {"lastPlayed": 30}}
  ],
  "sort": "lastPlayed",
  "order": "desc",
  "limit": 100
}
  • 80's Top Songs
{
  "all": [
    { "any": [
      {"is": {"loved": true}},
      {"gt": {"rating": 3}}
    ]},
    {"inTheRange": {"year": [1981, 1990]}}
  ],
  "sort": "year",
  "order": "desc",
  "limit": 25
}
  • Favourites
{
  "all": [
    {"is": {"loved": true}}
  ],
  "sort": "dateLoved",
  "order": "desc",
  "limit": 500
}
  • All songs in random order (not recommended for large libraries)
{
  "all": [
    {"gt": {"playCount":-1}}
  ],
  "sort": "random"
}

TODO

  • PHASE 1 - On demand

    • Add rules to playlists table
    • Rule compiler (to SQL)
    • Calculate tracks on get
      • Cache results (for 5 secs)
    • Import smart playlists found in Music Folder (extension .NSP)
    • Handle permissions
      • Smart Playlists (tracks) are read-only
      • Cannot be shared
    • Refactor and clean up
  • PHASE 2 - Live update

    • Update fields table on smart playlist create/update
    • Live update queue: Persistent queue (SQLite3?) to store id and rules of playlist to process
    • SP queue processor: get id and rules from queue and refresh tracks based on rules
    • UpdateNotifier (in memory)
      • Group updates (10 items or 3 secs idle)
      • Add playlists to live update queue
      • Call it from Media Annotations and Scanner (when new tracks are imported)
  • PHASE 3 - UI

    • Rule editor
    • Reorganize sidebar
  • MISCELANEOUS

    • Sort by "random"
    • Album and Artist attributes
    • Add a "playlist" field - see how to use it

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions