kellnerd / harmony

Music Metadata Aggregator and MusicBrainz Importer
MIT License
22 stars 6 forks source link

fix(providers): warn if GTIN lookup found multiple results for Spotify / Tidal #29

Closed phw closed 2 weeks ago

phw commented 2 weeks ago

For Spotify and Tidal show a warning with a list of URLs if a GTIN lookup found more than one match.

Adapt the existing logic already implemented in iTunes and generalize it by adding a ReleaseLookup.warnMultipleResults helper.

Notes:

This should resolve #25

phw commented 2 weeks ago

Some thoughts about this in general: In the long term it would be good if there could be some handling of multiple results. Something like this is already mentioned in the roadmap (#6) "Allow providers to return multiple releases, i.e. different variants (e.g. for Bandcamp)".

While testing I had one release that failed the lookup for iTunes due to mismatched track length. However, iTunes found multiple results and one that would have matched the tracklists from other providers was among them. I unfortunately could not find the example again in my notes, but if I do I'll post it.

For the barcode collision example 635669065024 it would also help as currently all of iTunes, Tidal and Spotify return one random result of the following two albums:

https://music.apple.com/gb/album/barcheinu/1526351623 https://music.apple.com/gb/album/ybc-iii-shabichi/376544473

No matter which one you originally wanted to lookup you most likely end up with a mixed result on Harmony.

phw commented 2 weeks ago

@kellnerd More an experiment, but what do you think about a45f324ad38ccbad9137f7a69ab9efb192f541c7 ?

kellnerd commented 2 weeks ago

While testing I had one release that failed the lookup for iTunes due to mismatched track length. However, iTunes found multiple results and one that would have matched the tracklists from other providers was among them. I unfortunately could not find the example again in my notes, but if I do I'll post it.

I have found the following example in my notes, taken from the server logs: iTunes returns two totally unrelated releases by different artists: https://harmony.pulsewidth.org.uk/release?gtin=781676664221&itunes=&region=GB&ts=1717878974 Has a different number of tracks also, so it is not your example, but interesting nevertheless.

atj commented 2 weeks ago
  • I don't know about Beatport. Maybe something similar should be done there

Just to clarify, the Beatport provider explicitly returns the first release from the search results with a matching barcode:

https://github.com/kellnerd/harmony/blob/0c9cd5f51a4fbf7cd60e08fdc94ec26f02206537/providers/Beatport/mod.ts#L106

I don't believe I've ever encountered a situation where a GTIN search has returned multiple releases, but the code will either return a single release or undefined regardless.