owncloud / music

:notes: Music app for ownCloud
GNU Affero General Public License v3.0
571 stars 199 forks source link

No cover displayed with Ampache client #1156

Closed pled closed 4 months ago

pled commented 4 months ago

HI, I am using Nextcloud 29.0.1, Music 2.0.0 and PowerAmpache2-1.00-61-fdroid versions. I cannot succeed to get covers from NC Music server on PA, although album art is nicely displayed in the NC Music web interface.

Music

I don't know exactly how to investigate this, and I would be happy to learn when and how server provides covers to the ampache client. Some of my musical library files have cover art embedded in the file, some others have a cover.jpg file in the same folder. These last take a bit more time to be displayed in the web view, but it is ok at the end (performance issue with my small server I guess).

Here is some log I collected when client is connecting :

{"reqId":"6sTdNEFOkm7QZCpXTMdF","level":0,"time":"2024-07-04T08:01:57+00:00","remoteAddr":"192.168.1.20","user":"pascal","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"dirty table reads: SELECT `name` FROM `*PREFIX*authtoken` WHERE (`uid` = :dcValue1) AND (`last_activity` >= :dcValue2)","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0","version":"29.0.3.4","exception":{"Exception":"Exception","Message":"dirty table reads: SELECT `name` FROM `*PREFIX*authtoken` WHERE (`uid` = :dcValue1) AND (`last_activity` >= :dcValue2)","Code":0,"Trace":[{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":348,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/config/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php","line":384,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/config/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"/config/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":293,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/config/www/nextcloud/apps/notifications/lib/Service/ClientService.php","line":54,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/config/www/nextcloud/apps/notifications/lib/Controller/EndpointController.php","line":109,"function":"hasTalkDesktop","class":"OCA\\Notifications\\Service\\ClientService","type":"->"},{"file":"/config/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->"},{"file":"/config/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/config/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/config/www/nextcloud/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/config/www/nextcloud/ocs/v1.php","line":66,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/config/www/nextcloud/ocs/v2.php","line":23,"args":["/config/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/config/www/nextcloud/lib/private/DB/Connection.php","Line":316,"message":"dirty table reads: SELECT `name` FROM `*PREFIX*authtoken` WHERE (`uid` = :dcValue1) AND (`last_activity` >= :dcValue2)","tables":["oc_authtoken"],"reads":["oc_authtoken"],"exception":{},"CustomMessage":"dirty table reads: SELECT `name` FROM `*PREFIX*authtoken` WHERE (`uid` = :dcValue1) AND (`last_activity` >= :dcValue2)"}}
{"reqId":"1pZgJ34txO23TnICOvqL","level":0,"time":"2024-07-04T08:02:33+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=handshake&auth=6cdbcd7734572fc4423884d84ced5660781789e923e32c043fda15e78ef52150&user=pascal&timestamp=1720080153","message":"Ampache action 'handshake' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"WlXD1Qk7Jetg72S5FQJW","level":0,"time":"2024-07-04T08:02:33+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=user&auth=5577f70e9eed2ba5d14a45dc5aac4328&username=pascal","message":"Ampache action 'user' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"P3J7DjqvOYM6KHsouUY8","level":0,"time":"2024-07-04T08:02:33+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=ping&auth=5577f70e9eed2ba5d14a45dc5aac4328","message":"Ampache action 'ping' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"7WsGG6d5r9R8EZwd4pbG","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=genres&auth=5577f70e9eed2ba5d14a45dc5aac4328&exact=0&offset=0&limit=0","message":"Ampache action 'genres' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"zFJCMhd0460T2svhKzee","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=highest&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"OHFqao3CygrIHxhlblBK","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=recent&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"txFZLZTVNY0rYm1RVO6E","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=flagged&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"bWkY8tEUlDgQENrJa38X","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=frequent&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"ALsKnBVMUrsp7GmA966L","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=playlists&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=0&filter=&exact=0&offset=0&hide_search=0&show_dupes=1","message":"Ampache action 'playlists' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"3rrM8XW5e4LCJOSxfg1x","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=random&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"JW0mss0o9UHAm0WO0FY2","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=newest&offset=0","message":"Ampache action 'stats' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}
{"reqId":"3F5NES0PglNo3O8UO8Cr","level":0,"time":"2024-07-04T08:02:34+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=playlists&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=0&filter=&exact=0&offset=1&hide_search=0&show_dupes=1","message":"Ampache action 'playlists' requested","userAgent":"PowerAmpache2-1.00-61-fdroid","version":"29.0.3.4","data":{"app":"music"}}

And may be this type of request for songs (not sure, but one can see "song&id=xxxxxx") :

{"reqId":"rv6bGelJMOWJx4pkUMpx","level":0,"time":"2024-07-05T08:56:56+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/ampache/server/json.server.php?action=stream&auth=c7658352979824eab3eb335c15b54a22&type=song&id=31188","message":"Ampache action 'stream' requested","userAgent":"Dalvik/2.1.0 (Linux; U; Android 14; Pixel 6a Build/AP2A.240705.004)","version":"29.0.3.4","data":{"app":"music"}}

pled commented 4 months ago

Some more information : I have installed a subsonic client on my android (substreamer), and covers are nicely displayed using it. I notice that type of request explicitly asking for cover art (getCoverArt.view) with subsonic client : {"reqId":"AyKmwNQqoj01xaosADIa","level":0,"time":"2024-07-07T15:01:57+00:00","remoteAddr":"192.168.1.126","user":"--","app":"music","method":"GET","url":"/apps/music/subsonic/rest/getCoverArt.view?u=pascal%20&p=xxxxxxxxxx&v=1.13.0&c=substreamer&f=json&size=500&id=album-5463","message":"Subsonic request getCoverArt.view","userAgent":"Dalvik/2.1.0 (Linux; U; Android 14; Pixel 6a Build/AP2A.240705.004)","version":"29.0.3.4","data":{"app":"music"}}

Using Power Ampache client, I don't observe such request. Is it expected ? which request from ampache client is supposed to get cover art from Nextcloud Music App ?

paulijar commented 4 months ago

There are basically two ways that an Ampache client could use to load the album art:

  1. Using the Ampache API call with action=get_art. But as that kind of calls are not visible in the log, I guess that PA2 is not using this alternative.
  2. Using the art URL returned as part of each album-type response from the Ampache API. If this alternative is used, then there is nothing logged to nextcloud.log.

What you could try would be to fetch some albums from the Ampache API manually using the web browser. For example, the URL https://<your_server_url>/apps/music/ampache/server/json.server.php?action=stats&auth=5577f70e9eed2ba5d14a45dc5aac4328&limit=40&username=pascal&type=album&filter=random&offset=0 shown in your logs should work. Just note that the value of auth= argument is a temporary session token, and this one is most likely already revoked. So check a valid token from a new log line. Then, you should get a response containing objects looking something like: image

From there, copy the url shown on the key art and test if you can load that with the web browser.

PS: If you have any further questions or findings, I might not be able to comment on those before Wednesday. But I will as soon as I can.

pled commented 4 months ago

Thanks a lot for your answer. I did the test, and I do receive the expected answer :

Capture d’écran du 2024-07-08 09-40-49

So if my understanding is correct, this is an issue on client side. I will update issue on Github Power Ampache site.

paulijar commented 4 months ago

Did you also follow that 'art' link and receive the image from there? If yes, then I would conclude that this is a client issue.

Btw, are your cover art images embedded in the audio files, or do you use separate image files located in the folder of each album? I'm wondering if the image format could be such that PA2 cannot handle it.

pled commented 4 months ago

Hum, the 'art' link does not work, I get 404 error. Like for example :

https://xxx.yy/apps/music/ampache/image.php?object_type=album&object_id=5460&token=2-056cc720706eda4d3a6f4cde3a507ec5 For my test, I have both types of albums : some have art images embedded, when others are using cover.jpg file in the album folder.

paulijar commented 4 months ago

Can you see from the browser developer tools if there is any message attached to this 404 response?

pled commented 4 months ago

It seems to be nginx response :

Capture d’écran du 2024-07-08 10-58-36

I had a similar issue when setting up my server, see that issue I raised to Nextcloud documentation : https://github.com/nextcloud/documentation/issues/11951

I may have to add another location or modify the one added to make this work...

Will do some tests with that, come back to you later on, I have to go now.. Thank you for your help...

pled commented 4 months ago

So I did the test modifying the location in the nginx configuration file, and now the art link works and displays the cover. From "location ~ ^/apps/music/ampache/server/.*\.php$" to "location ~ ^/apps/music/ampache/.*\.php$"

So this time, all is fine on server side I believe... :+1:

(I have to update documentation issue with that)

paulijar commented 4 months ago

As far as the Music app is concerned, I consider this issue closed. The remaining problems shall be handled in the PA2 and Nextcloud documentation projects.