alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
317 stars 97 forks source link

Song Info #182

Closed ghost closed 11 years ago

ghost commented 11 years ago

How do you make the bot say info about the song that is currently being played on the DJ Stage.

I am talking about him saying what the song name is, the artist, the album, and the genre.

alaingilbert commented 11 years ago

You get all these informations when you enter the room. And you receive all the update when a new song start. So you can keep the current song informations in memory (in some variables).

See "on('roomChanged')" and "on('newsong')"

alaingilbert commented 11 years ago

(Sorry, I closed the issue accidentally)

ghost commented 11 years ago

but, how do you do it in code format.

alaingilbert commented 11 years ago

Also, you can ask to get the informations of the room with : "bot.roomInfo(callback);"

ghost commented 11 years ago

ok, I want to know how to code it for my bot.

alaingilbert commented 11 years ago
bot = new Bot...;
bot.on('roomChanged', function(data) {
  console.log('The current song is: ' + data.room.metadata.current_song.metadata.song);
  console.log('From the album: ' + data.room.metadata.current_song.metadata.album);
});
ghost commented 11 years ago

ok, thank you so much. your the best.