thomas-ernest / plugin.video.arteplussept

Watch Arte+7 content in Kodi
GNU General Public License v2.0
6 stars 4 forks source link

Improve image retrieve to optimize memory comsumption #47

Closed thomas-ernest closed 10 months ago

thomas-ernest commented 10 months ago

Add parameters to arteitem._get_image_url in order to enable image resolution and text layer. Use 1920x1080 resolution and no text to populate fanart, use 320x180 resolution and text for thumbnails.

More details in discussion of issue #44 .

hypnotoad commented 10 months ago

The memory consumption definitely wen down a lot (at least 100MB on usual list pages). But I there is only a thumbnail placeholder now and no preview icon on the left (just the full hd image in the background). I think downloading the small resolution does not work. In the console, I see:

GetImageHash - unable to stat url https://api-cdn.arte.tv/img/v2/image/qteyKntxDG2BaxEaXf6kdZ/320x180?type=TEXT
GetImageHash - unable to stat url https://api-cdn.arte.tv/img/v2/image/qteyKntxDG2BaxEaXf6kdZ/320x180?type=TEXT
CurlFile::Open - <https://api-cdn.arte.tv/img/v2/image/qteyKntxDG2BaxEaXf6kdZ/1920x1080>
Caching image 'https://api-cdn.arte.tv/img/v2/image/qteyKntxDG2BaxEaXf6kdZ/1920x1080' to '5/5dc96423.jpg':
cached image 'special://masterprofile/Thumbnails/5/5dc96423.jpg' size 1920x1080
GetImageHash - unable to stat url https://api-cdn.arte.tv/img/v2/image/qteyKntxDG2BaxEaXf6kdZ/320x180?type=TEXT

PS: I use Kodi 20.1 from Debian 12.

thomas-ernest commented 10 months ago

When I did my test I used 480x270, not 320x180 actually. I will update the PR accordingly. It is 4 times smaller instead of 6.

hypnotoad commented 10 months ago

Works for me. For the reference how I checked memory consumption:

cd /sys/fs/cgroup
mkdir mem
cd mem
echo 170000000 > memory.max
echo 0 > memory.swap.max
# start kodi
pgrep kodi.bin > cgroup.procs 
while true; do cat memory.current; sleep 0.1; done

Thank you!