LMS-Community / slimserver

Server for Squeezebox and compatible players. This server is also called Lyrion Music Server.
https://lyrion.org
Other
1.16k stars 293 forks source link

Return coverart information for all favorite items #440

Closed Gagi2k closed 3 years ago

Gagi2k commented 3 years ago

Hi,

i'm writing my own LMS client and using the 'favorites items' RPC command for getting all favorites. While the command works great, i'm not getting any coverart information. I'm currently using songinfo for each item to get the coverart, but that doesn't work for playlists.

It would be great if the RPC command could return the coverart information right away.

michaelherger commented 3 years ago

There's no cover art for playlists in the favourites. Covers only are shown by track or album.

Maybe I didn't understand the issue. Please provide the exact commands you're using, output you're getting, and describe what is missing in there.

Gagi2k commented 3 years ago

Sorry i wasn't clear enough.

If using the material-skin, the favorite list also shows cover information for e.g. spotify playlists as well as for, playlists or tracks from other plugins e.g. youtube. In addition it also shows the coveart for albums saved with the url "db:album.title=".

According to the documentation (i'm using this, maybe this is just way to old and outdated ? https://github.com/elParaguayo/LMS-CLI-Documentation/blob/master/LMS-CLI.md#0.1_Favorites). The cmd is able to provide a url to what's saved in favorites, but not able to provide you with a coverart.

This is the output i'm currently getting:

favorites items 0 10 want_url:1 favorites items 0 10 want_url%3A1 title%3AFavorites id%3A0 name%3ATop%20FM type%3Aaudio url%3Ahttp%3A%2F%2Fopml.radiotime.com%2FTune.ashx%3Fid%3Ds97458%26formats%3Daac%2Cogg%2Cmp3%2Cwmpro%2Cwma%2Cwmvoice%2Chls%2Creal%26partnerId%3D16 isaudio%3A1 hasitems%3A0 id%3A1 name%3AROCK%20ANTENNE type%3Aaudio url%3Ahttp%3A%2F%2Fopml.radiotime.com%2FTune.ashx%3Fid%3Ds25217%26formats%3Daac%2Cogg%2Cmp3%2Cwmpro%2Cwma%2Cwmvoice%2Chls%2Creal%26partnerId%3D16 isaudio%3A1 hasitems%3A0 id%3A2 name%3AMit%20Star%20bewertet type%3Aplaylist url%3Aspotify%3Auser%3A1122396801%3Aplaylist%3A6cUIeYvvBn3LhCjRxxEgVF isaudio%3A1 hasitems%3A1

michaelherger commented 3 years ago

Ok, music service playlists actually do have some artwork. But local playlists don't. That's why you would get some for Spotify etc.

BTW: I strongly suggest you do not use the raw CLI, but use /jsonrpc.js instead. This would return JSON structured results which are much easier to parse.

curl -X POST -d '{"id":0,"params":["00:04:20...",["favorites","items",0,10,"want_url:1"]],"method":"slim.request"}' http://localhost:9000/jsonrpc.js
Gagi2k commented 3 years ago

I totally agree that /jsonrpc.js makes more sense to use ;-)

Do you agree that the favorite items command should also return some coverart information ? Right now it only provides a url, but not the coverart as such. I'm also a bit puzzled how the matrial-skin retrieves it, but i guess it's using some internal perl commands directly to retrieve it.

As favorites can also host stations or tracks, i guess the generic tags: mechanism would be needed for "favorites" to support this ?

michaelherger commented 3 years ago

I don't get artwork for local playlists in Material. Only some generic placeholder.

Gagi2k commented 3 years ago

that's fine for a local playlist, but i would like to get the artwork for all other items which also work in the material-skin, but from the RPC command.

michaelherger commented 3 years ago

Ok, I'm seeing the problem in code. Would you be able to edit code? You could add the following in Slim/Control/XMLBrowser.pm line 1360 (for LMS8):

$hash{image} ||= proxiedImage($item->{icon}) if defined $item->{icon};

Would that work?

Gagi2k commented 3 years ago

I tested it with LMS 7.9 and it also works great there. Is there a chance to get it still into 7.9 ?

If you want i can create a PR for it.

michaelherger commented 3 years ago

Thanks for testing! I'm going to apply it to LMS8. If it turns out to be good with no unexpected side-effects, I'll back-port. Please ping me again in a week or two if I haven't done it by then.

Oh, and please let me know should you encounter any issue with this. Thanks!

Gagi2k commented 3 years ago

great, thx! Right now it works like a charm, but will let you know when something changes ;-)

mherger commented 3 years ago

I changed my mind and put it in 7.9 already :-).