> Why would the params be -bad- with delete but not with add? Any idea?
Because that's how it's implemented and documented:
index For "cmd:up", "cmd:down", "cmd:move" and "cmd:delete" the index of
the track to edit.
url For "cmd:add", the url of the track to add.
--
Michael
Results 21 to 30 of 31
-
2020-11-17, 22:00 #21
virtual library: database operation
-
2020-11-18, 11:03 #22
- Join Date
- Jul 2010
- Posts
- 211
Yes, my bad.
If you have a playlist_id and track_id/trackurl, what do you reckon is the easiest way to delete a track from a playlist?
By easier I mean less code than getting all tracks of each playlist, looping through them to find the index position of my track and then delete the track with playlist edit cmd:delete.
Since this seems quite a lot of code for such a little task I guess I mistakenly thought that the "delete" command would work with "url" just like "add" - which would be very easy and efficient.
BTW I think I figured out the SQL part for unrating songs (incl. those without comments). I changed the last lines to
Code:LEFT JOIN comments ON comments.track = tracks.id WHERE (comments.value NOT LIKE ? OR comments.value IS NULL) )
-
2020-11-18, 14:12 #23
- Join Date
- Mar 2017
- Posts
- 2,619
Material debug: 1. Launch via http: //SERVER:9000/material/?debug=json (Use http: //SERVER:9000/material/?debug=json,cometd to also see update messages, e.g. play queue) 2. Open browser's developer tools 3. Open console tab in developer tools 4. REQ/RESP messages sent to/from LMS will be logged here.
-
2020-11-18, 15:47 #24
virtual library: database operation
> By easier I mean -less code than- getting all tracks of each playlist,
> looping through them to find the index position of my track and then
> delete the track with playlist edit cmd:delete.
> Since this seems quite a lot of code for such a little task I guess I
> mistakenly thought that the "delete" command would work with "url" just
> like "add" - which would be very easy and efficient.
How else would that handler do it, other than go through the list and
delete items (there could be more than one of them) matching the URL?
--
Michael
-
2020-11-18, 16:20 #25
- Join Date
- Jul 2010
- Posts
- 211
I guess I should have given more details. I was thinking of dedicated playlists that contain those tracks that I have rated via the plugin, let that be 1 playlist for each rating value or something else. It's supposed to help make rating these tracks easier in other apps.
So if I rate a track 5 stars and then change my mind and rate it 1 star, in the end I want this track to be part of only one rating playlist, the playlist corresponding to the last rating I gave it. So for that I need to delete it from all other dedicated rating playlists it might have been added to before. That's what this was all for.
And I'm not sure how this works for everybody else but if I add a track to one of these playlists using "playlist edit cmd:add", I can add it again to the very same playlist using the same command as often as I want, in the end it only appears there once, not multiple times. At least here.
Thanks anyway.
-
2020-11-19, 21:51 #26
Unfortunately the situation is the same as it was a few months back:
https://forums.slimdevices.com/showt...l=1#post984145Erland Isaksson (My homepage)
Developer of many plugins/applets
Starting with LMS 8.0 I no longer support my plugins/applets (see here for more information )
-
2020-11-23, 09:50 #27
- Join Date
- Jul 2010
- Posts
- 211
I'd like to call/execute a function from the LMS settings for this plugin. I have a clickable href/javascript string on that page. And from what I gathered from plugins like CustomScan is that onlick calls a the same plugin page but with a parameter like ?refresh=1 appended.
My question: is this the only way to call/execute a function? And if so, how do I catch/get that parameter so that the function is called? Thank you.
-
2020-11-23, 16:42 #28
virtual library: database operation
> I'd like to call/execute a function from the LMS settings for this
> plugin. I have a clickable href/javascript string on that page. And from
> what I gathered from plugins like CustomScan is that onlick calls a the
> same plugin page but with a parameter like ?refresh=1 appended.
> My question: is this the only way to call/execute a function? And if so,
> how do I catch/get that parameter so that the function is called? Thank
> you.
There are as many ways to implement this as you like: you can re-use the
existing page handler with an additional parameter (as outlined). Or you
can write your own page handler. Or you define a CLI command which you
trigger over /jsonrpc.js... there are many options.
I've done all three of them, I believe.
--
Michael
-
2020-11-28, 03:44 #29
- Join Date
- Jul 2010
- Posts
- 211
Thank you. I'm now close to finishing work on this plugin.
I wanted to offer a menu with entries where you can browse artists or genres that feature rated tracks.
So for testing purposes I started with a small "Browse Artists - Rathe High" for Artists that have at least one track rated >= 60. The sql for the underlying virtual library is based on "tracks_persistent.rating >= 60" and contains the correct (number of) tracks.
But I think my menu node definition may be missing some filter or something because sometimes a menu for a rated artist contains albums that they contributed a track to but an unrated one.
I think among many other things I've tried filtering for track artists (which I thought made sense at the time) but then some artists wouldn't show up but they should (which is even worse than empty entries).
I know this problem description sounds quite abstract. Since it can be reproduced with a library of just 3 music files I took the liberty of uploading those 3 files and a test plugin that creates the virtual library and menu node I was talking about (link).
For this to work you'd only have to rate the 2 songs with "3 stars" in the comment tag accordingly (no. 5 + 18 that is). Then if you go to the "artists - rated high" menu and take a look at the artist "B. Carvalho" one of the albums shouldn't be listed there and clicking on it you see it contains indeed no entries in this menu.
You're probably very busy but if you ever find the time to take a look I'd really value your opinion and advice. I have no idea how to get rid of those false/empty album listings.
Thank you.
-
2020-11-29, 04:24 #30
- Join Date
- Jul 2010
- Posts
- 211
deleted
Last edited by afriend; 2020-12-01 at 07:23.