-
-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart Playlists #1417
Comments
Current list of fields available (case-insensitive):
Operators available (case-insensitive):
|
Hello, not sure if I should post this here or make a new issue. I played a bit with the NSP, and my take is that it's like an expression tree which builds SQL queries. Haven't looked at the source, yet. And indeed, the "problem" is that In effect I have only 10 songs returned without star. When in actuality I have thousands, but these have never been annotated. EDIT: I wonder if there's like some sort of left outer join or something that would still target media_files which have no annotations yet, kinda like changing that LeftJoin in |
That's fine
Yes, that's how it works, and yes, this is a "problem". I think a good approach for this is to introduce a new operator,
It is already a left join, the issue is that when there's no matching row in the annotation table, its values are all |
I actually did some experimentation and I think a better way is to wrap all fields from the left joined tables with
This will allow to use |
First off, thanks for the smart playlists.. It really opens up the possibilities for Navidrome! using the latest docker image (Navidrome Version: | 0.47.0 (8c7d95c)), trying to use dateadded and datemodified return invalid key errors. I'm attempting to make a Songs newly added and unrated playlist.. I took a cue from the random sorting post on reddit. Not sure if it would work, but it appears I can't filter on dateadded or datemodified. I'm assuming I'm doing something wrong, but just in case.... { time="2021-11-20T00:56:54Z" level=error msg="Error parsing SmartPlaylist" error="invalid expression key dateadded" playlist="Songs to Rate - Newly Added" requestId=e31872cd1409/MIUyT3LsdO-001067, |
Hey @0bmay, the issue is that the key of the rule has to be the operator, not the field. So in the snippet: {"dateadded": {"gt": "DATE('now','-90 day')"}} should be: {"gt": {"dateadded": "DATE('now','-90 day')"}} Also notice the operator {"inTheLast": {"dateadded": "90"}}, I don't even know if |
Thank you @deluan! |
Smart playlists are similar, but not the same as normal playlists in the Subsonic API - yet they are exposed via the same API endpoints. Some differences are, smart playlists are readonly, and are auto regenerated on read (I believe). For client apps to be able to give a good user experience, information about what playlists are smart (readonly, auto regenerated) and what playlists are user edited is necessary. This information does not seem to be present with the current implementation. Some points from a discord discussion on smart playlists in the context of the Subsonic API:
Suggestion for one way to add extra information to the Subsonic API:
...
So in sum, one way to deliver extra playlist information to client apps would be:
|
Would it be possible to add playlist name/id as a selector field for the smart playlists? That way you can mix playlists together without all the hassle that it is now. |
Yes, playlist import is a one-direction process unfortunately. Change the name of the m3u/nsp, and it gets re-imported as a new playlist. |
Is there any way to assign the Smart Playlists to any user (or all users)? I tried putting the following in the .nsp File. But that did not change anything. Currently my Smart Playlists appear only for the "admin" User, but not for my daily use user-account. |
Yes, this is possible in the UI. When logged in as admin, click on the icon next to the word "Playlists" on the left side menu and in this new screen you can make the playlists 'public' or edit them. |
@aewne Yes, this is planned. @MichaelBechHansen, I think a generic property instead of |
Hello, just a heads up while testing v0.47.5, it seems some of my smart playlists NSP are broken.
Which was working fine on the previous version. The issue is that the value, in the above It makes sense, the value is a number. This works as of 0.47.5
This is not a bug, just an observation. Also confirmed |
I have a "Recently Played" smart playlist:
Only tracks that I play through the web UI will show up on the list. It seems any tracks played on an external client don't get marked as "played." Is that the expected behavior? |
@RedKage thanks for reporting this. I'll check if I can keep supporting both syntaxes in future releases @gardebreak, you need to enable "Scrobbling" in your Subsonic client, see #593 |
I think the smart play list sorting by random may be broken.. I'm getting back items that are sorted by song title instead..
this returns a list of: #EXTINF:260,Corporate Avenger - $20 Bill songs that match the criteria, that all start with symbols or numbers, sorted by title. I would expect the listing to be more random. I know there were some changes to the smart lists in the latest release. Did random get broken, or is there a new way to randomize the returned data? Thank you for all the hard work on navidrome. |
Yeah, the fix to avoid possible SQL injections also closed this loophole. I just pushed a fix for |
Thanks! I run navidrome from a docker image, so I will have to wait for either a dev build or a the next release. I didn't see anything in the documentation on how to build a docker image. |
May I ask / suggest a few things? :-)
As a suggestion for the smart playlist UI I personally like the iTunes interface for this: |
Thanks for the suggestions!
That's a great suggestion, I'll see if I can implement it in a future version.
Not yet, as Navidrome currently treats all files as music. But if you put your files in different folders, you can filter by
Yes, this feature is "inspired" by iTunes' Smart Playlists. And the idea is to add an experience very similar to iTunes in the new UI. For now, you can try creating Smart Playlists using Feishin |
Ah I see. Thank you.
Ok, nice.
That's a nice workaround. Great.
After playing around a bit, I'm not sure I'll ever need a GUI. It's so easy to edit the JSON files and I'm familiar with it, so I really like this feature. The only thing I really was struggling with: JSON Parser error just skips the playlist and it is never reported in the WebUI anywhere. I would expect at least a small warning or something. I thought it did not find anything and had to open the docker logs. I opened a feature "smart-tags". This would be a perfect little addition for smart playlists and you could auto-tag a lot of scanned files with some things. Thank you for making this tool. It's just great. |
@deluan For sorting, is it possible to sort by Album, and then further sort by Date Added? I also noticed the album tracks displayed aren't sorted, I can't tell what order they're in. |
@qouesm Did you find a solution? |
As far as I understand, the query defined by a smart playlist depends on the owner's stats. I would like to define a smart playlist (e.g. Favorites of a specific genre) once and every user can use the playlist based on his/her own ratings. Currently - to the best of my understanding - I have to create such a smart playlist for each user (which obviously does not scale well... 😄). Is there anything planned with respect to this? @deluan Maybe this feature can be added to the todo list at the top? |
What is the 'title' property intended for? {
"title": "Recently Added",
"comment": "All tracks above 3 stars.",
"all": [{
"inTheLast": {
"dateadded": "90"
}
}],
"sort": "dateadded",
"order": "asc",
"limit": 25
} When using the title property like this, the title of the playlist for me is not updated. Is title not meant to be able to change the playlist title? (don't worry that the comment is unrelated it's just there as a placeholder). |
It may be later added, but as of now the title of the file is the title taken in my experience. |
@tbleiker Yes, this is planned when we get the Smart Playlist UI in place
Actually they are, see the first example in the description of the issue. Title is actually |
okie! :) weird, the comment one seemed to work; maybe I forgot and did it a different way 🤔 |
Is there a way to add comments to the NSP files? Like |
I don't see that this could be possible. JSON is a specified format that does not support comments in general. The way you tried is the only possible way (adding custom props) to do something LIKE comments and if this leads to an error, I don't think it's possible. I personally use JavaScript-Files to store my playlists with comments and do copy and paste if I refresh them. |
The next best thing I can think of would be to have a text file adjacent to the playlist, e.g. |
it could be if nsp was made to be jsonc instead of json |
Thanks for the responses, everyone. I looked into JSONC or JSON5, but there don't seem to be any good available packages that can read the |
Maybe changing the format of the file to YAML? As YAML is a superset of JSON, it would still read .nsp written in JSON. I'll try this approach and see if it is feasible and address the concern here. |
Please don't use YAML. As I remember this feature is targeted as a UI editable smart playlist. I would not invest more time into changing the format or support features that are ONLY made just to be able to manually edit text files. The comments are only required if there is NOT a UI with descriptive elements. |
That’s a good point. If manual file editing is supposed to be temporary, then there’s no point needlessly jumping through hoops to get comments to work. |
I know it's not part of the file, but you can add comments to the generated playlist in navidrome for the nsp files. |
I think there is no need for changes. Comments are already supported on the playlist level. The most i would do is to add a comment property on the rule level, bot only if this can be integrated easily... |
You can set the Name and Comment displayed in the UI for a NSP file:
|
|
I just pushed a change (7871d69) that enables comments in JSON. Should be available soon in develop builds. It will be part of next release (in the next few days) |
Thank you! That’s awesome, and just stripping comments vs. adding support for JSON5/C/YAML seems like a much simpler change. |
thank you :) |
Is there an update on this? (Last Played for all users) |
I’m not necessarily saying this can’t be implemented properly, but I do want to point out that there are some real privacy issues raised by it. |
Smart playlists can be created as a json object into a file with
.nsp
extension and Navidrome will create a dynamic/query based playlist and keep it updated. These.nsp
files will be imported the same way as normal playlists, i.e. at scan time. See comment below for a complete list of fields and operators available.Some examples:
TODO
PHASE 1 - On demand
PHASE 2 - Live update
id
andrules
of playlist to processPHASE 3 - UI
MISCELANEOUS
The text was updated successfully, but these errors were encountered: