diff --git a/Jellyfin.Plugin.SmartPlaylist/Lisp/Interpreter.cs b/Jellyfin.Plugin.SmartPlaylist/Lisp/Interpreter.cs index 495c46a..371fbbd 100644 --- a/Jellyfin.Plugin.SmartPlaylist/Lisp/Interpreter.cs +++ b/Jellyfin.Plugin.SmartPlaylist/Lisp/Interpreter.cs @@ -182,13 +182,21 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp { private static Expression _invoke(IEnumerable args) { Object o = (Object) args.First(); String s = (String) args.Skip(1).First(); - Cons l = (Cons) args.Skip(2).First(); + IEnumerable l; + if (args.Skip(2).First() is Boolean lb && lb == Boolean.FALSE) { + l = new List(); + } else if (args.Skip(2).First() is Cons lc) { + l = lc.ToList(); + } else { + throw new ApplicationException($"Expected a list of arguments, got {args.Skip(2).First()}"); + } + IList r = new List(); MethodInfo? mi = o.Value().GetType().GetMethod(s.Value()); if (mi == null) { throw new ApplicationException($"{o.Value()} has not method {s.Value()}"); } - object?[]? l_ = l.ToList().Select(x => { + object?[]? l_ = l.Select(x => { switch (x) { case Integer s: return s.Value();