icefields / Power-Ampache-2

Android Music Streaming App suite in Material You style.
 Connects to Ampache, Nextcloud Music and compatible backends (Ampache API 4 and above).
https://power.ampache.dev
GNU General Public License v3.0
72 stars 5 forks source link

Application ask for same art multiple time #122

Open fufroma opened 4 months ago

fufroma commented 4 months ago

When I open an album on Power Ampache 1.00.58-free (58) - DB: 82, it look like it download the art for each song of the album.

But the image is the same for all the song, so it download the same image with the same URL a lot of time :

REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 511106 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 511105 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 405654 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 357870 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 346286 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 344365 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 508319 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 508319 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 508319 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 508319 "-" "okhttp/5.0.0-alpha.9"
REDACTED_IP - - [02/Jun/2024:13:30:57 +0200] "GET /image.php?object_id=10933&object_type=album&name=art.jpg HTTP/1.1" 200 508319 "-" "okhttp/5.0.0-alpha.9"

On top of having the server with unnecessary request (not a big deal), because the link for art are to full-size art, on this example we download 5.5M instead of 0.5M, it may be relevant for some country for the cell phone data.

Ampache know how to handle Etag correctly since Ampache 5.5.5, it may be useful here.

fufroma commented 4 months ago

If I play "swap left / right / left / right" on a list on the main page, it download the same image in a loop.

I think local cache is missing or faulty

icefields commented 4 months ago

thanks for the report. I use a library called Coil to get images, and I'm using a pretty aggressive cache, this seems like a bug. The library should not retrieve the image multiple times, and the cache should kick in immediately. I will double check my library initialization, in case I will file a bug to the developers of Coil.

icefields commented 4 months ago

Is your phone low in space by any chance? I just checked Coil logger and it looks like it's using the cache without making the network request:

2024-06-02 16:46:37.929  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1270&object_type=album
2024-06-02 16:46:37.930  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=317&object_type=artist
2024-06-02 16:46:37.948  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1081&object_type=album
2024-06-02 16:46:38.068  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1270&object_type=album
2024-06-02 16:46:38.069  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1191&object_type=album
2024-06-02 16:46:38.071  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1330&object_type=album
2024-06-02 16:46:43.264  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1270&object_type=album
2024-06-02 16:46:43.269  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=317&object_type=artist
2024-06-02 16:46:43.320  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1081&object_type=album
2024-06-02 16:46:43.403  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1270&object_type=album
2024-06-02 16:46:43.404  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1191&object_type=album
2024-06-02 16:46:43.418  8104-8104  RealImageLoader         ...ix.powerampache2.fdroid.debug  I  💾 Successful (DISK) - http://192.168.66.121/image.php?object_id=1330&object_type=album

I will do some more investigation today.

icefields commented 4 months ago

I increased the memory size of the image-cache in version 1.00-59 . https://github.com/icefields/Power-Ampache-2/releases/tag/v1.00-59 The Dogmazic version follows the name pattern as the previous releases ( PowerAmpache2-v1.00-59-PlayFree-release.apk )

fufroma commented 4 months ago

It got worst on some point, better on other:

fufroma commented 3 months ago

PowerAmpache2-1.00-60-free

fufroma commented 2 months ago

1.00-61-free still have only one issue : many identical request for the art when we open an album

REDACTED - - [09/Jul/2024:08:06:16 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:16 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:16 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224623 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224623 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224623 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224623 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224623 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"
REDACTED - - [09/Jul/2024:08:06:17 +0200] "GET /image.php?object_id=9515&object_type=album&name=art.png HTTP/1.1" 200 224299 "-" "okhttp/5.0.0-alpha.9"

everything else look fine :)