Song matching tiebreaker using position in results
Requested Feature
Currently in the song matching when it comes to a tie, the winner is decided by views.
Example:
When Searching for this song: https://open.spotify.com/intl-de/track/2siKpBqjCCIsOFf5L4AqoR
The searched song is the single version, which most people will have saved, there is also the album on spotify: https://open.spotify.com/intl-de/track/3rDLhn6T1W0BPSyibS7k1L
Spotdl will normally find this result: https://music.youtube.com/watch?v=DMRDjzkVBhE
that is a completely different song
This song (the correct one) scores about 0.1 points higher: https://music.youtube.com/watch?v=IhhbVAj8zO4
Tiebreak
So it comes to a tiebreak, because a winner needs to have an advantage of 8 points.
The problem now is that there is still the single version of the song that has most of the views on youtube: https://music.youtube.com/watch?v=c8oETzAPxCA
That leads to the wrong song with a lot of views winning over the correct song with very few views, because as the album version it has much fewer views.
Solution
In most cases, at least in this case, the correct result is the number one result returned from youtube. So my proposal is to use the ranking from youtube as the tiebreaker. I could also imagine using the rank in the score, but using it as the tiebreaker needs less intrusion in the code
Possible implementation
I have already tested it locally.
The Result gets a variable result_position, that gets filled in the audio provider.
My simple solution was to replace line 384 in base.py with this:
Old: return max(weighted_results, key=lambda x: x[1])
New: return min(best_results, key=lambda x: x[0].result_position)[0], 1000
Source: spotDL/spotify-downloader