From 51e300bdc1d7141ac2f01f235538dee2c5adc714 Mon Sep 17 00:00:00 2001 From: redxef Date: Sat, 26 Oct 2024 23:57:02 +0200 Subject: [PATCH] feat: program matches item if result != nil. --- .../ScheduledTasks/GeneratePlaylist.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs index 8405967..d8b176a 100644 --- a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs +++ b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs @@ -110,13 +110,9 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks { executor.environment.Set("item", new Lisp_Object(i)); var r = executor.eval(expression); _logger.LogTrace("Item {0} evaluated to {1}", i, r.ToString()); - if (r is Lisp_Boolean r_bool) { - if (r_bool.value) { - _logger.LogDebug("Added '{0}' to Smart Playlist {1}", i, smartPlaylist.Name); - results.Add(i.Id); - } - } else { - _logger.LogInformation("Program did not return a boolean, returned {0}", r.ToString()); + if ((r is not Lisp_Boolean r_bool) || (r_bool.value)) { + _logger.LogDebug("Added '{0}' to Smart Playlist {1}", i, smartPlaylist.Name); + results.Add(i.Id); } } return results;