From 641161a912530682869c540e08d46ced7db1717b Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Mon, 30 Sep 2019 10:31:20 -0400 Subject: [PATCH] Bug Fixes to improve debugging. --- client/index.js | 10 ---------- extension-firefox/content.js | 17 +++++++++++------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/client/index.js b/client/index.js index f74088c..3e2c391 100644 --- a/client/index.js +++ b/client/index.js @@ -118,16 +118,6 @@ UI.init = function () { electron.ipcRenderer.on('extension-connect', (event) => { UI.onExtensionConnect(); }); electron.ipcRenderer.on('extension-disconnect', (event) => { UI.onExtensionDisconnect(); }); - - let restartButton = document.getElementById('restart'); - let skipButton = document.getElementById('skip'); - - restartButton.addEventListener('click', (event) => { - electron.ipcRenderer.send('restart-song'); - }); - skipButton.addEventListener('click', (event) => { - electron.ipcRenderer.send('skip-song'); - }); } document.addEventListener('DOMContentLoaded', UI.init); diff --git a/extension-firefox/content.js b/extension-firefox/content.js index c581c6c..0fa9b3c 100644 --- a/extension-firefox/content.js +++ b/extension-firefox/content.js @@ -59,10 +59,14 @@ function checkSong() { artists.push(artistElement.innerText); } - let albumArtLinkStyle = albumArtElement.getAttribute('style'); - albumArtLink = albumArtLinkStyle.substring('background-image: url("'.length, albumArtLinkStyle.length - '");'.length); + let albumArtStyle = albumArtElement.getAttribute('style'); + + albumArt = albumArtStyle.substring('background-image: url("'.length, albumArtStyle.length - '");'.length); if (name != song.name || artists.join(', ') != song.artists.join(', ')) { + console.log('name: ' + name); + console.log('artists: ' + artists.join(', ')); + console.log('album art style: ' + albumArtStyle); // new song song = { guid: uuidv4(), @@ -70,7 +74,7 @@ function checkSong() { artists: artists, album: { name: 'Unknown Album', - art: albumArtLink + art: albumArt } }; console.log('new song', song); @@ -91,12 +95,13 @@ function checkSong() { let albumName = albumNameElement ? albumNameElement.getAttribute('title') : 'Unknown Album'; - let albumArtFullLinkStyle = albumArtFullElement.getAttribute('style'); - let albumArtFullLink = albumArtLinkStyle.substring('background-image: url("'.length, albumArtFullLinkStyle.length - 3); + let albumArtFullStyle = albumArtFullElement.getAttribute('style'); + console.log('album art full style: ' + albumArtFullStyle); + let albumArtFull = albumArtFullStyle.substring('background-image: url("'.length, albumArtFullStyle.length - 3); song.duration = duration; song.album.name = albumName; - song.album.artFull = albumArtFullLink; + song.album.artFull = albumArtFull; onUpdateSong(song); }, 5000); // give 5 seconds to load