ampache / ampache-xbmc-plugin

KODI plugin for Ampache
Other
8 stars 3 forks source link

Album art doesn't work with ownCloud/Nextcloud Music #5

Closed paulijar closed 3 years ago

paulijar commented 3 years ago

The plugin doesn't show any album art (or artist art) when using Nextcloud Music as the server. From your source code, I saw a comment stating that "also nexcloud server doesn't send images". This isn't true, because the Nextcloud Music sends the <art> element on all artist, album, and song entities. The Music app can't fetch the art from any external services, but it does support album art embedded in the audio files as well as separate image files stored in the same folder with the music files. Artist images it can find from image files named exactly like the artist name (e.g. "Metallica.jpg").

Now, the reason why these images are not shown on the Kodi plugin is probably the plugin's unwarranted expectations about the format or the art URL here: https://github.com/ampache/ampache-xbmc-plugin/blob/bd745fb9a7d3a800f3bb23a868340903fd7aa6f8/resources/lib/art.py#L21-L22

There, you seem to assume that the URL would have an argument id as its first argument. There's no specification promising this, so basically you are depending on an unspecified implementation detail which may well change in which ever update of the Ampache server.

Meanwhile, the art URLs returned by Nextcloud Music currently look something like this: https://your.cloud.domain/nextcloud/index.php/apps/music/ampache/server/xml.server.php?action=get_art&id=989038&auth=b889fef05dfee46bc5085e45c28ec498&type=artist

Also, I don't promise that the format will always be like this. But currently, I have no reason or plans to change it. Furthermore, if you alter your logic to support this URL format, then please note that the id field here is guaranteed to be unique only within the albums and within the artists, but not between these two groups. Hence, you shouldn't use the id alone as the cache key but also consider the argument type.

lusum commented 3 years ago

Ok, i will check that and i will correct.

lusum commented 3 years ago

Ok, i have done a little testing. The plugin don't use get_art method, but fetch directly the image from server based on url, i will change with the more standard get_art, i will use only the album images, as all plugin/app/addons i have tested. Maybe, i will add also artist art, but it is a work in progress. This was the only one method that don't used the standard api, i will fix it.

lusum commented 3 years ago

The cacheArt has been rewritten and now all not standard parts has been eliminated. The art now works with nextcloud. It handles only album art, not for technical reasons, but i think that is the better choice by design. The art for songs is the art of their album. I don't use external services in this app also by design, cause i see self hosting as a privacy choice and also the support of external services needs extra work to follow every changes of the external server api ( obv. every external service should be disabled by default and enabled only in configuration )

paulijar commented 3 years ago

Great, thanks, that was quick action! 👍