Re: Ratings and throttling
Joe Martinez <[email protected]> Fri, 20 Feb 2015 10:01:24 -0800
| Newsgroups | gmane.comp.audio.musicbrainz.devel |
|---|---|
| Message-ID | <CAD0McPra5TCqF9vDN1CgofNtcn0L_daH4-LQGihw6M_0b8JcNQ@mail.gmail.com> |
Ian, Thanks for the suggestion. I went ahead and implemented it using release requests, and it is working quite well. It still takes maybe 15-20 minutes to get through all of my collection (about 3,800 songs), and it gets slower as time goes on, as the randomness hits the larger releases early in the process, and there are mostly singletons left at the end. But, I can start using the data pretty much right away, and only play songs that it has cached the ratings for. It still would be great to just query all of my ratings directly, but this will do for now. -Joe On Mon, Feb 16, 2015 at 6:37 PM, Ian McEwen <[email protected]> wrote: > On Mon, Feb 16, 2015 at 09:10:51AM -0800, Joe Martinez wrote: > > 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? > > > > The only thing I can think of offhand is that you can get recording > ratings via release requests and via recording browse requests, e.g. by > artist. So if you have release tags and artist tags you may be able to > get ratings for all recordings at once (or, in the case of browse > requests, up to 100 at once via the limit parameter). > > I don't think there's a straightforward "get all ratings by X user", but > this might help you some, anyway. > > > -Joe > > > _______________________________________________ > > MusicBrainz-devel mailing list > > [email protected] > > http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel > > > _______________________________________________ > MusicBrainz-devel mailing list > [email protected] > http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel > _______________________________________________ MusicBrainz-devel mailing list [email protected] http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel