From f9ecb197a84b519ab5fb5db151d611eacf40bbbc Mon Sep 17 00:00:00 2001 From: Matthew James Date: Sat, 14 Jan 2017 14:18:20 +0000 Subject: [PATCH] v1.0.30 quick release Quick successor to 1.0.25 which fixes refresh bug affecting sound menu indicator events Snap support added --- app.js | 3 --- dbus.js | 3 +++ package.json | 12 ++++++++---- windows/spotify/controller.js | 8 ++++++++ windows/spotify/interface.js | 6 +++--- windows/spotify/preload.js | 1 + 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app.js b/app.js index 5f5d238..a14da7b 100755 --- a/app.js +++ b/app.js @@ -101,9 +101,6 @@ App = (function(){ get VERSION(){ return electron.app.getVersion(); } - print(str){ - console.log(str); - } static get names(){ return { process: 'spotifywebplayer', diff --git a/dbus.js b/dbus.js index 7c5307a..8e8c828 100644 --- a/dbus.js +++ b/dbus.js @@ -41,6 +41,9 @@ module.exports = function(appName){ on(name, func){ this._player.on(name, func); } + removeAllListeners(){ + this._player.removeAllListeners(); + } set position(pos) { if (pos !== this.position) this._player.position = pos; } diff --git a/package.json b/package.json index 29601eb..2f795c7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "spotifywebplayer", "productName": "Spotify Web Player for Linux", - "version": "1.0.25", + "version": "1.0.30", "description": "An Electron wrapper of Spotify Web Player to increase desktop integration for a stable Spotify Player for Linux replacement", "main": "main.js", "postinstall": "install-app-deps", @@ -21,8 +21,7 @@ "**/*", "!spotifywebplayer", "!*.md", - "!*.sh", - "!libs/electron" + "!*.sh" ], "extraResources": [ "plugins/libpepflashplayer-${arch}.so" @@ -43,10 +42,15 @@ "target": [ "AppImage", "deb", - "zip" + "zip", + "snap" ] } }, + "snap": { + "confinement": "devmode", + "grade": "stable" + }, "repository": { "type": "git", "url": "git+https://github.com/electron/electron-quick-start.git" diff --git a/windows/spotify/controller.js b/windows/spotify/controller.js index 2c97a56..5ddbb1c 100755 --- a/windows/spotify/controller.js +++ b/windows/spotify/controller.js @@ -112,6 +112,8 @@ module.exports = (function() { }); if (dbus) { + this.dispose(); + dbus.mediakeys.on('Play', () => this.playPause()); dbus.mediakeys.on('Stop', () => this.stop()); dbus.mediakeys.on('Next', () => this.next()); @@ -132,6 +134,12 @@ module.exports = (function() { dbus.mpris.on('position', (track,pos) => {console.log('SetPosition not yet implemented')}); } } + dispose(){ + if(dbus){ + dbus.mediakeys.removeAllListeners(); + dbus.mpris.removeAllListeners(); + } + } pause() { if(this.status == 'Playing') this.playPause(); } diff --git a/windows/spotify/interface.js b/windows/spotify/interface.js index f3313bc..a86797b 100755 --- a/windows/spotify/interface.js +++ b/windows/spotify/interface.js @@ -30,7 +30,7 @@ module.exports = (function() { //Syncronously read a theme let loadTheme = function(name, cb){ props.getUTF8File(`${props.paths.themes}/${name}-theme.css`, (err, newcss) => { - if (err) return console.error(err); + if (err) return cb(err); CURRENT_THEME.THEME_CACHE = `/* Theme Styling */\n${newcss}`; CURRENT_THEME.THEME_NAME = name; cb(err); @@ -41,7 +41,7 @@ module.exports = (function() { constructor(){ //Load the base theme props.getUTF8File(`${__dirname}/base-theme.css`, (err, data) => { - if (err) return; + if (err) return console.error(err); CURRENT_THEME.BASETHEME_CACHE = `/* Base Theming */\n${data}`; }) //Load current theme into cache @@ -58,7 +58,7 @@ module.exports = (function() { //However, make sure to set the theme if it if (name == CURRENT_THEME.THEME_NAME || name == this.themeName) return; this.isThemeAvailable(name, (err) => { - if (err) return; + if (err) return console.error(err); props.settings.Theme = name; props.settings.save(); loadTheme(name, (err) => { diff --git a/windows/spotify/preload.js b/windows/spotify/preload.js index 8348da1..42e66b2 100644 --- a/windows/spotify/preload.js +++ b/windows/spotify/preload.js @@ -148,6 +148,7 @@ document.onreadystatechange = function(){ props.spotify.minimize(); return false; } + controller.dispose(); appMenu.toggleMenu(false); tray.toggleTray(false); };