From 4dccc928e96f054f5e5ca9c3d7103043d1595cf8 Mon Sep 17 00:00:00 2001 From: redxef Date: Sun, 27 Oct 2024 00:51:54 +0200 Subject: [PATCH] fix: enumerable objects get converted to lists now. --- Jellyfin.Plugin.SmartPlaylist/Lisp/Compiler/Parser.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Plugin.SmartPlaylist/Lisp/Compiler/Parser.cs b/Jellyfin.Plugin.SmartPlaylist/Lisp/Compiler/Parser.cs index 7dda9c4..e093266 100644 --- a/Jellyfin.Plugin.SmartPlaylist/Lisp/Compiler/Parser.cs +++ b/Jellyfin.Plugin.SmartPlaylist/Lisp/Compiler/Parser.cs @@ -211,7 +211,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler { public override string ToString() { return _value.ToString(); } - public static Atom FromBase(object o) { + public static Expression FromBase(object o) { switch (o) { case bool b: return new Boolean(b); @@ -219,6 +219,8 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler { return new Integer(i); case string s: return new String(s); + case IEnumerable e: + return new List(e.Select(x => Object.FromBase(x)).ToList()); default: return new Object(o); } @@ -267,6 +269,9 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler { public Parser(StringTokenStream tokens) { _sts = tokens; } + public Parser(string s) { + _sts = StringTokenStream.generate(s); + } public Expression parse() { Token token = _sts.Get();