I have added a new Track object in a serializers.py file in order to keep the matching code decoupled from GPM/Spotify, as well as not adding any additional coupling with my modifications of the google/spotify api files. Both these two files are still as generic as before, but the search_gm_track function in app.py now serializes the tracks it gets back from GPM and finds the best match by using a new util function.
The tracks are matched based on artist name first, then based on track name. This means that a track named "Best Song (Ft. Me)" by artist "Dave" will be matched to a song on GPM like "Best Song - Ft Me" by "Dave", instead of a different artist who has a track with a name that more closely matches the original.
I have also added tests to make sure the functionality works as expected.
This Pull Request increases the accuracy of track matches, and addresses issue https://github.com/rckclmbr/pyportify/issues/76
I have added a new
Track
object in aserializers.py
file in order to keep the matching code decoupled from GPM/Spotify, as well as not adding any additional coupling with my modifications of the google/spotify api files. Both these two files are still as generic as before, but thesearch_gm_track
function inapp.py
now serializes the tracks it gets back from GPM and finds the best match by using a new util function.The tracks are matched based on artist name first, then based on track name. This means that a track named "Best Song (Ft. Me)" by artist "Dave" will be matched to a song on GPM like "Best Song - Ft Me" by "Dave", instead of a different artist who has a track with a name that more closely matches the original.
I have also added tests to make sure the functionality works as expected.