Compare commits
No commits in common. "81184c23a7894273f4efd5c0b8137b3d9a30f35c" and "3f1a1e1a78eea005b454badab1f9c7ac9fb12525" have entirely different histories.
81184c23a7
...
3f1a1e1a78
3 changed files with 2 additions and 27 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue