Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 5 of 5

Thread: Current artwork

  1. #1
    jvromans@squirrel.nl
    Guest

    Current artwork

    AFAIK there are two API call to get the artwork for the currently playing
    track.

    One is a songinfo query, and use the tag 'c' to get the coverid value, and
    use the url http://<server>:<port>/music/<coverid>/cover.jpg .

    Other is http://<server>:<port>/music/current/cover.jpg?player=<playerid> .

    It seems that the first approach does not work for Spotty tracks. It always
    returns the generic 'radio' (antenna) cover. LMS web client and other
    clients show the right cover in this case, so apparently it is just the API
    call.

    The seconds approach seems to work for all tracks.

    Since I'm only interested in the current track artwork, are there any
    drawbacks to not use the second approach only?

    -- Johan

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,525

    Current artwork

    > The seconds approach seems to work for all tracks.
    >
    > Since I'm only interested in the current track artwork, are there any
    > drawbacks to not use the second approach only?


    Just use the second way. Saves you one call and parsing a result.

    --

    Michael

  3. #3
    jvromans@squirrel.nl
    Guest

    Current artwork

    On Mon, 23 Nov 2020 16:15:59 +0100, Michael Herger <slim (AT) herger (DOT) net> wrote:

    > > The seconds approach seems to work for all tracks.
    > >
    > > Since I'm only interested in the current track artwork, are there any
    > > drawbacks to not use the second approach only?

    >
    > Just use the second way. Saves you one call and parsing a result.


    Well, I need to do the songinfo call anyway... But I was merely interested
    why the songinfo call would return an undefined or less than zero
    (i.e. invalid) coverid while fetching the current artwork does return a
    cover.

    -- Johan


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

    Current artwork

    > Well, I need to do the songinfo call anyway... But I was merely interested
    > why the songinfo call would return an undefined or less than zero
    > (i.e. invalid) coverid while fetching the current artwork does return a
    > cover.


    IDs < 0 are for remote streams, they're not invalid. I believe the
    negative value was made to tell LMS which path to take. Positive would
    be stored in the database, as that's a local file. Negative would use
    the protocol handler or other to figure out what to show.

    --

    Michael

  5. #5
    jvromans@squirrel.nl
    Guest

    Current artwork

    On Tue, 24 Nov 2020 00:38:11 +0100, Michael Herger <slim (AT) herger (DOT) net> wrote:

    > IDs < 0 are for remote streams, they're not invalid. I believe the
    > negative value was made to tell LMS which path to take. Positive would
    > be stored in the database, as that's a local file. Negative would use
    > the protocol handler or other to figure out what to show.


    That's what I expected. However it seems that a negative value (for a spotty track) consistently returns the 'network' image. Retrieving the current cover sometimes yields the wrong cover (the one from a previous track).

    I resolved to:

    if ( d.coverid == 'undefined' || d.coverid < 0 )
    g("coverimage").src = urlpfx + "/music/current/cover.jpg?player=" + player.replace(/:/g,'%3A');
    else
    g("coverimage").src = urlpfx + "/music/" + d.coverid + "/cover.jpg";

    which seems to give good results in all situations (so far).

    -- Johan

Posting Permissions

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