Joe Martinez
2015-02-16 17:10:51 UTC
I am developing a music application that does the following:
1) Encourages users to rate their songs by prompting the user to rate a
song in his/her library while it's playing, if the user has not already
rated it.
2) Allows the user to choose his/her desired mix of ratings (i.e. how
frequently 5-star songs play, compared to 4-star songs, etc.), as well as
what frequency of unrated songs are chosen, when shuffling or creating auto
playlists.
I was planning on using ID3 popularimiter tags to do this directly in the
MP3 files, but I was discussing my idea with Robert Kaye awhile back, and
he recommended that I store the user ratings in MusicBrainz instead, so
that a user's ratings would be consistent across devices, and also so that
MusicBrainz could build up its aggregate rating data for the benefit of
other users.
So, I've been working on this, and #1 is working great.
The problem is that on #2, I am running into throttling issues. It
requires the application to query the user-rating of each song in the
user's library when the application starts, so that it will have that data
available to create the desired mix. I have been querying the ratings
using:
/ws/2/recording/<MBID>?inc=user-ratings
I do that query in a loop, which of course generates a lot of requests to
the server, and I quickly start getting throttling errors. If I were to
put a delay into the loop to do only 1 query per second, it would take
forever to get all the data.
So, I'm wondering if there's a better (more efficient) way to retrieve all
of a user's ratings that wouldn't cause throttling issues. Is there maybe
an endpoint that would allow me to grab all of the authenticated user's
ratings at one time (like the musicbrainz.org/user/<USERNAME>/ratings web
page, but in XML? If not, any other ideas?
-Joe
1) Encourages users to rate their songs by prompting the user to rate a
song in his/her library while it's playing, if the user has not already
rated it.
2) Allows the user to choose his/her desired mix of ratings (i.e. how
frequently 5-star songs play, compared to 4-star songs, etc.), as well as
what frequency of unrated songs are chosen, when shuffling or creating auto
playlists.
I was planning on using ID3 popularimiter tags to do this directly in the
MP3 files, but I was discussing my idea with Robert Kaye awhile back, and
he recommended that I store the user ratings in MusicBrainz instead, so
that a user's ratings would be consistent across devices, and also so that
MusicBrainz could build up its aggregate rating data for the benefit of
other users.
So, I've been working on this, and #1 is working great.
The problem is that on #2, I am running into throttling issues. It
requires the application to query the user-rating of each song in the
user's library when the application starts, so that it will have that data
available to create the desired mix. I have been querying the ratings
using:
/ws/2/recording/<MBID>?inc=user-ratings
I do that query in a loop, which of course generates a lot of requests to
the server, and I quickly start getting throttling errors. If I were to
put a delay into the loop to do only 1 query per second, it would take
forever to get all the data.
So, I'm wondering if there's a better (more efficient) way to retrieve all
of a user's ratings that wouldn't cause throttling issues. Is there maybe
an endpoint that would allow me to grab all of the authenticated user's
ratings at one time (like the musicbrainz.org/user/<USERNAME>/ratings web
page, but in XML? If not, any other ideas?
-Joe