Bug 480263 - Podcast preview disappears when the download completes
Summary: Podcast preview disappears when the download completes
Status: RESOLVED FIXED
Alias: None
Product: kasts
Classification: Applications
Component: general (show other bugs)
Version: 23.08.4
Platform: Debian unstable Linux
: NOR minor
Target Milestone: ---
Assignee: bart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-24 11:23 UTC by Salvo "LtWorf" Tomaselli
Modified: 2024-01-25 02:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
video of the issue (582.19 KB, video/x-matroska)
2024-01-24 11:23 UTC, Salvo "LtWorf" Tomaselli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Salvo "LtWorf" Tomaselli 2024-01-24 11:23:21 UTC
Created attachment 165182 [details]
video of the issue

SUMMARY

It seems that when the download of the episode completes, the preview image disappears.

See the attached video.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
Comment 1 bart 2024-01-24 12:05:05 UTC
The problem is that the mp3 files seem to have images embedded into the ID3 tag, but they are not readable by any tool that I have tried.

As background: Kasts has a fallback order for images: it will first try to show the embedded art in the mp3/ogg/.. tags; if that doesn't exist it will try the image mentioned in the RSS feed for this particular entry; if that doesn't exist, it will fall back to the podcast image itself (also taken from the RSS feed).
In this case, before you've downloaded the file, you're first seeing the image mentioned in the RSS feed for the episode/entry/enclosure.  Once the download completes, Kasts checks the mp3 file, finds an image and tries to load that one instead.  But in this case the images are broken beyond repair, it seems.  So it's really a problem with this podcast's enclosures, not Kasts: they shouldn't put broken images into the files.

I could try and see if I can detect broken images and then fall back again to another one.  But I'm not sure that QML has any way of detecting that.
Comment 2 Bug Janitor Service 2024-01-24 13:23:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/kasts/-/merge_requests/170
Comment 3 bart 2024-01-24 13:27:28 UTC
Git commit 50bdc5551c7af328e80168a72be306da0376bfbc by Bart De Vries.
Committed on 24/01/2024 at 14:26.
Pushed by bdevries into branch 'master'.

Add check for invalid embedded images

Some enclosures have non-empty embedded images which are not pictures.
This add a check which discards those, and then falls back to a valid
image.

M  +2    -1    src/enclosure.cpp

https://invent.kde.org/multimedia/kasts/-/commit/50bdc5551c7af328e80168a72be306da0376bfbc
Comment 4 bart 2024-01-24 13:28:31 UTC
Git commit e3b1087b24d1ca2318e7a08ee64b89119b26da0a by Bart De Vries.
Committed on 24/01/2024 at 14:28.
Pushed by bdevries into branch 'release/24.02'.

Add check for invalid embedded images

Some enclosures have non-empty embedded images which are not pictures.
This add a check which discards those, and then falls back to a valid
image.

M  +2    -1    src/enclosure.cpp

https://invent.kde.org/multimedia/kasts/-/commit/e3b1087b24d1ca2318e7a08ee64b89119b26da0a
Comment 5 bart 2024-01-24 13:31:48 UTC
Was not that difficult in the end.  But at the expense of having to load, check and discard the invalid image every single time it's needed in the GUI...  Luckily there's only a one-time, very small overhead for valid images.  Since this is the first time that such invalid images have been reported it seems that the trade-off is valid.
Comment 6 Salvo "LtWorf" Tomaselli 2024-01-24 13:43:36 UTC
This is the podcast in question, if it helps. https://feeds.megaphone.fm/naqp

I don't know if it's only a 1 time thing though, if you scroll up and down it needs to be redone no? At least, I see all the images slowly appear when I scroll up and down.
Comment 7 bart 2024-01-24 13:52:04 UTC
Thanks.  I already found the feed from the video.  I used it to confirm the bug and to confirm the subsequent fix.
That reminds me: once you run a version with the fix (the final 24.02 or a build from master), you will have to clear the image cache to see the proper images again.  This is because the invalid images will stay in your cache, blocking the proper images from showing up, even with the fix.

Some more background on the way that images are handled: On first load, each of the images is cached to ~/.local/share/KDE/kasts/images (most images need to be downloaded the very first time).  On any subsequent use, they are loaded from there.  Once they are cached, no further checks are done, so they should load pretty quickly.

The problem with the invalid images is that Kasts will not create a cache file for those (because they would be invalid), so it will try to probe the mp3 for an image again.  And that will happen on each load, not only the first one.  So the overhead is only there for episodes with invalid embedded images.  Again, I don't think this will be a problem.
Comment 8 Salvo "LtWorf" Tomaselli 2024-01-25 02:29:33 UTC
Ok, thanks for fixing this so quickly!