Home of the Squeezebox™ & Transporter® network music players.
Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31
  1. #21
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    virtual library: database operation

    > 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

  2. #22
    Senior Member
    Join Date
    Jul 2010
    Posts
    150
    Quote Originally Posted by mherger View Post
    Because that's how it's implemented and documented
    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) )

  3. #23
    Senior Member
    Join Date
    Mar 2017
    Posts
    2,311
    Quote Originally Posted by afriend View Post
    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.
    I'd imagine the reason for using index and not track_id/trackurl is because a track can appear multiple times in a playlist.
    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.

  4. #24
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    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

  5. #25
    Senior Member
    Join Date
    Jul 2010
    Posts
    150
    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.

  6. #26
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    11,100
    Quote Originally Posted by afriend View Post
    BTW just curious. I'm still using LMS 7.9.x. And some of your plugins like Dynamic Playlist, SQL Playlist + CustomSkip. And since my virtual library definitions always had some empty entries in the artists and genre menus, I've started using CustomBrowse a little again (because your Filtered Artists / Filtered Genres menus don't have that problem.

    Are the current versions (maxVersion=7.9) of these plugins fully compatible with LMS 8.x. as far as you know? I'd assume so but it would be nice to know. Thanks.
    Unfortunately the situation is the same as it was a few months back:
    https://forums.slimdevices.com/showt...l=1#post984145
    Erland Isaksson (My homepage)
    Developer of many plugins/applets

  7. #27
    Senior Member
    Join Date
    Jul 2010
    Posts
    150
    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.

  8. #28
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,479

    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

  9. #29
    Senior Member
    Join Date
    Jul 2010
    Posts
    150
    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.

  10. #30
    Senior Member
    Join Date
    Jul 2010
    Posts
    150
    deleted
    Last edited by afriend; 2020-12-01 at 07:23.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •