|
|
|
|
@ -117,9 +117,43 @@ server.get('/seek/:time', function (req, res, next) {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.get('/seekPercent/:percent', function (req, res, next) {
|
|
|
|
|
log.info("seekpercent "+req.params.percent);
|
|
|
|
|
writeCommand("seek", [req.params.percent, "absolute-percent"])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
}, function(reason) {
|
|
|
|
|
res.send({"success":false, "reason": reason});
|
|
|
|
|
return next(false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.get('/seekChapter/:where', function (req, res, next) {
|
|
|
|
|
log.info("seekChapter "+req.params.where);
|
|
|
|
|
writeCommand("add", ["chapter", req.params.where])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
}, function(reason) {
|
|
|
|
|
res.send({"success":false, "reason": reason});
|
|
|
|
|
return next(false);
|
|
|
|
|
});
|
|
|
|
|
});server.get('/volume/:amount', function (req, res, next) {
|
|
|
|
|
log.info("volume "+req.params.amount);
|
|
|
|
|
writeCommand("add", ["volume", req.params.amount])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
}, function(reason) {
|
|
|
|
|
res.send({"success":false, "reason": reason});
|
|
|
|
|
return next(false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.get('/volume/:amount', function (req, res, next) {
|
|
|
|
|
log.info("volume "+req.params.amount);
|
|
|
|
|
writeCommand("", [req.params.amount])
|
|
|
|
|
writeCommand("add", ["volume", req.params.amount])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
@ -129,6 +163,29 @@ server.get('/volume/:amount', function (req, res, next) {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.get('/playpause', function (req, res, next) {
|
|
|
|
|
log.info("playpause ");
|
|
|
|
|
writeCommand("cycle", ["pause"])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
}, function(reason) {
|
|
|
|
|
res.send({"success":false, "reason": reason});
|
|
|
|
|
return next(false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.get('/muteunmute', function (req, res, next) {
|
|
|
|
|
log.info("muteunmute ");
|
|
|
|
|
writeCommand("cycle", ["mute"])
|
|
|
|
|
.then(function() {
|
|
|
|
|
res.send({"success":true});
|
|
|
|
|
return next(false);
|
|
|
|
|
}, function(reason) {
|
|
|
|
|
res.send({"success":false, "reason": reason});
|
|
|
|
|
return next(false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
server.listen(8080, function() {
|
|
|
|
|
console.log('%s listening at %s', server.name, server.url);
|
|
|
|
|
|