Skip to content

CLI commands

AF-1 edited this page Jun 14, 2024 · 4 revisions

DPL built-in and user-provided/custom dynamic playlists

If you have disabled/hidden some dynamic playlists in the plugin settings, you can still access them via CLI commands.

DPL offers a couple of CLI commands:

  • CLIENT_ID dynamicplaylist playlist play DYNAMICPLAYLIST_ID
    will (re)start the dynamic playlist with the provided ID on your player (client).

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

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

  • CLIENT_ID dynamicplaylist playlist stop DYNAMICPLAYLIST_ID
    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.

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

The DYNAMICPLAYLIST_ID is basically a prefix followed by the filename of the dynamic playlist (without the sql file extension, spaces or special characters).
Built-in dynamic playlists use the prefix dpldefault_ and user-provided/custom dynamic playlists start with the dplusercustom_ prefix.
💡 As an alternative you could hover over the Play ▶️ button next to a dynamic playlist in the DPL home menu (web UI) to show the link that contains the dynamicplaylist_id (usually in parameter p3).

Example 1:
If you have a player with the MAC address 00:af:53:be:82:11 and 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 at the end of your CLI commands.

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 reacan. 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.



Dynamic playlists provided by other plugins

Usually those plugins have their own prefixes (e.g. dplccustom_ for dynamic playlists created with the Dynamic Playlist Creator plugin). You'll just have to find out the correct dynamicplaylist_id to use with your CLI command.
In this case the fastest way is to hover over the Play button next to a dynamic playlist in the DPL home menu (web UI) to show the link that contains the playlist's dynamicplaylist_id (usually in parameter p3).