Skip to content
Browse files

media functions that correspond to the ones added in sbutils commit 7…

…2325a5

(I couldn't compile the sbutils so sbmedia isn't updated)
  • Loading branch information...
1 parent 486596d commit 49ab931abdd09e716731e785d2f952e422d4647b @kirb kirb committed Feb 13, 2012
Showing with 63 additions and 12 deletions.
  1. +63 −12 lib/media.js
View
75 lib/media.js
@@ -8,30 +8,81 @@ var join = require('path').join;
var media = {};
media.toggle = function(cb){
- exec(join(__dirname, '..', 'compiled','sbmedia')+" -t", function (error, stdout, stderr) {
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -t", function (error, stdout, stderr) {
if(cb){
- //callback
- cb(error);
+ //callback
+ cb(error);
}
- });
+ });
}
media.prev = function(cb){
- exec(join(__dirname, '..', 'compiled','sbmedia')+" -p", function (error, stdout, stderr) {
- if(cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -p", function (error, stdout, stderr) {
+ if(cb){
//callback
- cb(error);
+ cb(error);
}
- });
+ });
}
media.next = function(cb){
- exec(join(__dirname, '..', 'compiled','sbmedia')+" -n", function (error, stdout, stderr) {
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -n", function (error, stdout, stderr) {
if(cb){
- //callback
- cb(error);
+ //callback
+ cb(error);
}
- });
+ });
+}
+
+media.title = function(info, cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -t", function (error, stdout, stderr) {
+ //callback
+ if(stderr != ""){
+ cb(error, true);
+ }else{
+ cb(stdout, false);
+ }
+ });
+}
+
+media.artist = function(cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -a", function (error, stdout, stderr) {
+ //callback
+ if(stderr != ""){
+ cb(error, true);
+ }else{
+ cb(stdout, false);
+ }
+ });
+}
+
+media.album = function(cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -l", function (error, stdout, stderr) {
+ //callback
+ if(stderr != ""){
+ cb(error, true);
+ }else{
+ cb(stdout, false);
+ }
+ });
+}
+
+media.volumeUp = function(cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -u", function (error, stdout, stderr) {
+ if(cb){
+ //callback
+ cb(error);
+ }
+ });
+}
+
+media.volumeDown = function(cb){
+ exec(join(__dirname, '..', 'compiled','sbmedia')+" -d", function (error, stdout, stderr) {
+ if(cb){
+ //callback
+ cb(error);
+ }
+ });
}
module.exports = media;

0 comments on commit 49ab931

Please sign in to comment.
Something went wrong with that request. Please try again.