Compare commits
No commits in common. "main" and "v0.4.0.0" have entirely different histories.
5 changed files with 76 additions and 61 deletions
|
@ -171,8 +171,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
|
|||
_logger.LogDebug("- {0}", asm);
|
||||
}
|
||||
var i = 0;
|
||||
var all_playlists = await _store.GetAllSmartPlaylistsAsync();
|
||||
foreach (SmartPlaylistDto dto in all_playlists) {
|
||||
foreach (SmartPlaylistDto dto in await _store.GetAllSmartPlaylistsAsync()) {
|
||||
if (!dto.Enabled) {
|
||||
i += 1;
|
||||
continue;
|
||||
|
@ -212,7 +211,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks {
|
|||
await _playlistManager.AddItemToPlaylistAsync(playlist.Id, insertItems, playlistLink.UserId);
|
||||
}
|
||||
i += 1;
|
||||
progress.Report(100 * ((double)i)/all_playlists.Count());
|
||||
progress.Report(100 * ((double)i)/dto.Playlists.Count());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,18 +71,17 @@
|
|||
const editEnabled = document.querySelector('#SmartplaylistEditEnabled');
|
||||
if (id === null) {
|
||||
selection.selectedIndex = 0;
|
||||
editName.value = 'My New Smartplaylist';
|
||||
editProgram.value = '(is-favourite)';
|
||||
editSortProgram.value = '(begin *items*)';
|
||||
editName.value = '';
|
||||
editProgram.value = '';
|
||||
editSortProgram.value = '';
|
||||
editUsers.innerHTML = '';
|
||||
for (const u of config.Users) {
|
||||
var o = document.createElement('option');
|
||||
o.value = u[0];
|
||||
o.innerHTML = u[1];
|
||||
o.setAttribute('selected', 'selected');
|
||||
editUsers.appendChild(o);
|
||||
}
|
||||
editEnabled.checked = true;
|
||||
editEnabled.checked = false;
|
||||
return;
|
||||
}
|
||||
function matchId(p) {
|
||||
|
|
71
README.md
71
README.md
|
@ -10,13 +10,70 @@ The latest version is [v0.4.0.0](https://gitea.redxef.at/redxef/jellyfin-smart-p
|
|||
## How to use
|
||||
|
||||
After [installing](#installation) the plugin and restarting Jellyfin
|
||||
go to the plugin settings and below the `Initial Program` configuration
|
||||
choose the smart playlist you want to edit, or `Create new playlist ...`
|
||||
to create a new one.
|
||||
create a empty file in `config/data/smartplaylists` like this, maybe
|
||||
you want to generate a playlist of your favourite rock songs:
|
||||
|
||||
[Go here](examples.md) to see some example configurations.
|
||||
```
|
||||
$ touch config/data/smartplaylists/Rock.yaml
|
||||
```
|
||||
|
||||
Below are all the configuration values for a smart playlist.
|
||||
Afterwards run the Task `(re)generate Smart Playlists`, this will rename
|
||||
the `yaml` file and populate it with some default values. You can now
|
||||
adjust the file to your liking. [Go here](examples.md) to see more
|
||||
examples.
|
||||
|
||||
```yaml
|
||||
Id: Rock
|
||||
Playlists:
|
||||
- PlaylistId: 24f12e1e-3278-d6d6-0ca4-066e93296c95
|
||||
UserId: 6eec632a-ff0d-4d09-aad0-bf9e90b14bc6
|
||||
Name: Rock
|
||||
Program: (begin (invoke item "IsFavoriteOrLiked" (list *user*)))
|
||||
SortProgram: (begin items)
|
||||
Filename: /config/data/smartplaylists/Rock.yaml
|
||||
Enabled: true
|
||||
```
|
||||
|
||||
This is the default configuration and will always match all your
|
||||
favorite songs (and songs which are in favourited albums).
|
||||
|
||||
To change the filter you can append a `|` (pipe) to the Program
|
||||
line and write multiline filters like this:
|
||||
|
||||
```yaml
|
||||
Porgram: |
|
||||
(begin
|
||||
(invoke item "IsFavoriteOrLiked" (list *user*)))
|
||||
```
|
||||
|
||||
This is equivalent to the above example (not counting the other
|
||||
fields obviously).
|
||||
|
||||
|
||||
### Id
|
||||
|
||||
Arbitrary Id assigned to this playlist, can usually be left alone.
|
||||
|
||||
### Playlists
|
||||
|
||||
A list of Playlist/User mappings. By default all users get an entry.
|
||||
|
||||
The ids must have the dashes in them as of now. To convert a id
|
||||
from without dashes to the canonical form run this command:
|
||||
|
||||
`echo '<your id here>' | python3 -c 'import uuid; import sys; print(uuid.UUID(sys.stdin.read().strip()))'`
|
||||
|
||||
To get your user id navigate to your user profile and copy the part
|
||||
after `userId` in the address bar.
|
||||
|
||||
#### PlaylistId
|
||||
|
||||
The id of the playlist that should be managed, must be owned by the
|
||||
corresponding user.
|
||||
|
||||
#### UserId
|
||||
|
||||
The user associated with this playlist.
|
||||
|
||||
### Name
|
||||
|
||||
|
@ -64,6 +121,10 @@ the items by name you could use the following program:
|
|||
*items*)
|
||||
```
|
||||
|
||||
### Filename
|
||||
|
||||
The path to this file, only used internally and updated by the program.
|
||||
|
||||
### Enabled
|
||||
|
||||
Enable this playlist, currently ignored.
|
||||
|
|
|
@ -10,20 +10,20 @@ resources:
|
|||
- name: source
|
||||
type: git
|
||||
source:
|
||||
uri: https://git.redxef.at/redxef/jellyfin-smart-playlist
|
||||
uri: https://gitea.redxef.at/redxef/jellyfin-smart-playlist
|
||||
branch: main
|
||||
fetch_tags: true
|
||||
tag_regex: 'v.*'
|
||||
- name: manifest
|
||||
type: git
|
||||
source:
|
||||
uri: ssh://git@git.redxef.at:8022/redxef/jellyfin-smart-playlist.git
|
||||
uri: ssh://git@gitea.redxef.at:8022/redxef/jellyfin-smart-playlist.git
|
||||
branch: manifest
|
||||
private_key: ((gitea.id_ed25519))
|
||||
- name: releases
|
||||
type: http-resource
|
||||
source:
|
||||
url: https://git.redxef.at/api/v1/repos/redxef/jellyfin-smart-playlist/releases
|
||||
url: https://gitea.redxef.at/api/v1/repos/redxef/jellyfin-smart-playlist/releases
|
||||
method: get
|
||||
auth:
|
||||
basic:
|
||||
|
@ -32,7 +32,7 @@ resources:
|
|||
- name: artifact
|
||||
type: http-resource
|
||||
source:
|
||||
url: https://git.redxef.at/api/v1/repos/redxef/jellyfin-smart-playlist/releases/((.:release_id))/assets
|
||||
url: https://gitea.redxef.at/api/v1/repos/redxef/jellyfin-smart-playlist/releases/((.:release_id))/assets
|
||||
method: get
|
||||
auth:
|
||||
basic:
|
||||
|
|
44
examples.md
44
examples.md
|
@ -53,47 +53,3 @@
|
|||
(t (string= (car (getitems parent "Name")) "Seeed"))))
|
||||
|
||||
```
|
||||
|
||||
- `Artists`: A playlist including everything from a list of artists.
|
||||
```
|
||||
Id: Artists
|
||||
Name: Artists
|
||||
Program: >-
|
||||
(begin
|
||||
(define *include-artists* '(
|
||||
"seeed"
|
||||
"juli"
|
||||
"falco"
|
||||
"peter fox"
|
||||
"alligatoah"
|
||||
"kraftklub"
|
||||
"wanda"
|
||||
"annennaykantereit"
|
||||
"feine sahne fischfilet"
|
||||
"madsen"
|
||||
"wiener blond"
|
||||
"die toten hosen"
|
||||
"die ärzte"
|
||||
"wir sind helden"
|
||||
))
|
||||
(define my-prefilter-only-tracks
|
||||
(lambda nil
|
||||
(and
|
||||
(is-type "Audio")
|
||||
(not (name-contains "live"))
|
||||
(not (name-contains "acoustic"))
|
||||
(not (name-contains "instrumental"))
|
||||
(not (name-contains "remix")))))
|
||||
(and
|
||||
(my-prefilter-only-tracks)
|
||||
(is-favourite)
|
||||
(any
|
||||
(lambda
|
||||
(i)
|
||||
;; the `(and (find-artist)` is here to prevent null violations.
|
||||
(and (find-artist) (string= i (lower (get-name (find-artist))))))
|
||||
*include-artists*)))
|
||||
SortProgram: (begin (shuf *items*))
|
||||
Filename: /config/data/smartplaylists/German.yaml
|
||||
Enabled: true
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue