Skip to content

Commit

Permalink
Unmute the sound on info requests
Browse files Browse the repository at this point in the history
  • Loading branch information
316k committed Sep 16, 2014
1 parent a850608 commit 065c0b8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions opt/lrc-server/lrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ app.get(/^\/(.*)/, function(req, res) {
volume = volume[0].split("[");
volume = volume[1];

var backlight = stdout.split("[on]");
backlight = backlight[1].replace(/^\s+|\s+$/g, "");
var backlight = stdout.split(/\[o(?:n|ff)\]/); // Matches [on] or [off]

// Unmute the speakers
if(stdout.indexOf("[off]") != -1) {
exec("amixer sset Master unmute");
}

backlight = backlight[backlight.length-1].trim();
backlight = backlight.split(".");
backlight = backlight[0];

res.send(req.query.callback + "({'volume':'" + volume + "', 'backlight':'" + backlight + "'})");
} else {
res.send(req.query.callback + "()");
Expand Down

0 comments on commit 065c0b8

Please sign in to comment.