From 4b6be0cc4ba7768450090d2bbd5e1d4231366735 Mon Sep 17 00:00:00 2001 From: Jake Jarrett Date: Sun, 18 Sep 2016 12:39:28 +1000 Subject: [PATCH 1/3] Catch errors outside of mprisService This prevents the app from throwing exceptions when mpris functions are not defined. --- app/public/js/common/playerService.js | 6 +++--- app/public/js/player/playerCtrl.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/public/js/common/playerService.js b/app/public/js/common/playerService.js index f2a5a403..3a9b7c97 100644 --- a/app/public/js/common/playerService.js +++ b/app/public/js/common/playerService.js @@ -185,7 +185,7 @@ app.factory('playerService', function( document.querySelector('.player_favorite').classList.remove('active'); // mpris only supports linux - if(process.platform === "linux") { + if(process.platform === "linux" && mprisService) { // tell mpris that we're now playing & send off the attributes for dbus to use. mprisService.play("0", duration, trackObj.songThumbnail, trackObj.songTitle, trackObj.songUser); } @@ -212,7 +212,7 @@ app.factory('playerService', function( /** * linux mpris passthrough for media keys & desktop integration */ - if(process.platform === "linux") { + if(process.platform === "linux" && mprisService) { mprisService.play("0", duration, player.elThumb.src, player.elTitle.innerHTML, player.elUser.innerHTML); } }; @@ -228,7 +228,7 @@ app.factory('playerService', function( /** * linux mpris passthrough for media keys & desktop integration */ - if(process.platform === "linux") { + if(process.platform === "linux" && mprisService) { mprisService.pause(); } }; diff --git a/app/public/js/player/playerCtrl.js b/app/public/js/player/playerCtrl.js index 6e8790ed..d55f5119 100644 --- a/app/public/js/player/playerCtrl.js +++ b/app/public/js/player/playerCtrl.js @@ -226,7 +226,7 @@ app.controller('PlayerCtrl', function ( /** * Add native media shortcuts for linux based systems */ - if(process.platform === "linux") { + if(process.platform === "linux" && mprisService) { // Set a default state mprisService.playbackStatus = mprisService.playbackStatus || "Stopped"; From 7e193d8cfefc06f54d401d772121df226a1f8874 Mon Sep 17 00:00:00 2001 From: Jake Jarrett Date: Sun, 18 Sep 2016 12:41:44 +1000 Subject: [PATCH 2/3] Remove mpris build from shell.js Going to approach mpris support without building modules --- tasks/shell.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tasks/shell.js b/tasks/shell.js index 022897d8..33942379 100644 --- a/tasks/shell.js +++ b/tasks/shell.js @@ -4,11 +4,7 @@ module.exports = { }, target: { command: function() { - if("linux" === process.platform) { - return 'webpack -p && export PYTHON=/usr/bin/python2 && cd ./node_modules/mpris-service/node_modules/dbus && nw-gyp rebuild --target=0.12.3'; - } else { - return 'webpack -p'; - } + return 'webpack -p'; } } }; From b377178e4c3865133f930b8aa22327ee297825eb Mon Sep 17 00:00:00 2001 From: Jake Jarrett Date: Sat, 24 Sep 2016 11:32:42 +1000 Subject: [PATCH 3/3] Remove dbus from dependencies This prevents npm install from failing / causing issues --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 3eb4b0c8..58b3f47b 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,6 @@ "time-grunt": "^1.2.2", "webpack": "^1.12.2" }, - "optionalDependencies": { - "dbus": "MarshallOfSound/node-dbus#linux-only", - "mpris-service": "MarshallOfSound/mpris-service" - }, "dependencies": { "react": "^0.14.2", "react-dom": "^0.14.2",