ribbons / RadioDownloader

An easy to use application for managing podcast subscriptions and downloads.
https://nerdoftheherd.com/tools/radiodld/
GNU General Public License v3.0
15 stars 11 forks source link

Store original images in database rather than converting them all to PNG #228

Closed benshep closed 4 years ago

benshep commented 5 years ago

While migrating my DB from one computer to another, I noticed the database file was huge - about 450 MB. The culprit seems to be thumbnail images from The Allusionist podcast, which are often multi-MB PNG files. I never look at these thumbnails, and certainly not at the resolution they come in. Could we have an option to remove them or keep them to a manageable size? (It seems to have no effect on performance, and I know storage space is cheap, but it seems an unnecessary waste of space.)

ribbons commented 5 years ago

Yes, it's a fair cop :smile: - storing the thumbnail images does cause the database to get huge sometimes.

I've not been especially happy with how the application stores images for a while - due to historic reasons the episode images are all stored as PNGs, even when the source file is an (almost certainly smaller) JPEG. In fact, looking at the latest episode for The Allusionist, it looks like that is a factor here - the episode 'Harsh Realm' looks to have a JPEG format itunes:image which is a (still pretty excessive) 1.7 MB. Converted to PNG this ends up as over 7 megabytes, which I think may explain why your database has ended up so large!

Would you be okay for me to re-purpose this report as a 'store source images instead of as PNG' issue and then come back to adding an option to disable or limit thumbnails once we see how much of a difference that makes?

benshep commented 5 years ago

Yep - that sounds fine to me. Thanks for the quick response.

ribbons commented 4 years ago

Right, this is now implemented - starting with a clean database and listing all of The Allusionist episodes previously resulted in a 525 megabyte database. After the changes in c1dc5082e3cbc79dec27f9d24837c1ed57464637, this now results in a 65 megabyte database, which is quite an improvement!

If you'd like to try out this change before the next version of Radio Downloader is released, you can download and install a build incorporating this change from here: https://ci.appveyor.com/project/ribbons/radiodownloader/build/job/8k8vk35m4cwbg9tj/artifacts

Unfortunately this won't reduce the size of your existing database, only slow down the rate at which it grows. However, if you really aren't bothered about episode images at all you could run the following SQL against the database to remove them:

update episodes set image=null;

This would then cause all of the previously downloaded episode images to be classed as unused and cleaned up on application startup within the next 7 days (although the space would not be reclaimed from the database file for up to three months).

benshep commented 4 years ago

That's superb - thanks very much! I've installed the new version and ran the SQL command you suggested. My db currently stands at 676MB so I'll keep an eye on it and see if it shrinks a bit. Downloaded items go straight onto my old-skool MP3 player, which has no facility to view images, so I never ever see them anyway. (I'm sure I'm in a minority here, not getting podcasts on my phone, but I listen in the car so physical buttons are a necessity and a screen is a distraction.)

ribbons commented 4 years ago

No worries :smile:.