The easiest way to get the currently playing song is to make a 'get' call on the user key with lastSongPlayed and lastSongPlayTime as extras. For example my user key is 's13' so:
get keys=s13 extras=lastSongPlayed,lastSongPlayTime
returns:{
"s13": { "firstName": "Ian", "baseIcon": "user/d/0/0/000000000000000d/square-100.jpg", "gender": "m", "url": "/people/ian/", "lastSongPlayed": { "baseIcon": "album/2/a/8/000000000008c8a2/square-200.jpg", "canDownloadAlbumOnly": false, "artistUrl": "/artist/Kanye_West/", "duration": 280, "album": "My Beautiful Dark Twisted Fantasy", "isClean": false, "albumUrl": "/artist/Kanye_West/album/My_Beautiful_Dark_Twisted_Fantasy/", "shortUrl": "http://rd.io/x/QisrZVY", "albumArtist": "Kanye West", "canStream": true, "embedUrl": "http://rd.io/e/QisrZVY", "type": "t", "price": "None", "trackNum": 1, "albumArtistKey": "r20227", "key": "t6896149", "icon": "http://media.rd.io/album/2/a/8/000000000008c8a2/square-200.jpg", "canSample": true, "name": "Dark Fantasy", "isExplicit": true, "artist": "Kanye West", "url": "/artist/Kanye_West/album/My_Beautiful_Dark_Twisted_Fantasy/track/Dark_Fantasy/", "albumKey": "a575650", "artistKey": "r20227", "canDownload": false, "length": 1, "canTether": true }, "k
ey": "s13", "lastName": "McKellar", "libraryVersion": 8679, "lastSongPlayTime": "2011-05-27T18:27:12", "type": "s", "icon": "http://media.rd.io/user/d/0/0/000000000000000d/square-100.jpg" } }
If you compare lastSongPlayTime with the current time (GMT) and the lastSongPlayed duration you'll see if the song is currently playing. Of course this won't take into account me stopping the track half-way through, but it's a pretty good approximation.
If you don't know the user key you can use currentUser or findUser. I just noticed that findUser doesn't have an 'extras' argument. I'll work on fixing that.
Have a play with the API console http://rdioconsole.appspot.com/ to try making these calls interactively.
Ian
--
Ian McKellar
Rdio Inc.
On Thursday, May 26, 2011 at 8:37 PM, Stefan Arentz wrote:
> I want to make a little dashboard that shows what song a user
> currently is playing. Is there an API for that?
>
> --
> You received this message because you are subscribed to the Google Groups "Rdio API" group.
> To post to this group, send email to rdio...@googlegroups.com.
> To unsubscribe from this group, send email to rdio-api+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rdio-api?hl=en.
>
Twice a minute for a single call translates to more than 2,000 calls a day. Well under the limit, but if you're making multiple calls or doing this for multiple users, you would run out of your quota pretty quickly.
andy
Ian
--
Ian McKellar
Rdio Inc.
On Sunday, May 29, 2011 at 4:06 PM, Andy Soell wrote:
> You're allowed 10 API calls pet second, or 15,000 in a day. If you log in to developer.rdio.com (http://developer.rdio.com) you can see updates on your current and historical API usage.
>
> Twice a minute for a single call translates to more than 2,000 calls a day. Well under the limit, but if you're making multiple calls or doing this for multiple users, you would run out of your quota pretty quickly.
>
> andy
>
> On May 29, 2011, at 6:49 PM, Stefan Arentz <stefan...@gmail.com (mailto:stefan...@gmail.com)> wrote:
>
> >
> >
> > On May 27, 2:33 pm, Ian McKellar <ian.mckel...@rd.io (http://rd.io)> wrote:
> > > Hi Stefan,
> > >
> > > The easiest way to get the currently playing song is to make a 'get' call on the user key with lastSongPlayed and lastSongPlayTime as extras.
> >
> > Thanks Ian that helps a lot. Can I poll this every 30 seconds? I could
> > not find any details on API rate limiting or quota on calls.
> >
> > S.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Rdio API" group.
> > To post to this group, send email to rdio...@googlegroups.com (mailto:rdio...@googlegroups.com).
> > To unsubscribe from this group, send email to rdio-api+u...@googlegroups.com (mailto:rdio-api+u...@googlegroups.com).
> > For more options, visit this group at http://groups.google.com/group/rdio-api?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Rdio API" group.
> To post to this group, send email to rdio...@googlegroups.com (mailto:rdio...@googlegroups.com).
> To unsubscribe from this group, send email to rdio-api+u...@googlegroups.com (mailto:rdio-api+u...@googlegroups.com).