MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.35k stars 397 forks source link

Fix CoverartCacheManager #2325

Closed hoffie closed 5 months ago

hoffie commented 5 months ago

Previously, an ERROR was logged for each song without cover art when the Web UI was open. This commit avoids the error, caches the no-cover-art result and saves a roundtrip to mpd for all no-cover-art songs.

Note: This will start creating an empty file for each song without cover art in order to speed up the listing. This might be surprising at first, but is in line with how the current caching mechanism works.

pabera commented 5 months ago

Thanks a lot. It's a consequent development. I have refactored the code a little, reducing some code and logical statements.

pabera commented 5 months ago

Sorry for hijacking your RR so much. Your change is great but the original code was not very well written. I used the opportunity to correct my initial approach :-)

pabera commented 5 months ago

Thanks again for the initial commit and the trigger, to work on this feature again. A few things I have changed:

  1. CoverArt retrieval through python-mpd2 created a lot of I/O errors. Moved to mutagen instead
  2. Moved all Cover Art I/O into CoverCacheManager, the Player class now doesn't have to bother with it anymore
  3. Created separated thread for rendering cache files
  4. Added flush_cache function in order to be able to delete all cached files
hoffie commented 5 months ago

Sorry for hijacking your RR so much.

No worries!

Moved all Cover Art I/O into CoverCacheManager, the Player class now doesn't have to bother with it anymore Created separated thread for rendering cache files

This sounds really useful. :+1: The web UI is so nice and snappy, and the cover art stuff seemed to have made it sluggish at times in the past.

Should users be advised to clear their cover art caches on upgrade to get rid of the unnecessary old-style files maybe?

pabera commented 5 months ago

This sounds really useful. 👍 The web UI is so nice and snappy, and the cover art stuff seemed to have made it sluggish at times in the past.

Thanks! ✌️

Should users be advised to clear their cover art caches on upgrade to get rid of the unnecessary old-style files maybe?

That's a good idea. I will add a how-to note to the release PR.