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

Support for Turntable.fm's New Features #211

Closed ghost closed 11 years ago

ghost commented 11 years ago

I finally got Git working again so here's a pull request that has support for Turntable.fm's new features.

A: Get Fan Info B: Get Fan Of Info

alaingilbert commented 11 years ago

Did you test it ?

ghost commented 11 years ago

no, this is the code that I got from Issue #210

alaingilbert commented 11 years ago

It's not even close to look like coffeescript code.

technobly commented 11 years ago

It's not even close to being correct. Please stop. Do not attempt to patch the TTAPI, thank you, drive through...

technobly commented 11 years ago

@alaingilbert what do you use to compile your coffeescript code?

alaingilbert commented 11 years ago

I use coffee-script. In order to contribute, follow the steps:

npm install will install coffee-script make will compile the src/ folder to lib/

When I want to test, this is what I do :

dev.coffee

repl = require('repl')
Bot = require('./Turntable-API/src/bot').Bot
bot = new Bot 'xxx', 'xxx', 'xxx'
bot.debug = true
repl.start('> ').context.bot = bot

prod.coffee

repl = require('repl')
Bot = require('./Turntable-API/lib/bot').Bot
bot = new Bot 'xxx', 'xxx', 'xxx'
bot.debug = true
repl.start('> ').context.bot = bot

And my architecture looks like :

|-- dev.coffee
|-- prod.coffee
|-- Turntable-API
    |-- Makefile
    |-- src
    |-- lib
    |-- ...

Basically, dev.coffee will let you work with the coffee-script ttapi and prod.coffee will use the compiled sources. (If you want to make sure everything still work when compiled)

alaingilbert commented 11 years ago

If you want to execute your bot in coffeescript...

npm install -g coffee-script then: coffee dev.coffee

That's it... you're not obligated to compile the sources...

technobly commented 11 years ago

Cool thank you @alaingilbert! I'll try that out tonight. FYI you have some id info you might want to remove ^

I guess the npm install when run in your local directory, figures out what needs to be installed locally. In this case the coffee-script compiler. ...and the npm install -g coffee-script installs it so you can run it in any directory ( -g = global ). Good to know. https://npmjs.org/doc/install.html

omgyeti commented 11 years ago

@Turntablelover The code I posted was from the tt.fm JS. It will not work, it is not even coffee script o_0

technobly commented 11 years ago

@alaingilbert btw make wasn't working for me, probably because I'm using git bash on a windows machine. I had to use coffee -c bot.coffee in the src directory to compile the bot.coffee to bot.js for testing purposes. Doing it this way obviously puts the compiled output in the src directory, but it's pretty easy to copy it to the right place for testing.

alaingilbert commented 11 years ago

@DubbyTT if make doesn't work, you can compile the sources with : ./node_modules/.bin/coffee -pc src/bot.coffee > lib/bot.js

Anyway, I'll probably change the makefile for a cakefile. so it'll work on windows too.