Coverart downloader (Bluetooth and storage music)

Post Reply
noobychris
Posts: 25
Joined: Fri Aug 15, 2025 5:06 pm
Location: Germany
Contact:

Coverart downloader (Bluetooth and storage music)

Post by noobychris »

Hello together,
another example from me :-) This time a coverart downloader for bluetooth and storage music.
For Apple Carplay and Android Auto this is not needed because they already deliver the coverart.

Update 2025/08/23:
- VENV bootstrap (~/.venv/hudiy) + package check and automatic install if missing
- Parallel providers: iTunes (600x600) + Deezer (500x500)
- Early-stop: as soon as a very strong match appears (EARLY_STOP_SCORE)
- Only log the chosen winner (no query spam)
- Send cover ONLY if cached / in local DB or right after download
- Inject immediately after download; save cache/DB asynchronously
- Local DB: ~/.cache/hudiy-coverart/covers_db.json (maps key -> filename + meta)
- Cache: ~/.cache/hudiy-coverart/<key>.jpg
- Offline backlog: ~/.cache/hudiy-coverart/pending/<key>.json
- Cleans metadata (cut anything after "•") if Spotify adds "video available"
- Source allowlist (MediaSource): only STORAGE and A2DP (cache/DB + downloads)
- For STORAGE requests, after sending cover, embed it into the audio file (MP3/FLAC/M4A)
- One-shot library pass at startup: find MP3 without covers, download+embed in batch

And here ist the only negative point:
- the script has to run everytime you want to have coverarts while playing music via bluetooth.

At this moment i cannot provide how to put the python script in the autostart because I haven't dealt with it yet.

Big thanks goes to ChatGPT :-D
Attachments
coverarts.zip
(12.92 KiB) Downloaded 81 times
20250823_01h51m46s_grim.png
20250823_01h51m46s_grim.png (106.37 KiB) Viewed 670 times
Last edited by noobychris on Sun Aug 24, 2025 3:07 am, edited 2 times in total.
alex124.rh
Posts: 125
Joined: Thu Jul 31, 2025 9:18 am

Re: Bluetooth Coverart downloader

Post by alex124.rh »

That’s amazing thank you. Does the next update from Hudiy include the BlueZ update so we can pull cover art from bluetooth for those of us offline all the time.
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: Bluetooth Coverart downloader

Post by hudiy »

alex124.rh wrote: Sat Aug 23, 2025 12:03 pm That’s amazing thank you. Does the next update from Hudiy include the BlueZ update so we can pull cover art from bluetooth for those of us offline all the time.
Raspberry Pi OS Trixie is now in the beta phase. We’ll soon explore BlueZ’s capabilities on Trixie and check whether album art retrieval works. If it does, it will definitely be included in the Hudiy port for Trixie.
alex124.rh
Posts: 125
Joined: Thu Jul 31, 2025 9:18 am

Re: Bluetooth Coverart downloader

Post by alex124.rh »

I remember you mentioned you would try and compile the newest blueZ in the next hudiy release. If this is no longer the case can you assist with me compiling this myself so I can get it working in the meantime. That would be much appreciated. Thank you
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: Bluetooth Coverart downloader

Post by hudiy »

alex124.rh wrote: Sat Aug 23, 2025 5:35 pm I remember you mentioned you would try and compile the newest blueZ in the next hudiy release. If this is no longer the case can you assist with me compiling this myself so I can get it working in the meantime. That would be much appreciated. Thank you
We’ve checked, and unfortunately, the latest BlueZ won’t compile on Bookworm easily, as it requires many other dependencies in newer versions than those provided by apt on Bookworm. Even with the latest BlueZ, Hudiy still needs to implement functionality to query and retrieve album art from the phone. Trixie will likely leave the beta phase later this year, so the simplest approach is to wait. From what we can see, Trixie comes with BlueZ 5.82, and the album art support was introduced in 5.79.
Post Reply