Compare commits

..

No commits in common. "81184c23a7894273f4efd5c0b8137b3d9a30f35c" and "3f1a1e1a78eea005b454badab1f9c7ac9fb12525" have entirely different histories.

3 changed files with 2 additions and 27 deletions

View file

@ -113,7 +113,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
public class Builtins : Dictionary<string, Function> {
private static Dictionary<string, Type?> ResolvedTypes = new Dictionary<string, Type?>();
private static Dictionary<string, Assembly> AssemblyMapping = new Dictionary<string, Assembly>();
public Builtins() : base() {
this["atom"] = _atom;
@ -261,17 +261,12 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
}
private static Type? GetType(string name) {
if (ResolvedTypes.ContainsKey(name)) {
return ResolvedTypes[name];
}
var t = Type.GetType(
return Type.GetType(
name,
(name) => { return AppDomain.CurrentDomain.GetAssemblies().Where(z => (z.FullName != null) && z.FullName.StartsWith(name.FullName)).FirstOrDefault(); },
null,
true
);
ResolvedTypes[name] = t;
return t;
}
private static Expression _invoke_generic(IEnumerable<Expression> args) {

View file

@ -98,24 +98,6 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
List<BaseItem> results = new List<BaseItem>();
Expression expression = new Parser(StringTokenStream.generate(smartPlaylist.Program)).parse(); // parse here, so that we don't repeat the work for each item
Executor executor = new Executor(new DefaultEnvironment());
executor.builtins["logd"] = (x) => {
_logger.LogDebug(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
return Lisp_Boolean.TRUE;
};
executor.builtins["logi"] = (x) => {
_logger.LogInformation(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
return Lisp_Boolean.TRUE;
};
executor.builtins["logw"] = (x) => {
_logger.LogWarning(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
return Lisp_Boolean.TRUE;
};
executor.builtins["loge"] = (x) => {
_logger.LogError(((Lisp.String)x.First()).Value(), x.Skip(1).ToArray());
return Lisp_Boolean.TRUE;
};
executor.environment.Set("user", Lisp_Object.FromBase(user));
if (Plugin.Instance is not null) {
executor.eval(Plugin.Instance.Configuration.InitialProgram);

View file

@ -129,8 +129,6 @@ the items by name you could use the following program:
- **is-type**: matches the type of item look at
[BaseItemKind.cs](https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Data/Enums/BaseItemKind.cs)
for a list of items. The plugin has enabled support for `Audio, MusicAlbum, Playlist` (`(is-type "Audio")`)
- **log[diwe]**: write to the logger with the respective levels (`debug`, `information`, `warning`, `error`).
Takes the same arguments as `Logger.LogInformation(...)`.
### Filename