clementine-player / Clementine

:tangerine: Clementine Music Player
https://www.clementine-player.org/
GNU General Public License v3.0
3.76k stars 677 forks source link

Album art does not get searched automatically when playing via subsonic #6565

Open oidz1234 opened 4 years ago

oidz1234 commented 4 years ago

Before posting

Please follow the steps below and check the boxes with [x] once you did the step.

System information

Please provide information about your system and the version of Clementine used.

Expected behaviour / actual behaviour

When Playing music via subsonic; the album art gets displayed.

Steps to reproduce the problem (only for bugs)

Play some music via subsonic.

I can still actually manually search for the art in Clementine and it all works fine. I am using ampache as my subsonic server if that has any effect.

llucps commented 4 years ago

I can confirm this happens to me too, using latest Airsonic stable release 10.5.0

oidz1234 commented 4 years ago

I think this might be an issue with the linux builds. I have just tested on windows and it works perfectly.

llucps commented 4 years ago

Not just Linux, it happens on Macos as well.

oidz1234 commented 3 years ago

Hello, I have recently updated my clementine install and this seems to have been fixed. Clementine version = 1.4

captn3m0 commented 3 years ago

Which release are you at? I'm at 1.4.0rc1+347+gfc4cb6fc7-1 on Arch, and the diff from there doesn't seem to have a fix: https://github.com/clementine-player/Clementine/compare/1.4.0rc1-347-gfc4cb6fc7...master

oidz1234 commented 3 years ago

@captn3m0 This is the RPM I have installed, on fedora.

clementine-1.4.0-1.rc1.20200617gitedb8c3b.fc31.x86_64

captn3m0 commented 3 years ago

I tested again, and it doesn't work with Subsonic for me still.

wjoe commented 3 years ago

Confirmed this is the case as well, on Arch Linux with the latest Clementine built from git. 1.4.0rc1-472-g4e8a12f37

I can also see in my server logs that Clementine is making a request to get the cover art, when I go to play the song:

"GET /rest/getCoverArt.view?v=1.8.0&c=Clementine&u=user&p=password&id=4000 HTTP/1.1" 200 239 "-" "Clementine 1.4.0rc1-472-g4e8a12f37

In my case, I'm using FunkWhale as the audio server, which implements the Subsonic API. Others in this thread mentioned Airsonic and Ampache which also implement the API.

I believe in my case, the issue is with the song ID. This request does not return cover art, with an error:

<subsonic-response funkwhaleVersion="1.0.1" status="failed" type="funkwhale" version="1.16.0">
<error code="70" message="cover art not found."/>
</subsonic-response>

Clementine seems to be making a request for the cover art using the song ID. In the vanilla Subsonic API, this is a valid request, as ID can be any song, album, or artist ID. In Funkwhale this requires a specific cover art ID.

I would put this down to an incorrect implementation of the API on Funkwhale's end, however other third party apps which use the Subsonic API do manage to fetch the cover art (eg DSub and UltraSonic) from Funkwhale. API requests (in all implementations of the subsonic API that I've tested) to get album and song info do return a specific coverArt ID along with the song info:

GET /rest/getSong.view?u=user&p=password&v=1.8.0&c=Clementine&id=4000

<subsonic-response funkwhaleVersion="1.0.1" status="ok" type="funkwhale" version="1.16.0">
<song album="..." albumId="529" artist="..." artistId="222" bitrate="128" contentType="audio/x-m4a" coverArt="al-529" created="2021-02-24T12:28:00.000Z" discNumber="1" duration="222" id="4000" isDir="false" path="..." size="3605196" suffix="m4a" title="..." track="1" type="music" year="2002"/>
</subsonic-response>

The coverArt returned by this request can then be used as the ID in the getCoverArt request, eg GET /rest/getCoverArt.view?v=1.8.0&c=Clementine&u=user&p=password&id=al-529 to return the cover art image.

I've tested this on an official subsonic server too, and the coverArt parameter is still present in the getSong request, in this case the value is the same as the album ID:

GET http://demo.subsonic.org/rest/getSong.view?v=1.8.0&c=Clementine&u=guest&p=guest&id=100

<subsonic-response status="ok" version="1.16.1">
<song id="100" parent="89" isDir="false" title="..." album="..." artist="..." track="5" year="2008" coverArt="89" size="6205568" contentType="audio/mpeg" suffix="mp3" duration="386" bitRate="128" path="..." playCount="1073" created="2017-03-12T11:05:41.000Z" albumId="9" artistId="7" type="music"/>
</subsonic-response>

Alternatively, the getAlbumList2 and getAlbum requests that Clementine makes when populating the album/song list also return the coverArt parameter (for album and song respectively), I don't know if it is possible to store this ID with the local song metadata in some way to be used when the song plays.

So while this may be an issue with the server's implementation of the API, using an explicit cover art ID rather than the song ID seems like the more reliable thing to do, and will still work the same for the official implementation.

TL;DR: Instead of doing a request to getCoverArt.view?id=$songId, Clementine should do a request to getSong.view?id=$songId, then use the coverArt parameter in the response to do getCoverArt.view?id=$coverArtId