Compare commits

..

3 commits

5 changed files with 37 additions and 12 deletions

View file

@ -41,8 +41,8 @@ namespace Jellyfin.Plugin.SmartPlaylist {
[Serializable] [Serializable]
public class SmartPlaylistDto : ISerializable { public class SmartPlaylistDto : ISerializable {
private static string DEFAULT_PROGRAM = "(begin (invoke item \"IsFavoriteOrLiked\" (list user)))"; private static string DEFAULT_PROGRAM = "(begin (invoke item \"IsFavoriteOrLiked\" (list *user*)))";
private static string DEFAULT_SORT_PROGRAM = "(begin items)"; private static string DEFAULT_SORT_PROGRAM = "(begin *items*)";
public SmartPlaylistId Id { get; set; } public SmartPlaylistId Id { get; set; }
public SmartPlaylistLinkDto[] Playlists { get; set; } public SmartPlaylistLinkDto[] Playlists { get; set; }
public string Name { get; set; } public string Name { get; set; }

View file

@ -1,6 +1,6 @@
name: Smart Playlist name: Smart Playlist
guid: dd2326e3-4d3e-4bfc-80e6-28502c1131df guid: dd2326e3-4d3e-4bfc-80e6-28502c1131df
version: 0.3.0.0 version: 0.4.0.0
targetAbi: 10.10.3.0 targetAbi: 10.10.3.0
framework: net8.0 framework: net8.0
owner: redxef owner: redxef
@ -14,6 +14,31 @@ artifacts:
- jellyfin-smart-playlist.dll - jellyfin-smart-playlist.dll
- YamlDotNet.dll - YamlDotNet.dll
changelog: | changelog: |
## v0.4.0.0
- Add a basic UI to configure the playlists.
- It's now possible to print log messages to the jellyfin log by calling `logd`, `logi`, `logw` or `loge`
for the respective levels `debug`, `info`, `warning` or `error`.
- Allow calling generic methods via `(invoke-generic object methodname args list-of-types)`.
- Add quoting via single quote: `'`.
- Add special case for `(quote <form>)` to be rendered as `'<form>`.
- It is now possible to include comments in the source via a semicolon (`;`).
- Respect the `Enabled` flag and only process the playlists that are enabled.
- New methods have been added: `rand`, `shuf`.
- Add `find-artist`, `get-name` and `find-parent` default definitions.
- Update YamlDotNet to v16.2.1.
**Breaking changes**:
- Rename global environment variables to be enclosed by `*`.
**Fixes**:
- The initialization of the executor now contains the same default definitions for the SortProgram and the normal Program.
- The progress report now considers the SmartPlaylists and not the individual playlists per user.
- It is now possible to pass builtins as arguments. Previously to get `(qsort > (list 1 2 3))` one had to write
something like this: `(qsort (lambda (a b) (> a b)) (list 1 2 3))`.
- A program no longer has to be a list, `t` is a valid program.
- Fix list parsing in cases where a space was before the closing parenthesis.
## v0.3.0.0 ## v0.3.0.0
- Add a second program (`SortProgram`) which is run after the filtering, this - Add a second program (`SortProgram`) which is run after the filtering, this
program should return the list of items, but in the order in which they should appear in program should return the list of items, but in the order in which they should appear in

View file

@ -5,7 +5,7 @@
<RootNamespace>Jellyfin.Plugin.SmartPlaylist</RootNamespace> <RootNamespace>Jellyfin.Plugin.SmartPlaylist</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Version>0.3.0.0</Version> <Version>0.4.0.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -5,7 +5,7 @@ Smart playlists with Lisp filter engine.
This readme contains instructions for the most recent changes in This readme contains instructions for the most recent changes in
the development branch (`main`). To view the file appropriate the development branch (`main`). To view the file appropriate
for your version select the tag corresponding to your version. for your version select the tag corresponding to your version.
The latest version is [v0.3.0.0](https://gitea.redxef.at/redxef/jellyfin-smart-playlist/src/tag/v0.3.0.0). The latest version is [v0.4.0.0](https://gitea.redxef.at/redxef/jellyfin-smart-playlist/src/tag/v0.4.0.0).
## How to use ## How to use
@ -28,7 +28,7 @@ Playlists:
- PlaylistId: 24f12e1e-3278-d6d6-0ca4-066e93296c95 - PlaylistId: 24f12e1e-3278-d6d6-0ca4-066e93296c95
UserId: 6eec632a-ff0d-4d09-aad0-bf9e90b14bc6 UserId: 6eec632a-ff0d-4d09-aad0-bf9e90b14bc6
Name: Rock Name: Rock
Program: (begin (invoke item "IsFavoriteOrLiked" (user))) Program: (begin (invoke item "IsFavoriteOrLiked" (list *user*)))
SortProgram: (begin items) SortProgram: (begin items)
Filename: /config/data/smartplaylists/Rock.yaml Filename: /config/data/smartplaylists/Rock.yaml
Enabled: true Enabled: true
@ -43,7 +43,7 @@ line and write multiline filters like this:
```yaml ```yaml
Porgram: | Porgram: |
(begin (begin
(invoke item "IsFavoriteOrLiked" (list user))) (invoke item "IsFavoriteOrLiked" (list *user*)))
``` ```
This is equivalent to the above example (not counting the other This is equivalent to the above example (not counting the other
@ -85,7 +85,7 @@ still work and remember the correct playlist.
A lisp program to decide on a per item basis if it should be included in A lisp program to decide on a per item basis if it should be included in
the playlist, return `nil` to not include items, return any other value the playlist, return `nil` to not include items, return any other value
to include them. Global variables `user` and `item` are predefined to include them. Global variables `*user*` and `*item*` are predefined
and contain a [User](https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Data/Entities/User.cs) and and contain a [User](https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Data/Entities/User.cs) and
[BaseItem](https://github.com/jellyfin/jellyfin/blob/master/MediaBrowser.Controller/Entities/BaseItem.cs) [BaseItem](https://github.com/jellyfin/jellyfin/blob/master/MediaBrowser.Controller/Entities/BaseItem.cs)
respectively. respectively.
@ -107,8 +107,8 @@ to: `(is-favourite)`.
### SortProgram ### SortProgram
This works exactly like [Program](#program), but the input is the This works exactly like [Program](#program), but the input is the
user and a list of items (`items`) matched by [Program](#program). user and a list of items (`*items*`) matched by [Program](#program).
The default is `(begin items)`, which doesn't sort at all. To sort The default is `(begin *items*)`, which doesn't sort at all. To sort
the items by name you could use the following program: the items by name you could use the following program:
```lisp ```lisp
@ -118,7 +118,7 @@ the items by name you could use the following program:
(string> (string>
(car (getitems a "Name")) (car (getitems a "Name"))
(car (getitems b "Name")))) (car (getitems b "Name"))))
items) *items*)
``` ```
### Filename ### Filename

View file

@ -35,7 +35,7 @@
Program: | Program: |
(let (let
(parent (parent
(invoke-generic item "FindParent" nil (list "MediaBrowser.Controller.Entities.Audio.MusicArtist, MediaBrowser.Controller"))) (invoke-generic *item* "FindParent" nil (list "MediaBrowser.Controller.Entities.Audio.MusicArtist, MediaBrowser.Controller")))
(cond (cond
((null parent) nil) ((null parent) nil)
(t (string= (car (getitems parent "Name")) "Haller")))) (t (string= (car (getitems parent "Name")) "Haller"))))