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

[ISSUE] DynamicPlaylist creation fails if an excluded genre contains a single quote #14

Closed TaurusI76 closed 8 months ago

TaurusI76 commented 8 months ago

Checklist

❗️ Please take a quick look at [this checklist](https://github.com/AF-1/sobras/wiki/Checklist-to-eliminate-common-causes-of-LMS-(plugin)-problems) to eliminate common causes of LMS (plugin) problems. Thank you.



DESCRIBE THE BUG

If you add a genre containing a single quote (e.g. Children's) to the list of genres to exclude (Excluded genres) in the DynamicPlaylist plugin's settings, the dynamic playlist fails to play due to a non-escaped single quote in the playlist's SQL statement.



TO REPRODUCE

Steps to reproduce the behavior:

  1. Add a song to the library that has a genre containing a single quote.
  2. Rescan library
  3. In the DynamicPlaylist plugin's settings, add the genre to the Excluded Genres list.
  4. Play a dynamic playlist (e.g. Songs - never played (APC))
  5. Playlist won't play. Instead, the main dynamic playlist selection screen is shown.



EXPECTED BEHAVIOR

The dynamic playlist will be added to the playlist and will play.



LOG EXCERPT

2024/02/29 08:53:57,stdout,"[24-02-29 08:53:57.6244] Slim::Schema::Storage::throw_exception (121) Error: DBI Exception: DBD::SQLite::db prepare failed: near \"s\": syntax error [for Statement \"select tracks.id, tracks.primary_artist from tracks left join library_track on library_track.track = tracks.id join alternativeplaycount on alternativeplaycount.urlmd5 = tracks.urlmd5 and ifnull(alternativeplaycount.playCount, 0) = 0 left join dynamicplaylist_history on dynamicplaylist_history.id = tracks.id and dynamicplaylist_history.client = '10:7b:44:93:2e:02' where tracks.audio = 1 and dynamicplaylist_history.id is null and tracks.secs >= 90 and not exists (select * from tracks t2,genre_track,genres where t2.id = tracks.id and tracks.id = genre_track.track and genre_track.genre = genres.id and genres.name in ('Non-Music','Children's','Comedy','Books & Spoken','Audiobook','Hörspiel')) and case when ('' != '' and '' is not null) then library_track.library = '' else 1 end group by tracks.id\"] "



NAME/CODE OF DYNAMIC PLAYLIST

Songs - never played (APC)



VERSION INFO

AF-1 commented 8 months ago

Thanks for letting me know. I don't have genres with single quotes so it never came up. Should be fixed in 4.3.6.

TaurusI76 commented 8 months ago

Thanks! I thought it's probably easier for you to fix it than for me to dig through the code & contribute. Thank you for fixing it!

On Thu, Feb 29, 2024 at 1:03 PM AF-1 @.***> wrote:

Thanks for letting me know. I don't have genres with single quotes so it never came up. Should be fixed in 4.3.6.

— Reply to this email directly, view it on GitHub https://github.com/AF-1/lms-dynamicplaylists/issues/14#issuecomment-1970993853, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVSMRFAZQZKIJY3ZZJGV2DYV4MKRAVCNFSM6AAAAABD7OTR5WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQHE4TGOBVGM . You are receiving this because you authored the thread.Message ID: @.***>