|
|
|
|
@ -5,6 +5,7 @@ var FS = require("q-io/fs");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CONNECTIONS AND STUFF
|
|
|
|
|
var fifoPath = '/home/daddel9/.mpv-fifo';
|
|
|
|
|
var log = bunyan.createLogger({name: 'MpvRemote'});
|
|
|
|
|
|
|
|
|
|
// SETUP
|
|
|
|
|
@ -19,11 +20,27 @@ server.get(/\/client\/?.*/, restify.serveStatic({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mockup Methods
|
|
|
|
|
server.get('/seek/:time', function (req, res, next) {
|
|
|
|
|
log.info("Seeking "+req.params['time']+" now.");
|
|
|
|
|
res.send({'success':true});
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
// /seek/:time — seeks relative
|
|
|
|
|
// /seek/:time/:mode — seeks with mode, modes [relative|absolute|absolute-percent|relative-percent|exact|keyframes]
|
|
|
|
|
// /seek-chapter/:where — seeks to prev (where=-x) or next (where=+x) chapter
|
|
|
|
|
// /volume/:amount — increases (amount=+x) or decreases (amount=-x) volume
|
|
|
|
|
// /progress — show osd progress
|
|
|
|
|
// /playpause — toggles playing
|
|
|
|
|
// /muteunmute — toggles muting
|
|
|
|
|
|
|
|
|
|
// server.get('/seek/:time', function (req, res, next) {
|
|
|
|
|
// log.info("Seeking "+req.params['time']+" now.");
|
|
|
|
|
// return FS.write( fifoPath, '{ "command": ["seek", "10"] }\n' )
|
|
|
|
|
// .then(function () {
|
|
|
|
|
// log.info("wrote seek 10 to "+fifoPath);
|
|
|
|
|
// res.send({'success':true});
|
|
|
|
|
// return next(false);
|
|
|
|
|
// }, function(reason) {
|
|
|
|
|
// log.info("failed because "+reason);
|
|
|
|
|
// });
|
|
|
|
|
// log.info("after then");
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
server.get('/seek/:time/:mode', function (req, res, next) {
|
|
|
|
|
log.info("Seeking "+req.params['time']+" with mode "+req.params['mode']+" now.");
|
|
|
|
|
res.send({'success':true});
|
|
|
|
|
|