Kodi Community Forum

Full Version: Hubot XBMC Script - Help Needed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
First off I would like to apologize if this post sounds like I'm trying to get someone to do the hard work for me, its nothing like that but the amount of documentation on hubot, and hubot scripts is very limited and looking at previously written hubot scripts has only gotten me so far. I'm new to CoffeeScript, and haven't done much coding outside of HTML, CSS & a small amount of JavaScript (mostly within the jQuery realm). I'm trying to write a script for hubot that will allow me control XBMC (mostly just for music) What I've gathered so far is that I first off need to define the name of XBMC running, as well as the IP Address of the XBMC.

Code:
# Description
#   Control XBMC Music from Hubot
#
# Dependencies:
#   None
#
# Configuration:
#   HUBOT_XBMC_NAME
#    HUBOT_XBMC_URL
#
# Commands:
#   hubot play - starts playing music
#    hubot play next - plays the next song
#   hubot what's playing - Returns the title of the current song
#    hubot play <artist> - Querys for artist and plays it
#    hubot play <album> - Querys for album and plays it
#    hubot play <song> - Querys for song and plays it
#    hubot where's server - Returns the IP/Web Address of the current XBMC location
#    hubot volume? - Returns current volume
#    hubot volume [0-100] - Sets the volume
#    hubot shutup - Mutes the music.
#
# Notes:
#   None
#
# Author:
#   eriley


xbmc =
    name = "#{process.env.HUBOT_XBMC_NAME}"
    url  = "#{process.env.HUBOT_XBMC_URL}"

module.exports = (robot) ->
    robot.respond /play (.*)/i, (message) ->

    robot.respond /play next/i, (message) ->

    robot.respond /what'?s playing/i, (message) ->
    
    robot.respond /volume ([+-])?(.*)/i, (message) ->


After this though, my lack of knowledge in CoffeeScript/JavaScript and JSON API along with the lack of already written scripts that are passing params through JSON leave me lost. Can anybody help me with this?

Again, not looking for someone to write it for me, but some help would be greatly appreciated, this is definitely something I want to learn.

I'm also not sure if this is the write forum, I apologize for that.