How do I get the 'currently playing' info?

497 views
Skip to first unread message

Stefan Arentz

unread,
May 26, 2011, 11:37:23 PM5/26/11
to Rdio API
I want to make a little dashboard that shows what song a user
currently is playing. Is there an API for that?

Ian McKellar

unread,
May 27, 2011, 2:33:11 PM5/27/11
to rdio...@googlegroups.com
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. 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.
>

Stefan Arentz

unread,
May 29, 2011, 6:49:23 PM5/29/11
to Rdio API


On May 27, 2:33 pm, Ian McKellar <ian.mckel...@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.

Andy Soell

unread,
May 29, 2011, 7:06:27 PM5/29/11
to rdio...@googlegroups.com
You're allowed 10 API calls pet second, or 15,000 in a day. If you log in to 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

Ian McKellar

unread,
Jun 17, 2011, 7:40:50 PM6/17/11
to rdio...@googlegroups.com
Actually, that's a per-user limit. So you get 15000 anonymous requests, but also 15000 requests per signed in user.

Ian

--
Ian McKellar
Rdio Inc.

http://rd.io/people/ian/

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).

Greg Crawley

unread,
Sep 15, 2012, 7:19:21 AM9/15/12
to rdio...@googlegroups.com
  Hi Ian,

 I know this is an old post, but I'm struggling to find more info about how these anonymous request counts are calculated.   Does this limit just relate only to calls to the Web API (things appearing here: http://rdioconsole.appspot.com) or does it also include the Web Playback API?  I'm assuming Anonymous calls would be any call to the API that doesn't come from an authenticated browser, is that right?

  As suggested in other threads, we plan on caching results from the Web API for 24 hours to reduce our usage.  I believe this is acceptable for your TOS, but can you please verify?  We expect to have quite a bit of user-instigated Search going on from our site, so I would hate to use up our daily limits fetching static things like Album art when searches are more unique/critical.  Is it kosher for us to create a throwdown Rdio user that we can use to re-fetch album art URLs as they expire from our cache -- thus leaving the 15k anon calls to search requests?

  thanks a lot! 
  -greg

throwdown.fm

Devin Sevilla

unread,
Sep 17, 2012, 3:20:53 PM9/17/12
to rdio...@googlegroups.com
On Sat, Sep 15, 2012 at 4:19 AM, Greg Crawley <greg.c...@gmail.com> wrote:
> Does this limit just relate only to calls to the Web API (things
> appearing here: http://rdioconsole.appspot.com) or does it also include the
> Web Playback API? I'm assuming Anonymous calls would be any call to the API
> that doesn't come from an authenticated browser, is that right?
>

The API limit counter is only triggered when you make requests to the
Web Service API ( http://api.rdio.com/1/ ) The Web Playback API
doesn't count towards your limit.


> As suggested in other threads, we plan on caching results from the Web API
> for 24 hours to reduce our usage. I believe this is acceptable for your
> TOS, but can you please verify? We expect to have quite a bit of
> user-instigated Search going on from our site, so I would hate to use up our
> daily limits fetching static things like Album art when searches are more
> unique/critical. Is it kosher for us to create a throwdown Rdio user that
> we can use to re-fetch album art URLs as they expire from our cache -- thus
> leaving the 15k anon calls to search requests?

I would rather increase your API request limit instead of you needing
to create a phantom account. The goal of the API limits is to prevent
runaway processes from disrupting Rdio. If you are getting close to
your daily limit, send us an email at develope...@rd.io and I can
increase it for you.

--
Devin Sevilla
API Engineer, Rdio Inc.
Reply all
Reply to author
Forward
0 new messages