sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.62k stars 115 forks source link

feat: improve cover selection algorithm #516

Closed heimoshuiyu closed 2 months ago

heimoshuiyu commented 5 months ago

Hi,

Gonic is a fantastic project for local music streaming. However, I noticed that Gonic doesn't recognize some album covers. After digging into the code, I found that cover art can only be recognized if it follows certain fixed patterns. Most of my albums are downloaded from BitTorrent, so the naming of cover art varies. Here is a sample file list created by running find /data/ | grep -i -E '.png|.jpg|.jpeg|.webp|.gif ':

files.txt

To address this issue, I propose a simple but more effective way to select cover art from an album. Please check the code for details.

A docker images built on this PR is available: docker.io/heimoshuiyu/gonic:cover

sentriz commented 2 months ago

thanks! i needed this for another project (this project will provide some lower level audio metadata and related functionality for Go) I implemented it there, and used your test cases. hoep you dont mind. thanks!

https://github.com/sentriz/wrtag/blob/master/coverparse/coverparse.go