feat: program matches item if result != nil.

This commit is contained in:
redxef 2024-10-26 23:57:02 +02:00
parent f37f825c53
commit 51e300bdc1
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -110,14 +110,10 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
executor.environment.Set("item", new Lisp_Object(i)); executor.environment.Set("item", new Lisp_Object(i));
var r = executor.eval(expression); var r = executor.eval(expression);
_logger.LogTrace("Item {0} evaluated to {1}", i, r.ToString()); _logger.LogTrace("Item {0} evaluated to {1}", i, r.ToString());
if (r is Lisp_Boolean r_bool) { if ((r is not Lisp_Boolean r_bool) || (r_bool.value)) {
if (r_bool.value) {
_logger.LogDebug("Added '{0}' to Smart Playlist {1}", i, smartPlaylist.Name); _logger.LogDebug("Added '{0}' to Smart Playlist {1}", i, smartPlaylist.Name);
results.Add(i.Id); results.Add(i.Id);
} }
} else {
_logger.LogInformation("Program did not return a boolean, returned {0}", r.ToString());
}
} }
return results; return results;
} }