docs: update docs to use new global variables.

This commit is contained in:
redxef 2024-12-22 18:44:43 +01:00
parent c5c2b86557
commit dc5435fa68
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921
2 changed files with 7 additions and 7 deletions

View file

@ -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"))))