Skip to content

CLI commands

AF-1 edited this page Dec 29, 2024 · 10 revisions

Note: If you have disabled specific dynamic playlists in the DPL plugin settings, you can still access them via CLI commands.

DPL offers a couple of CLI commands:

  • PLAY will (re)start the dynamic playlist with the provided ID on your player (client).

    CLIENT_ID dynamicplaylist playlist play DYNAMICPLAYLIST_ID
    
  • ADD will only add tracks from the dynamic playlist with the provided ID to your player (client).

    CLIENT_ID dynamicplaylist playlist add DYNAMICPLAYLIST_ID
    
  • CONTINUE will continue the dynamic playlist with the provided ID on your player (client) at the current playlist position.

    CLIENT_ID dynamicplaylist playlist continue DYNAMICPLAYLIST_ID
    
  • STOP will stop adding tracks from the dynamic playlist with the provided ID to your player (client). Though it's probably faster/easier to stop DPL by simply clearing the playlist on that player.

    CLIENT_ID dynamicplaylist playlist stop DYNAMICPLAYLIST_ID
    

The CLIENT_ID is your player's MAC address. It's listed on the LMS Settings > Player > Basic Settings page.

Dynamic Playlist ID

The DYNAMICPLAYLIST_ID is basically a prefix (for the source of the dynamic playlist) followed by a unique identifier for the dynamic playlist.

  • built-in dynamic playlists (that come with the plugin):
    • prefix: dpldefault_
    • identifier: the lower-case filename of the dynamic playlist, with the sql file extension, spaces and certain special characters removed.

  • user-provided/custom dynamic playlists (for manually created and added dynamic playlist sql files):
    • prefix: dplusercustom_
    • identifier: the lower-case filename of the dynamic playlist, with the sql file extension, spaces and certain special characters removed.

  • dynamic playlists created with the Dynamic Playlist Creator plugin:
    • prefix: dplccustom_
    • identifier: the lower-case filename of the dynamic playlist, with the sql file extension, spaces and certain special characters removed.

  • static playlists:
    • prefix: dplstaticpl_
    • identifier: the SHA1 digest of the playlist url as a base64 encoded string.
      Example:
      Playlist url/path from the LMS database: file:///Users/af1/Music/LMS%20Playlists/Bookmarked%20Tracks.m3u
      SHA1 digest of the playlist url as a base64 encoded string: jor13XtXjcbmjwFHTwGGp8xPK1k
      Dynamic playlist id for CLI commands: dplstaticpl_jor13XtXjcbmjwFHTwGGp8xPK1k
      

💡 A simple way to determine the ID of your dynamic playlist:
If you move the mouse pointer over the Play button ▶️ next to a dynamic playlist in LMS home menu > Dynamic Playlists (use Default skin or Logic Teal skin), you will see a link that contains the the dynamic playlist id (usually in the p3 parameter).


Example 1:
If you have a player with the MAC address 00:af:53:be:82:11 and have created a custom dynamic playlist with the filename "my_genre_mix_1.sql" the CLI command to start this playlist would look like this:

00:af:53:be:82:11 dynamicplaylist playlist play dplusercustom_my_genre_mix_1

Example 2:
If you're using the KidsPlay plugin you can start dynamic playlists of your choice by creating macros for preset buttons of devices like Boom or SB Radio.

If you wanted to start the dynamic playlist from Example 1 by pressing preset button 1 on a Boom it'd look something like this:

power 1; stop; show "line1:Random" "line2:Genre Mix 1" duration:3 centered:1; dynamicplaylist playlist play dplusercustom_my_genre_mix_1;



Dynamic playlists that require (user) input

If you want to start a dynamic playlist that requires user input (e.g. genre, min. track rating), you will have to include values for all user input parameters in your CLI command.

CLIENT_ID dynamicplaylist playlist play DYNAMICPLAYLIST_ID dynamicplaylist_parameter_1:{values} dynamicplaylist_parameter_2:{values}

Example: Your dynamic playlist called mycustomplaylistname has 2 playlist parameters:

-- PlaylistParameter1:multiplegenres:Select genres:
-- PlaylistParameter2:list:Select min. rating Songs:0:unrated,10:0.5 stars,20:1 star,30:1.5 stars,40:2 stars,50:2.5 stars,60:3 stars,70:3.5 stars,80:4 stars,90:4.5 stars,100:5 stars

Let's say you want to play tracks from three genres with a minium track rating of 1.5 stars on a player with the client ID 00:af:53:be:82:11.
Your CLI command would look like this:

00:af:53:be:82:11 dynamicplaylist playlist play dplusercustom_mycustomplaylistname dynamicplaylist_parameter_1:158,163,171 dynamicplaylist_parameter_2:30

Your command includes three LMS database genre IDs (158,163,171) for the first required parameter dynamicplaylist_parameter_1 and the min. track rating value (30) for the second required parameter dynamicplaylist_parameter_2.

⚠️ Please note: user input requests for volatile parameters like artist, album, genre, multiplegenres, playlist and multiplestaticplaylists always use the LMS database IDs - which may change after a rescan. If you always use the same parameter values (e.g. the same genres), it's better to include the values (e.g. genre names) directly in the SQLite statement.

❗️ If you don't include parameter values in your CLI command for dynamic playlists that require them, they won't start. You can temporarily raise the debug level of the Dynamic Playlists plugin to Warn or Info to get warnings in the server log if you wish so.

Clone this wiki locally