bohning / usdb_syncer

MIT License
74 stars 10 forks source link

Use fanart.tv API to query cover/background if song has no meta-tags #50

Open bohning opened 1 year ago

bohning commented 1 year ago

Not sure if this is possible, but maybe fanart.tv could be queried automatically for missing cover/background artwork.

https://fanarttv.docs.apiary.io/#

randompersona1 commented 2 months ago

As far as I can tell, the fanart api does not support searching and is quite basic anyways. Besides, I have no idea how we would even choose an image from a particular artist.

Instead, I propose merging this issue with #56 and using musicbrains api: https://musicbrainz.org/doc/MusicBrainz_API. It could supply the album cover image (not perfect, but far better than nothing), the release date, the language, and the genre of the song, as well as tons of information for potential future use. A python wrapper for the api already exists that implements rate limiting fairly elegantly, as musicbrainz is quite strict about that: https://musicbrainz.org/doc/MusicBrainz_API/Rate_Limiting. From my initial testing, the wrapper works perfectly, and while downloading cover images is a bit slow, as it uses the internet archive, but usable for the fallback cases where this would be used. Here's a tiny example: https://gist.github.com/randompersona1/955928e3fe10d5fe420dd8ca948954b2

The hardest part would probably be finding the song in the first place, because we might need to filter strings like "(Album Version)" or "(Live Edition)" as not to confuse the search. Since their database is so comprehensive, there are also often several artists or songs with the same name (e.g. three Adele's), further complicating this.

Unfortunately, I don't see any way of getting a background for a given song with any service.

also refers to #20

randompersona1 commented 2 months ago

Ah, this is a problem - we can't have multithreaded api requests, as that could put us over the allowed api limit. That could make the implementation tricky

bohning commented 2 months ago

In the meantime, pretty much all songs contain metatags, so I'd say this is not worth the effort.

randompersona1 commented 2 months ago

Not genre though - there are currently 13000 songs without. tbf, it doesn't make sense for all of them, but a good chunk of those is just missing one. And there's ~1000 songs without a release date

bohning commented 2 months ago

Agreed, harmonizing #GENRE by lookup (be it musicbrainz or something else) would be a great improvement (not only for those missing #GENRE, but also to verify/supplement/correct existing #GENRE tags), the same goes for the release year.