From 80f6cbf8704745d98b841f1f6de27550fbb7fec8 Mon Sep 17 00:00:00 2001 From: exttex Date: Mon, 28 Sep 2020 18:17:23 +0200 Subject: [PATCH] Bug fixes, better lyrics, sorting --- app/assets/pause.png | Bin 0 -> 370 bytes app/assets/play.png | Bin 0 -> 552 bytes app/assets/skip-next.png | Bin 0 -> 479 bytes app/assets/skip-previous.png | Bin 0 -> 524 bytes app/background.js | 55 +++++++++++- app/client/src/App.vue | 7 +- app/client/src/components/LibraryTracks.vue | 90 ++++++++++++++++---- app/client/src/components/Lyrics.vue | 14 ++- app/client/src/components/TrackTile.vue | 4 +- app/client/src/main.js | 41 +++++++-- app/package.json | 2 +- app/src/deezer.js | 2 +- app/src/integrations.js | 3 +- package.json | 2 +- 14 files changed, 186 insertions(+), 34 deletions(-) create mode 100644 app/assets/pause.png create mode 100644 app/assets/play.png create mode 100644 app/assets/skip-next.png create mode 100644 app/assets/skip-previous.png diff --git a/app/assets/pause.png b/app/assets/pause.png new file mode 100644 index 0000000000000000000000000000000000000000..53298839719c626b409736e9f2f6c6bfe6449a7a GIT binary patch literal 370 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+SzC{oH>NS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J{n@{+=$5AsP4HUf9Un;K0M;IPYJznI)sp!Oe`uKO>{$*%>ZG z=Cd0c_p@J*vi@HF{M`E*M+aZ*kb&Vty7;aH4vQ%|4*!8htCqM%l%yncptHiD0$>xGypaw~h4Z-BuF?hQAxvXNS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J@>b7+F1C978hhy}h!~*Tqr9?IAlyKue15LWUJgI%2&s?i02+ za7RSl5aV!dNY`a*y}|Fetijy4vfOOv^2X|OqW?`)JtwJnZaSXO+nmuqjiKUj>K1Qr zhCh!ak6-lL%Gk;u<6ga$ovFz00!O)r=eJR{=vwwZt`|BqgyV)hf9t z6-Y4{85kMp8d&NYS%erGTNxT!8JKAs7+4t?NUZ#E8%0BIeoAIqC2kFwUmVhb8YDqB t1m~xflqVLYGL)B>>t*I;7bhncr0V4trO$q6BL!5%;OXk;vd$@?2>=9_!4m)g literal 0 HcmV?d00001 diff --git a/app/assets/skip-next.png b/app/assets/skip-next.png new file mode 100644 index 0000000000000000000000000000000000000000..41aa1ba94abe3fa608247d64210bd245b689a402 GIT binary patch literal 479 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+SzC{oH>NS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J{n@dpunnLo)8Yy}rrEq)nG{Z{UlQ%!2$`J&LOY++}d=HltUc=O!r6qa+ZShZ@^ zE(LeN{59{wBm%bp{h?ao8c~vxSdwa$T$Bo=7>o>z40H`Fb&V`S42`V}4XlhTv<(cb z3=EzYzCVhhAvZrIGp!Q0hABGXl|T)WARB`7(@M${i&7cN%ggmL^RkPR6AM!H@{7`E Tzq647Dq`?-^>bP0l+XkK(dU~4 literal 0 HcmV?d00001 diff --git a/app/assets/skip-previous.png b/app/assets/skip-previous.png new file mode 100644 index 0000000000000000000000000000000000000000..6cad0cc5b7991784ea6c762f82d91395ae5a38c2 GIT binary patch literal 524 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmUKs7M+SzC{oH>NS%G|oWRD45dJguM!v-tY$DUh!@P+6=(yLU`z6LcLCBs@Y8vBJ&@uo z@Q5sCVBk9f!i-b3`J{n@FFjoxLo)8Yy}s9%*-@Y^vDw2zK}ogj5!0OpYlWq(+a0*K zG`KLXJHTt9q*nHV-E?o~mBTGt*N4tKxUL_h(r_4qK$5*P$C? zzjUQps{SINr&UW_BT7;dOH!?pi&B9UgOP!efv$n2u8~EEp|O>LrIo3LalB!12ss3YzWRzD=AMbN@XZ7FW1Y=%Pvk%EJ)SMFG`>N&PEET Oh{4m<&t;ucLK6V(J-6Th literal 0 HcmV?d00001 diff --git a/app/background.js b/app/background.js index f46cd55..4010d63 100644 --- a/app/background.js +++ b/app/background.js @@ -7,6 +7,7 @@ let tray; let settings; let shouldExit = false; +let playing = false; //Get path to asset function assetPath(a) { @@ -74,26 +75,38 @@ async function createWindow() { return false; }); + //Thumbnail Toolbars + setThumbarButtons(); } //Create window app.on('ready', async () => { createWindow(); - //Create tray + //Create Tray tray = new Tray(assetPath("icon-taskbar.png")); tray.on('double-click', () => win.show()); tray.on('click', () => win.show()); - //Tray menu + setTray(); +}); + +//Update tray context menu +function setTray() { const contextMenu = Menu.buildFromTemplate([ { label: 'Restore', type: 'normal', click: () => win.show() }, + playing ? { - label: 'Play/Pause', + label: 'Pause', + type: 'normal', + click: () => win.webContents.send('togglePlayback') + } + : { + label: 'Play', type: 'normal', click: () => win.webContents.send('togglePlayback') }, @@ -117,6 +130,42 @@ app.on('ready', async () => { } ]); tray.setContextMenu(contextMenu); +} + +//Update Thumbnail Toolbars (Windows) +function setThumbarButtons() { + win.setThumbarButtons([ + { + tooltip: 'Skip Previous', + icon: assetPath('skip-previous.png'), + click: () => win.webContents.send('skipPrev') + }, + //Play/Pause + playing ? + { + tooltip: 'Pause', + icon: assetPath('pause.png'), + click: () => win.webContents.send('togglePlayback') + } : + { + tooltip: 'Play', + icon: assetPath('play.png'), + click: () => win.webContents.send('togglePlayback') + }, + //Skip next + { + tooltip: 'Skip Next', + icon: assetPath('skip-next.png'), + click: () => win.webContents.send('skipNext') + }, + ]); +} + +//Playing state change from UI +ipcMain.on('playing', (event, args) => { + playing = args; + setThumbarButtons(); + setTray(); }); //Update settings from ui diff --git a/app/client/src/App.vue b/app/client/src/App.vue index 78bb1df..ecb1933 100644 --- a/app/client/src/App.vue +++ b/app/client/src/App.vue @@ -371,8 +371,8 @@ export default { }); // /search - document.addEventListener('keypress', (event) => { - if (event.keyCode != 47) return; + document.addEventListener('keypress', (e) => { + if (e.keyCode != 47) return; this.$refs.searchBar.focus(); setTimeout(() => { if (this.searchQuery.startsWith('/')) this.searchQuery = this.searchQuery.substring(1); @@ -394,6 +394,9 @@ export default { if (this.$root.audio) this.$root.audio.volume = this.volume; this.$root.volume = this.volume; }, + '$root.volume'() { + this.volume = this.$root.volume; + }, //Update position '$root.position'() { this.position = (this.$root.position / this.$root.duration()) * 100; diff --git a/app/client/src/components/LibraryTracks.vue b/app/client/src/components/LibraryTracks.vue index 682d213..1f69d44 100644 --- a/app/client/src/components/LibraryTracks.vue +++ b/app/client/src/components/LibraryTracks.vue @@ -1,19 +1,35 @@