Tech Note: Ajax and Timers and Tunes

Charles Johnsonfollow me on twitter
Fri Jul 25, 2008 at 3:52 pm PDT • Views: 205

The “Now Playing” section of our left sidebar, which is set up to show the music or other weird sounds that are currently playing in iTunes on my machine, now updates in an “almost live” fashion. With Ajax and a Javascript timer, it checks the server every 20 seconds to see if there’s been a song change, then does a fade-in effect with any new artwork and song info.

The Ajax code on the server sends back a very small JSON message if the song hasn’t changed since the last check, to keep server impact to a minimum. So far, on a Friday afternoon with traffic down a bit because everyone’s been bludgeoned into political comas by this endless week of Obamaton grandstanding, the web server doesn’t seem to be struggling at all.

On a related subject, I still get occasional email asking how to hear the music that shows up under “Now Playing.” Well, I can’t stream it here without paying absurd licensing fees through the usual suspects, of course. Anyone remember Napster? No? That’s why.

The album cover is a link to the record’s page at Amazon, though, and they usually supply some kind of preview. If the album’s available in their MP3 Store, you can listen to samples right there. So that’s better than nothing, if you’re really curious about why I’m listening to that horrible Rob Zombie album again.

Advertisement

427 comments

^ back to top ^

Name:

Pass:

Register Forgot Your Password? Re-send Confirmation (To log in, cookies must be enabled in your browser!)

Turn off ads by subscribing!
For about 33 cents a day, our subscription option turns off all advertisements at LGF!
Read more...


► LGF Headlines

  • Loading...

► Tweeted Articles

  • Loading...

► Tweeted Pages

  • Loading...

► Top 10 Comments

  • Loading...

► Bottom Comments

  • Loading...

► Recent Comments

  • Loading...

► Tools/Info

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published in our weblog, unless you request otherwise.
Tech Note:
Using the Contact Form

More Partners

Compare Electricity Prices in your area. Texas Electricity is deregulated; you have the right to choose Texas Electric Rates from among many Texas Electric Companies.

The fuad ramses of web design.

TwitterFacebook
LGF Pages
Recent Pages

Channeling Confucius
Astronomy Picture of the Day: Looking Back at an Eclipsed Earth
28 minutes ago
Views: 23 • Comments: 0
Tweets: 0 • Rating: 0

Aigle
Ha'aretz, Lost in Translation
2 hours, 45 minutes ago
Views: 83 • Comments: 3
Tweets: 0 • Rating: 0

Randall Gross
Government Employment Drops Under Obama, but Media Run With Romney Myth Anyway
4 hours, 35 minutes ago
Views: 154 • Comments: 0
Tweets: 6 • Rating: 1

researchok
French Philosopher Alain Badiou on the Real Expression of Love: 'If You Limit Yourself to Sexual Pleasure It's Narcissistic'
8 hours, 39 minutes ago
Views: 91 • Comments: 0
Tweets: 0 • Rating: 0

Haywood Jabloeme
Closing the Racial and Generational Divides
12 hours, 29 minutes ago
Views: 94 • Comments: 0
Tweets: 0 • Rating: 1

Aziz Poonawalla
I Speak for Myself: All-American
16 hours, 25 minutes ago
Views: 141 • Comments: 0
Tweets: 0 • Rating: 5

Mostly sane, most of the time.
So wake up and notice already
2 days, 11 hours ago
Views: 294 • Comments: 0
Tweets: 2 • Rating: 7

Daniel Ballard
Late Afternoon Light-Kalanchoe
3 days, 16 hours ago
Views: 271 • Comments: 0
Tweets: 0 • Rating: 5

Eclectic Infidel
City College of San Francisco Budget Update
3 days, 17 hours ago
Views: 324 • Comments: 0
Tweets: 0 • Rating: 1

MichaelJ
Apple TV Slated to Debut in December?
4 days, 22 hours ago
Views: 372 • Comments: 0
Tweets: 0 • Rating: 1

 Frank says:

I think (Abbey Road is) the best engineered, best mastered rock and roll album ever produced...except that I take exception to stereo placement. -- From "Frank Zappa talks about Faves, Raves, and composers in their g raves" - some English publication, I think. (2 & 3 from the book, "The Lives and Times of Frank Zappa and the Mothers", some Brit thing again (got it at Blue Meanie Imports in San Diego fifteen years ago.)