var express = require('express');
var router = express.Router();

var _ = require('lodash');
var request = require('request');

router.get('/quit', function(req, res) {
    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "Application.Quit"}', function(err, data) {
        if (err) {
            console.log(err);
            res.sendStatus(500);
            return;
        }
        res.sendStatus(200);
    });
});

router.get('/pause', function(req, res) {
    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "Player.PlayPause", "params": { "playerid": 1 }}', function(err, data) {
        if (err) {
            console.log(err);
            res.sendStatus(500);
            return;
        }
        res.sendStatus(200);
    });
});

module.exports = router;

@@ -117,24 +117,1861 @@
 request');%0A%0A
+router.get('/select', function(req, res) %7B%0A    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request=%7B%22jsonrpc%22: %222.0%22, %22id%22: 1, %22method%22: %22Input.Select%22%7D', function(err, data) %7B%0A        if (err) %7B%0A            console.log(err);%0A            res.sendStatus(500);%0A            return;%0A        %7D%0A        res.sendStatus(200);%0A    %7D);%0A%7D);%0A%0Arouter.get('/right', function(req, res) %7B%0A    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request=%7B%22jsonrpc%22: %222.0%22, %22id%22: 1, %22method%22: %22Input.Right%22%7D', function(err, data) %7B%0A        if (err) %7B%0A            console.log(err);%0A            res.sendStatus(500);%0A            return;%0A        %7D%0A        res.sendStatus(200);%0A    %7D);%0A%7D);%0A%0Arouter.get('/left', function(req, res) %7B%0A    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request=%7B%22jsonrpc%22: %222.0%22, %22id%22: 1, %22method%22: %22Input.Left%22%7D', function(err, data) %7B%0A        if (err) %7B%0A            console.log(err);%0A            res.sendStatus(500);%0A            return;%0A        %7D%0A        res.sendStatus(200);%0A    %7D);%0A%7D);%0A%0Arouter.get('/down', function(req, res) %7B%0A    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request=%7B%22jsonrpc%22: %222.0%22, %22id%22: 1, %22method%22: %22Input.Down%22%7D', function(err, data) %7B%0A        if (err) %7B%0A            console.log(err);%0A            res.sendStatus(500);%0A            return;%0A        %7D%0A        res.sendStatus(200);%0A    %7D);%0A%7D);%0A%0Arouter.get('/up', function(req, res) %7B%0A    request('http://' + process.env.XBMC_HOST + ':' + process.env.XBMC_PORT + '/jsonrpc?request=%7B%22jsonrpc%22: %222.0%22, %22id%22: 1, %22method%22: %22Input.Up%22%7D', function(err, data) %7B%0A        if (err) %7B%0A            console.log(err);%0A            res.sendStatus(500);%0A            return;%0A        %7D%0A        res.sendStatus(200);%0A    %7D);%0A%7D);%0A%0A
 router.get('

add updownleftright select controls