AF-1 / lms-dynamicplaylists

Dynamic Playlists - a plugin for Lyrion Music Serve. Use smart playlists (dynamic playlists) to play continuous music mixes based on your selection criteria.
GNU General Public License v3.0
17 stars 3 forks source link

Not an issue as such but a query about using static playlists #17

Closed tkgafs closed 5 months ago

tkgafs commented 5 months ago

DESCRIBE THE BUG

I have several static playlists which I like to use with the dynamic playlist plugin so that they load quickly and are shuffled each time these work well when selected through the web interface

I also use Home Assistant with scripts to send cli commands to play these scripts on different players

I have noticed that if the url for the script contains encoded characters for example %2B rather than the actual + character then not surprisingly my scripts dont play the relevant static playlist

for instance I have a playlist called dinner its static playlist id is 160365 the url in Home > Dynamic Playlists > Static Playlists is http://lms.localdomain:9000/plugins/DynamicPlaylists4/dynamicplaylist_list.html?p0=dynamicplaylist&p1=playlist&p2=play&p3=dplstaticpl_PGPBtJ1Dd6Co5RDdrt9%2F%2FJKp1d8&player=b8%3A27%3Aeb%3Ad5%3Aac%3A88 and in this case i have to replace the two %2F with // in my script so that

the ultimate cli call is CLIENT_ID dynamicplaylist playlist play dplstaticpl_PGPBtJ1Dd6Co5RDdrt9//JKp1d8

The only way I have discovered to detect the DYNAMICPLAYLIST_ID for a static playlist is by hovering the mouse over the play button

is there anyway to discover the url of the playlist via a script or be able to construct it from the static playlist id

Any advice anyone can give gratefully accepted

Although not really relevant the actual Home-Assistant script I use follows

===============================

` #

in the following array SqueezePlayLists

you must replace any URL Encoding strings by the actual characters they represent

for exampe %2b is + and %2f is /

#

the string dplstaticpl_PGPBtJ1Dd6Co5RDdrt9%2F%2FJKp1d8

has to become dplstaticpl_PGPBtJ1Dd6Co5RDdrt9//JKp1d8

# lms_dynamic_play: alias: Lms Dynamic mode: single icon: mdi:music sequence:

===========================================

A clear and concise description of what the bug is.



TO REPRODUCE

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error



EXPECTED BEHAVIOR

A clear and concise description of what you expected to happen.



LOG EXCERPT



NAME/CODE OF DYNAMIC PLAYLIST

If the issue involves a dynamic playlist, please provide the full (menu) name for built-in dynamic playlists or the SQLite code for custom dynamic playlists that you have created.



VERSION INFO

If the problem occurs with a specific web skin/controller (e.g. Material), please check whether it also occurs when using other web skins/controllers (e.g. LMS default skin).



SCREENSHOTS

If applicable, add screenshots to help explain your problem.



ADDITIONAL CONTEXT

Add any other context about the problem here.



UPLOADS

In case you want to provide larger files to illustrate the problem (e.g. your library.db, persist.db or LMS server log file), please use a service like https://wetransfer.com/ and include the download link in your bug report.

AF-1 commented 5 months ago

Hello.

The numeric value is the LMS playlist id. The other one ("dplstaticplPGPBtJ1Dd6Co5RDdrt9//JKp1d8") is the one you need for DPL CLI commands. The specific part after `dplstaticpl` is the SHA1 digest of the playlist url as a base64 encoded string. As you have discovered, this ony applies to static playlists. All other dynamic playlists use the filename to create the playlist id.

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 Your playlist id for CLI commands: dplstaticpl_jor13XtXjcbmjwFHTwGGp8xPK1k

Hope I was able to help a little.

tkgafs commented 5 months ago

Thanks for info hopefully I'll be able to do something with that, if not i will just have to do my manual edits of the scripts !! thankfully I only have 2 static playlists that were affected

tkgafs commented 5 months ago

Thanks for infoI've created a little perl script which generated the sha1 string for all the m3u files in the playlists folderI can then easily copy these across to my home assistant server where the scripts runBest wishesTimOn 7 Jun 2024 14:36, AF-1 @.***> wrote: Hello. The numeric value is the LMS playlist id. The other one ("dplstaticplPGPBtJ1Dd6Co5RDdrt9//JKp1d8") is the one you need for DPL CLI commands. The specific part after dplstaticpl is the SHA1 digest of the playlist url as a base64 encoded string. As you have discovered, this ony applies to static playlists. All other dynamic playlists use the filename to create the playlist id. 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 Your playlist id for CLI commands: dplstaticpl_jor13XtXjcbmjwFHTwGGp8xPK1k Hope I was able to help a little.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>