From 2ce93bc498dd203117d93874346a841c84816231 Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Sat, 8 Jan 2022 18:08:50 -0600 Subject: [PATCH 01/23] Small tweak to the max length of lyrics on FS mode. --- src/renderer/style.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/style.less b/src/renderer/style.less index 8524e6e3..d18c4ec8 100644 --- a/src/renderer/style.less +++ b/src/renderer/style.less @@ -3657,7 +3657,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb { .lyrics-col{ - height: 75vh; + height: 62vh; display: flex; justify-content: center; align-content: center; From 0aa402b6aad21de05449d78e81fd9e548dcd1437 Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Sat, 8 Jan 2022 18:35:17 -0600 Subject: [PATCH 02/23] Increase volume drag size FS. --- src/renderer/style.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/style.less b/src/renderer/style.less index d18c4ec8..20083c80 100644 --- a/src/renderer/style.less +++ b/src/renderer/style.less @@ -3614,8 +3614,8 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb { transform: scale(0.5); -webkit-appearance: none; appearance: none; - width: 12px; - height: 12px; + width: 23px; + height: 23px; border-radius: 100%; background: rgba(236, 234, 234, 0.733); cursor: default; From b638a2c877252f4a237db7da002e21c8febe6fbe Mon Sep 17 00:00:00 2001 From: vapormusic Date: Sun, 9 Jan 2022 11:03:25 +0700 Subject: [PATCH 03/23] some queue fix --- src/renderer/index.js | 4 +- .../views/components/mediaitem-list-item.ejs | 30 +++--- src/renderer/views/pages/cider-playlist.ejs | 93 +++++++++++++++++-- 3 files changed, 103 insertions(+), 24 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index 99760db8..f9191019 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -1194,7 +1194,7 @@ const app = new Vue({ let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? '')); ; let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false; - + let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; console.log(kind, id, isLibrary) app.mk.stop().then(() => { if (kind.includes("artist")) { @@ -1212,7 +1212,7 @@ const app = new Vue({ } } app.mk.clearQueue().then(function () { { - app.mk.setQueue({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function () { + app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { app.mk.play().then(function (){ app.mk.clearQueue().then(function (){ var playlistId = id diff --git a/src/renderer/views/components/mediaitem-list-item.ejs b/src/renderer/views/components/mediaitem-list-item.ejs index fd335e70..fb2bbdee 100644 --- a/src/renderer/views/components/mediaitem-list-item.ejs +++ b/src/renderer/views/components/mediaitem-list-item.ejs @@ -410,12 +410,12 @@ let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? '')); let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? ''));; let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false; + let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; console.log(item, parent, childIndex, kind, id, isLibrary, kind == "playlists", id.startsWith("p.") || id.startsWith("pl.u")) app.mk.stop().then(() => { if (parent != null && childIndex != null) { app.queueParentandplayChild(parent, childIndex, item); } else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ - /* Randomize array in-place using Durstenfeld shuffle algorithm */ function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); @@ -425,20 +425,20 @@ } } app.mk.clearQueue().then(function () { - app.mk.setQueue({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function () { + app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { app.mk.play().then(function (){ app.mk.clearQueue().then(function (){ var playlistId = id const params = { - include: "tracks", - platform: "web", - "include[library-playlists]": "catalog,tracks", - "fields[playlists]": "curatorName,playlistType,name,artwork,url", - "include[library-songs]": "catalog,artists,albums", - "fields[catalog]": "artistUrl,albumUrl", - "fields[songs]": "artistUrl,albumUrl" + // include: "tracks", + // platform: "web", + // "include[library-playlists]": "catalog,tracks", + // "fields[playlists]": "curatorName,playlistType,name,artwork,url", + // "include[library-songs]": "catalog,artists,albums", + // "fields[catalog]": "artistUrl,albumUrl", + // "fields[songs]": "artistUrl,albumUrl, playParams" } - var playlistId = '' + // var playlistId = '' function getPlaylist(id, params, isLibrary){ if (isLibrary){ return app.mk.api.library.playlist(id, params) @@ -448,7 +448,8 @@ getPlaylist(id, params, isLibrary).then(res => { let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} + if (app.mk.shuffleMode == 1){shuffleArray(query); } + console.log(query) app.mk.queue.append(query) if (!res.relationships.tracks.next) { return @@ -458,9 +459,10 @@ function getPlaylistTracks(next) { app.apiCall(app.musicBaseUrl + next, res => { - if (res.id != playlistId) { - return - } + // if (res.id != playlistId || next.includes(playlistId)) { + // return + // } + console.log('nextres', res) let query = res.data.map(item => new MusicKit.MediaItem(item)) if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} app.mk.queue.append(query) diff --git a/src/renderer/views/pages/cider-playlist.ejs b/src/renderer/views/pages/cider-playlist.ejs index d1af4bb9..f5db4424 100644 --- a/src/renderer/views/pages/cider-playlist.ejs +++ b/src/renderer/views/pages/cider-playlist.ejs @@ -59,11 +59,11 @@
-
+
From 08b5eef385cda7f6cfe5ba2e63973fe826146f71 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Sun, 9 Jan 2022 19:34:55 +0700 Subject: [PATCH 07/23] increase albums page image size --- src/renderer/views/pages/library-albums.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/pages/library-albums.ejs b/src/renderer/views/pages/library-albums.ejs index b38542a9..c7b6ca12 100644 --- a/src/renderer/views/pages/library-albums.ejs +++ b/src/renderer/views/pages/library-albums.ejs @@ -51,7 +51,7 @@
- +
From 06fc96d53d2cd907cbc626e5317d874a8c226125 Mon Sep 17 00:00:00 2001 From: N0chteil <53608074+N0chteil@users.noreply.github.com> Date: Sun, 9 Jan 2022 16:31:01 +0100 Subject: [PATCH 08/23] Update cider-preload.js --- src/preload/cider-preload.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index c0246916..4ca3b4cf 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -36,23 +36,29 @@ const MusicKitInterop = { const nowPlayingItem = MusicKit.getInstance().nowPlayingItem; const isPlayingExport = MusicKit.getInstance().isPlaying; const remainingTimeExport = MusicKit.getInstance().currentPlaybackTimeRemaining; - const attributes = (nowPlayingItem != null ? nowPlayingItem.attributes : {}); + const attributes = nowPlayingItem.attributes ?? {}; - attributes.status = isPlayingExport ? isPlayingExport : false; - attributes.name = attributes.name ? attributes.name : 'No Title Found'; - attributes.artwork = attributes.artwork ? attributes.artwork : {url: ''}; - attributes.artwork.url = attributes.artwork.url ? attributes.artwork.url : ''; - attributes.playParams = attributes.playParams ? attributes.playParams : {id: 'no-id-found'}; - attributes.playParams.id = attributes.playParams.id ? attributes.playParams.id : 'no-id-found'; - attributes.albumName = attributes.albumName ? attributes.albumName : ''; - attributes.artistName = attributes.artistName ? attributes.artistName : ''; - attributes.genreNames = attributes.genreNames ? attributes.genreNames : []; - attributes.remainingTime = remainingTimeExport ? (remainingTimeExport * 1000) : 0; - attributes.durationInMillis = attributes.durationInMillis ? attributes.durationInMillis : 0; + attributes.status = isPlayingExport ?? false; + attributes.name = attributes?.name ?? 'No Title Found'; + attributes.artwork = attributes?.artwork ?? { url: '' }; + attributes.artwork.url = attributes?.artwork?.url ?? ''; + attributes.playParams = attributes?.playParams ?? { id: 'no-id-found' }; + attributes.playParams.id = attributes?.playParams?.id ?? 'no-id-found'; + attributes.albumName = attributes?.albumName ?? ''; + attributes.artistName = attributes?.artistName ?? ''; + attributes.genreNames = attributes?.genreNames ?? []; + attributes.remainingTime = remainingTimeExport + ? remainingTimeExport * 1000 + : 0; + attributes.durationInMillis = attributes?.durationInMillis ?? 0; attributes.startTime = Date.now(); - attributes.endTime = Math.round((attributes.playParams.id === cache.playParams.id ? (Date.now() + attributes.remainingTime) : (attributes.startTime + attributes.durationInMillis))); - attributes.endTime = attributes.endTime ? attributes.endTime : Date.now(); - return attributes + attributes.endTime = Math.round( + attributes?.playParams?.id === cache.playParams.id + ? Date.now() + attributes?.remainingTime + : attributes?.startTime + attributes?.durationInMillis + ); + + return attributes; }, filterTrack: function (a, playbackCheck, mediaCheck) { From 905173fd0e791dd81308e90a76a15d2d8f411e28 Mon Sep 17 00:00:00 2001 From: Core Date: Sun, 9 Jan 2022 15:48:19 +0000 Subject: [PATCH 09/23] Fullscreen escape shortcut --- src/renderer/index.js | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index 26527908..489a05c4 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -363,7 +363,7 @@ const app = new Vue({ case "disabled": document.querySelector("html").style.background = "#222"; document.querySelector("body").classList.add("notransparency") - + // document.querySelector("body").style.background = "#222"; break; } @@ -393,7 +393,7 @@ const app = new Vue({ let ids = res.map(function(i) {return {id:i.id, type: i.type}}) pl_items = pl_items.concat(ids) } else if (self.selectedMediaItems[i].kind == "library-song" || self.selectedMediaItems[i].kind == "library-songs") { - self.selectedMediaItems[i].kind = "library-songs" + self.selectedMediaItems[i].kind = "library-songs" pl_items.push({ id: self.selectedMediaItems[i].id, type: self.selectedMediaItems[i].kind @@ -409,7 +409,7 @@ const app = new Vue({ type: self.selectedMediaItems[i].kind }) } - + } this.modals.addToPlaylist = false this.mk.api.library.appendTracksToPlaylist(playlist_id, pl_items).then(() => { @@ -1190,14 +1190,14 @@ const app = new Vue({ this.getArtistFromID(id) //this.getTypeFromID("artist",id,isLibrary,query) }, - playMediaItem(item) { + playMediaItem(item) { let kind = (item.attributes.playParams ? (item.attributes.playParams.kind ?? (item.type ?? '')) : (item.type ?? '')); let id = (item.attributes.playParams ? (item.attributes.playParams.id ?? (item.id ?? '')) : (item.id ?? '')); ; let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false; let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind; console.log(kind, id, isLibrary) - app.mk.stop().then(() => { + app.mk.stop().then(() => { if (kind.includes("artist")) { app.mk.setStationQueue({artist: 'a-' + id}).then(() => { app.mk.play() @@ -1252,21 +1252,21 @@ const app = new Vue({ let query = res.data.map(item => new MusicKit.MediaItem(item)) if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} app.mk.queue.append(query) - + if (res.next) { getPlaylistTracks(res.next) - } + } }) } }) } catch (e) {} - + }) }) }) } - }) + }) } else { app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ?? '') } @@ -2393,8 +2393,8 @@ const app = new Vue({ } }) }) - - }) + + }) } else{ this.mk.setQueue({[truekind]: [id]}).then(function (queue) { @@ -2682,7 +2682,7 @@ const app = new Vue({ async getCurrentArtURL(){ try{ this.currentArtUrl = ''; - if (app.mk.nowPlayingItem != null && app.mk.nowPlayingItem.attributes != null && app.mk.nowPlayingItem.attributes.artwork != null && app.mk.nowPlayingItem.attributes.artwork.url != null && app.mk.nowPlayingItem.attributes.artwork.url!= '' ) + if (app.mk.nowPlayingItem != null && app.mk.nowPlayingItem.attributes != null && app.mk.nowPlayingItem.attributes.artwork != null && app.mk.nowPlayingItem.attributes.artwork.url != null && app.mk.nowPlayingItem.attributes.artwork.url!= '' ) { this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ?? '').replace('{w}', 50).replace('{h}', 50); try{ @@ -3051,9 +3051,18 @@ const app = new Vue({ } }, fullscreen(flag){ - if (flag){ - ipcRenderer.send('setFullScreen', true); app.appMode = 'fullscreen';} - else { ipcRenderer.send('setFullScreen', false); app.appMode = 'player';} + if (flag) { + ipcRenderer.send('setFullScreen', true); + app.appMode = 'fullscreen'; + document.addEventListener('keydown', event => { + if (event.key === 'Escape' && app.appMode === 'fullscreen') { + this.fullscreen(false); + } + }); + } else { + ipcRenderer.send('setFullScreen', false); + app.appMode = 'player'; + } } } From 4a9ddd0f3ad6da26cd829e3fc519311d1014a8ac Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Sun, 9 Jan 2022 10:15:33 -0600 Subject: [PATCH 10/23] Change spinner to something a little nicer. --- .../assets/{spinner.gif => spinner-old.gif} | Bin src/renderer/assets/spinner.svg | 6 ++++++ src/renderer/style.less | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) rename src/renderer/assets/{spinner.gif => spinner-old.gif} (100%) create mode 100644 src/renderer/assets/spinner.svg diff --git a/src/renderer/assets/spinner.gif b/src/renderer/assets/spinner-old.gif similarity index 100% rename from src/renderer/assets/spinner.gif rename to src/renderer/assets/spinner-old.gif diff --git a/src/renderer/assets/spinner.svg b/src/renderer/assets/spinner.svg new file mode 100644 index 00000000..38e1f9ab --- /dev/null +++ b/src/renderer/assets/spinner.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/renderer/style.less b/src/renderer/style.less index 20083c80..078e0a62 100644 --- a/src/renderer/style.less +++ b/src/renderer/style.less @@ -654,12 +654,12 @@ input[type=range].web-slider::-webkit-slider-runnable-track { } .spinner { - background-image: url("assets/spinner.gif"); + background-image: url("assets/spinner.svg"); background-position: center; background-repeat: no-repeat; background-size: contain; - width: 32px; - height: 32px; + width: 50px; + height: 50px; display: inline-block; } From c07d650a6934094fd1bedbdd6974ce348e764f1a Mon Sep 17 00:00:00 2001 From: vapormusic Date: Sun, 9 Jan 2022 23:33:30 +0700 Subject: [PATCH 11/23] revert some queue extension tricks as MKjs does not like it --- src/renderer/index.js | 131 +++++++++--------- src/renderer/views/components/fullscreen.ejs | 17 ++- .../views/components/mediaitem-list-item.ejs | 124 +++++++++-------- src/renderer/views/pages/cider-playlist.ejs | 81 +++-------- 4 files changed, 163 insertions(+), 190 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index 489a05c4..39144597 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -1202,72 +1202,74 @@ const app = new Vue({ app.mk.setStationQueue({artist: 'a-' + id}).then(() => { app.mk.play() }) - } else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ - /* Randomize array in-place using Durstenfeld shuffle algorithm */ - function shuffleArray(array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - } - app.mk.clearQueue().then(function () { { - app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { - app.mk.play().then(function (){ - app.mk.clearQueue().then(function (){ - var playlistId = id - const params = { - include: "tracks", - platform: "web", - "include[library-playlists]": "catalog,tracks", - "fields[playlists]": "curatorName,playlistType,name,artwork,url", - "include[library-songs]": "catalog,artists,albums", - "fields[catalog]": "artistUrl,albumUrl", - "fields[songs]": "artistUrl,albumUrl" - } - var playlistId = '' + } + // else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ + // /* Randomize array in-place using Durstenfeld shuffle algorithm */ + // function shuffleArray(array) { + // for (var i = array.length - 1; i > 0; i--) { + // var j = Math.floor(Math.random() * (i + 1)); + // var temp = array[i]; + // array[i] = array[j]; + // array[j] = temp; + // } + // } + // app.mk.clearQueue().then(function () { { + // app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { + // app.mk.play().then(function (){ + // app.mk.clearQueue().then(function (){ + // var playlistId = id + // const params = { + // include: "tracks", + // platform: "web", + // "include[library-playlists]": "catalog,tracks", + // "fields[playlists]": "curatorName,playlistType,name,artwork,url", + // "include[library-songs]": "catalog,artists,albums", + // "fields[catalog]": "artistUrl,albumUrl", + // "fields[songs]": "artistUrl,albumUrl" + // } + // var playlistId = '' - try { - function getPlaylist(id, params, isLibrary){ - if (isLibrary){ - return app.mk.api.library.playlist(id, params) - } else { return app.mk.api.playlist(id, params)} - } - getPlaylist(id, params, isLibrary).then(res => { - let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} - app.mk.queue.append(query) - if (!res.relationships.tracks.next) { - return - } else { - getPlaylistTracks(res.relationships.tracks.next) - } + // try { + // function getPlaylist(id, params, isLibrary){ + // if (isLibrary){ + // return app.mk.api.library.playlist(id, params) + // } else { return app.mk.api.playlist(id, params)} + // } + // getPlaylist(id, params, isLibrary).then(res => { + // let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); + // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} + // app.mk.queue.append(query) + // if (!res.relationships.tracks.next) { + // return + // } else { + // getPlaylistTracks(res.relationships.tracks.next) + // } - function getPlaylistTracks(next) { - app.apiCall(app.musicBaseUrl + next, res => { - if (res.id != playlistId) { - return - } - let query = res.data.map(item => new MusicKit.MediaItem(item)) - if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} - app.mk.queue.append(query) + // function getPlaylistTracks(next) { + // app.apiCall(app.musicBaseUrl + next, res => { + // if (res.id != playlistId) { + // return + // } + // let query = res.data.map(item => new MusicKit.MediaItem(item)) + // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} + // app.mk.queue.append(query) - if (res.next) { - getPlaylistTracks(res.next) - } - }) - } - }) - } catch (e) {} + // if (res.next) { + // getPlaylistTracks(res.next) + // } + // }) + // } + // }) + // } catch (e) {} - }) - }) - }) - } - }) - } else { + // }) + // }) + // }) + // } + // }) + // } + else { app.playMediaItemById((id), (kind), (isLibrary), item.attributes.url ?? '') } }) @@ -2371,10 +2373,7 @@ const app = new Vue({ } }) } else { - try { - app.mk.stop() - } catch (e) { - } + app.mk.stop().then(() => { if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))){ app.mk.playNext({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function () { app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1) @@ -2412,7 +2411,7 @@ const app = new Vue({ app.mk.play() } })} - } + })} } catch (err) { console.log(err) try { diff --git a/src/renderer/views/components/fullscreen.ejs b/src/renderer/views/components/fullscreen.ejs index 4c2cfd4c..1d0a3539 100644 --- a/src/renderer/views/components/fullscreen.ejs +++ b/src/renderer/views/components/fullscreen.ejs @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/renderer/views/components/mediaitem-list-item.ejs b/src/renderer/views/components/mediaitem-list-item.ejs index fb2bbdee..409763bb 100644 --- a/src/renderer/views/components/mediaitem-list-item.ejs +++ b/src/renderer/views/components/mediaitem-list-item.ejs @@ -415,73 +415,75 @@ app.mk.stop().then(() => { if (parent != null && childIndex != null) { app.queueParentandplayChild(parent, childIndex, item); - } else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ - function shuffleArray(array) { - for (var i = array.length - 1; i > 0; i--) { - var j = Math.floor(Math.random() * (i + 1)); - var temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - } - app.mk.clearQueue().then(function () { - app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { - app.mk.play().then(function (){ - app.mk.clearQueue().then(function (){ - var playlistId = id - const params = { - // include: "tracks", - // platform: "web", - // "include[library-playlists]": "catalog,tracks", - // "fields[playlists]": "curatorName,playlistType,name,artwork,url", - // "include[library-songs]": "catalog,artists,albums", - // "fields[catalog]": "artistUrl,albumUrl", - // "fields[songs]": "artistUrl,albumUrl, playParams" - } - // var playlistId = '' - function getPlaylist(id, params, isLibrary){ - if (isLibrary){ - return app.mk.api.library.playlist(id, params) - } else { return app.mk.api.playlist(id, params)} - } - try { + } + // else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ + // function shuffleArray(array) { + // for (var i = array.length - 1; i > 0; i--) { + // var j = Math.floor(Math.random() * (i + 1)); + // var temp = array[i]; + // array[i] = array[j]; + // array[j] = temp; + // } + // } + // app.mk.clearQueue().then(function () { + // app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { + // app.mk.play().then(function (){ + // app.mk.clearQueue().then(function (){ + // var playlistId = id + // const params = { + // // include: "tracks", + // // platform: "web", + // // "include[library-playlists]": "catalog,tracks", + // // "fields[playlists]": "curatorName,playlistType,name,artwork,url", + // // "include[library-songs]": "catalog,artists,albums", + // // "fields[catalog]": "artistUrl,albumUrl", + // // "fields[songs]": "artistUrl,albumUrl, playParams" + // } + // // var playlistId = '' + // function getPlaylist(id, params, isLibrary){ + // if (isLibrary){ + // return app.mk.api.library.playlist(id, params) + // } else { return app.mk.api.playlist(id, params)} + // } + // try { - getPlaylist(id, params, isLibrary).then(res => { - let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (app.mk.shuffleMode == 1){shuffleArray(query); } - console.log(query) - app.mk.queue.append(query) - if (!res.relationships.tracks.next) { - return - } else { - getPlaylistTracks(res.relationships.tracks.next) - } + // getPlaylist(id, params, isLibrary).then(res => { + // let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); + // if (app.mk.shuffleMode == 1){shuffleArray(query); } + // console.log(query) + // app.mk.queue.append(query) + // if (!res.relationships.tracks.next) { + // return + // } else { + // getPlaylistTracks(res.relationships.tracks.next) + // } - function getPlaylistTracks(next) { - app.apiCall(app.musicBaseUrl + next, res => { - // if (res.id != playlistId || next.includes(playlistId)) { - // return - // } - console.log('nextres', res) - let query = res.data.map(item => new MusicKit.MediaItem(item)) - if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} - app.mk.queue.append(query) + // function getPlaylistTracks(next) { + // app.apiCall(app.musicBaseUrl + next, res => { + // // if (res.id != playlistId || next.includes(playlistId)) { + // // return + // // } + // console.log('nextres', res) + // let query = res.data.map(item => new MusicKit.MediaItem(item)) + // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} + // app.mk.queue.append(query) - if (res.next) { - getPlaylistTracks(res.next) - } - }) - } - }) - } catch (e) {} + // if (res.next) { + // getPlaylistTracks(res.next) + // } + // }) + // } + // }) + // } catch (e) {} - }) - }) - }) + // }) + // }) + // }) - }) - } else { + // }) + // } + else { app.playMediaItemById(item.attributes.playParams.id ?? item.id, item.attributes.playParams.kind ?? item.type, item.attributes.playParams.isLibrary ?? false, item.attributes.url) }}) } diff --git a/src/renderer/views/pages/cider-playlist.ejs b/src/renderer/views/pages/cider-playlist.ejs index 7317625f..0250a153 100644 --- a/src/renderer/views/pages/cider-playlist.ejs +++ b/src/renderer/views/pages/cider-playlist.ejs @@ -63,7 +63,7 @@ Play
- {{ (mk.nowPlayingItem["attributes"]["albumName"]) ? (" - " + - mk.nowPlayingItem["attributes"]["albumName"]) : "" }} + @click="getNowPlayingItemDetailed('album')"> +
{{"-"}}
+ {{(mk.nowPlayingItem["attributes"]["albumName"]) ? (mk.nowPlayingItem["attributes"]["albumName"]) : "" }}
From a7bb764916619a15ed12072111cccd9177cbfdab Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Sun, 9 Jan 2022 14:24:06 -0600 Subject: [PATCH 15/23] Explicit tag to non-unicode. --- src/renderer/assets/explicit.svg | 7 +++++++ src/renderer/views/components/mediaitem-square.ejs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/renderer/assets/explicit.svg diff --git a/src/renderer/assets/explicit.svg b/src/renderer/assets/explicit.svg new file mode 100644 index 00000000..0eeb5dbb --- /dev/null +++ b/src/renderer/assets/explicit.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/src/renderer/views/components/mediaitem-square.ejs b/src/renderer/views/components/mediaitem-square.ejs index f5e320d7..d71554f3 100644 --- a/src/renderer/views/components/mediaitem-square.ejs +++ b/src/renderer/views/components/mediaitem-square.ejs @@ -29,7 +29,7 @@
{{ item.attributes.name }}
-
🅴
+
From ee4d96a30c14c3efb9bab8df34f45298fd788a4a Mon Sep 17 00:00:00 2001 From: N0chteil <53608074+N0chteil@users.noreply.github.com> Date: Sun, 9 Jan 2022 21:33:56 +0100 Subject: [PATCH 16/23] Update home.ejs --- src/renderer/views/pages/home.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/pages/home.ejs b/src/renderer/views/pages/home.ejs index 7a1e2353..e2f0ded1 100644 --- a/src/renderer/views/pages/home.ejs +++ b/src/renderer/views/pages/home.ejs @@ -54,7 +54,7 @@
-
+

Friends Listening To

From 671fdebae944a8e6a9ad9e16adb5e3eb211f074e Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Sun, 9 Jan 2022 14:36:53 -0600 Subject: [PATCH 17/23] why are you up there. --- src/renderer/views/main.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/main.ejs b/src/renderer/views/main.ejs index a1284aba..21271c19 100644 --- a/src/renderer/views/main.ejs +++ b/src/renderer/views/main.ejs @@ -93,7 +93,7 @@
-
{{"-"}}
+
{{"-"}}
{{(mk.nowPlayingItem["attributes"]["albumName"]) ? (mk.nowPlayingItem["attributes"]["albumName"]) : "" }}
From 6e704c4531c7396ca595d03a6814b823430570bb Mon Sep 17 00:00:00 2001 From: vapormusic Date: Mon, 10 Jan 2022 09:50:11 +0700 Subject: [PATCH 18/23] fix queueing --- src/renderer/assets/repeat.svg | 28 ++--- src/renderer/index.js | 29 +++-- src/renderer/style.less | 4 + .../views/components/mediaitem-list-item.ejs | 110 ++++++++---------- src/renderer/views/pages/cider-playlist.ejs | 42 +++---- 5 files changed, 99 insertions(+), 114 deletions(-) diff --git a/src/renderer/assets/repeat.svg b/src/renderer/assets/repeat.svg index 0c283cf4..752848dd 100644 --- a/src/renderer/assets/repeat.svg +++ b/src/renderer/assets/repeat.svg @@ -1,18 +1,20 @@ - - - + + - - + + + + + + diff --git a/src/renderer/index.js b/src/renderer/index.js index 39144597..bdff4a06 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -2375,22 +2375,21 @@ const app = new Vue({ } else { app.mk.stop().then(() => { if (truekind == "playlists" && (id.startsWith("p.") || id.startsWith("pl.u"))){ - app.mk.playNext({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function () { - app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1) - app.mk.play().then(function(){ - app.mk.clearQueue().then(function () { - if ((app.showingPlaylist && app.showingPlaylist.id == id)) { + app.mk.setQueue({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function () { + app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1).then(function(){ + if ((app.showingPlaylist && app.showingPlaylist.id == id)) { + let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); + if (query.length > 100) { + let u = query.slice(100); if (app.mk.shuffleMode == 1) { shuffleArray(u) } + app.mk.queue.append(u)} + } else { + app.getPlaylistFromID(id, true).then(function () { let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (app.mk.shuffleMode == 1){ shuffleArray(query)} - app.mk.queue.append(query) - } else { - app.getPlaylistFromID(id, true).then(function () { - let query = app.showingPlaylist.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - if (app.mk.shuffleMode == 1){ shuffleArray(query)} - app.mk.queue.append(query) - }) - } - }) + if (query.length > 100) { + let u = query.slice(100); if (app.mk.shuffleMode == 1) { shuffleArray(u) } + app.mk.queue.append(u)} + }) + } }) }) diff --git a/src/renderer/style.less b/src/renderer/style.less index 078e0a62..bebf8bad 100644 --- a/src/renderer/style.less +++ b/src/renderer/style.less @@ -3578,6 +3578,10 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb { background-color: rgba(200, 200, 200, 0.7); } + .playback-button--small{ + opacity: 0.7; + } + .right-col{ height: 50vh; } diff --git a/src/renderer/views/components/mediaitem-list-item.ejs b/src/renderer/views/components/mediaitem-list-item.ejs index 409763bb..bd6f27fb 100644 --- a/src/renderer/views/components/mediaitem-list-item.ejs +++ b/src/renderer/views/components/mediaitem-list-item.ejs @@ -416,73 +416,61 @@ if (parent != null && childIndex != null) { app.queueParentandplayChild(parent, childIndex, item); } - // else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ - // function shuffleArray(array) { - // for (var i = array.length - 1; i > 0; i--) { - // var j = Math.floor(Math.random() * (i + 1)); - // var temp = array[i]; - // array[i] = array[j]; - // array[j] = temp; - // } - // } - // app.mk.clearQueue().then(function () { - // app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { - // app.mk.play().then(function (){ - // app.mk.clearQueue().then(function (){ - // var playlistId = id - // const params = { - // // include: "tracks", - // // platform: "web", - // // "include[library-playlists]": "catalog,tracks", - // // "fields[playlists]": "curatorName,playlistType,name,artwork,url", - // // "include[library-songs]": "catalog,artists,albums", - // // "fields[catalog]": "artistUrl,albumUrl", - // // "fields[songs]": "artistUrl,albumUrl, playParams" - // } - // // var playlistId = '' - // function getPlaylist(id, params, isLibrary){ - // if (isLibrary){ - // return app.mk.api.library.playlist(id, params) - // } else { return app.mk.api.playlist(id, params)} - // } - // try { + else if (kind.includes("playlist") && (id.startsWith("p.") || id.startsWith("pl."))){ + function shuffleArray(array) { + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + } + app.mk.setQueue({[truekind]: [item.attributes.playParams.id ?? item.id]}).then(function () { + app.mk.play().then(function (){ + var playlistId = id + function getPlaylist(id, params, isLibrary){ + if (isLibrary){ + return app.mk.api.library.playlist(id, params) + } else { return app.mk.api.playlist(id, params)} + } + try { - // getPlaylist(id, params, isLibrary).then(res => { - // let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); - // if (app.mk.shuffleMode == 1){shuffleArray(query); } - // console.log(query) - // app.mk.queue.append(query) - // if (!res.relationships.tracks.next) { - // return - // } else { - // getPlaylistTracks(res.relationships.tracks.next) - // } + getPlaylist(id, params, isLibrary).then(res => { + //let query = res.relationships.tracks.data.map(item => new MusicKit.MediaItem(item)); + //if (app.mk.shuffleMode == 1){shuffleArray(query); } + // console.log(query) + // app.mk.queue.append(query) + if (!res.relationships.tracks.next) { + return + } else { + getPlaylistTracks(res.relationships.tracks.next) + } - // function getPlaylistTracks(next) { - // app.apiCall(app.musicBaseUrl + next, res => { - // // if (res.id != playlistId || next.includes(playlistId)) { - // // return - // // } - // console.log('nextres', res) - // let query = res.data.map(item => new MusicKit.MediaItem(item)) - // if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} - // app.mk.queue.append(query) + function getPlaylistTracks(next) { + app.apiCall(app.musicBaseUrl + next, res => { + // if (res.id != playlistId || next.includes(playlistId)) { + // return + // } + console.log('nextres', res) + let query = res.data.map(item => new MusicKit.MediaItem(item)) + if (app.mk.shuffleMode == 1){shuffleArray(query); console.log('shf')} + app.mk.queue.append(query) - // if (res.next) { - // getPlaylistTracks(res.next) - // } - // }) - // } - // }) - // } catch (e) {} + if (res.next) { + getPlaylistTracks(res.next) + } + }) + } + }) + } catch (e) {} - // }) - // }) - // }) + + }) + }) - // }) - // } + + } else { app.playMediaItemById(item.attributes.playParams.id ?? item.id, item.attributes.playParams.kind ?? item.type, item.attributes.playParams.isLibrary ?? false, item.attributes.url) }}) diff --git a/src/renderer/views/pages/cider-playlist.ejs b/src/renderer/views/pages/cider-playlist.ejs index 0250a153..de987fc3 100644 --- a/src/renderer/views/pages/cider-playlist.ejs +++ b/src/renderer/views/pages/cider-playlist.ejs @@ -59,11 +59,11 @@
@@ -39,13 +41,15 @@
+ {'margin': '205px', + 'margin-left': '260px', 'margin-bottom': '140px', + width: '30px', + height: '30px',}]" @click="app.playMediaItem(item)"> <%- include("../svg/play.svg") %>
diff --git a/src/renderer/views/main.ejs b/src/renderer/views/main.ejs index 21271c19..8dc07f00 100644 --- a/src/renderer/views/main.ejs +++ b/src/renderer/views/main.ejs @@ -498,7 +498,7 @@
-
+
- <%- include("svg/fullscreen.svg") %> + <%- include("svg/pip.svg") %>
- +
+
Follow some artists first and their latest releases will be here
diff --git a/src/renderer/views/svg/fullscreen.svg b/src/renderer/views/svg/fullscreen.svg index c2e3eb1a..602a8572 100644 --- a/src/renderer/views/svg/fullscreen.svg +++ b/src/renderer/views/svg/fullscreen.svg @@ -1,55 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/src/renderer/views/svg/pip.svg b/src/renderer/views/svg/pip.svg new file mode 100644 index 00000000..40f5b738 --- /dev/null +++ b/src/renderer/views/svg/pip.svg @@ -0,0 +1,13 @@ + + + + + + + + From 405e65e9ee479df1ef57caafa1548641da891c52 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Mon, 10 Jan 2022 17:39:19 +0700 Subject: [PATCH 20/23] improve mxm accuracy , fix #102 --- src/renderer/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index bdff4a06..bc1ff0b1 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -2015,6 +2015,7 @@ const app = new Vue({ const track = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.title ?? '' : ''); const artist = encodeURIComponent((this.mk.nowPlayingItem != null) ? this.mk.nowPlayingItem.artistName ?? '' : ''); const time = encodeURIComponent((this.mk.nowPlayingItem != null) ? (Math.round((this.mk.nowPlayingItem.attributes["durationInMillis"] ?? -1000) / 1000) ?? -1) : -1); + const id = encodeURIComponent((this.mk.nowPlayingItem != null) ? app.mk.nowPlayingItem._songId ?? '' : ''); let lrcfile = ""; let richsync = []; const lang = app.cfg.lyrics.mxm_language // translation language @@ -2023,7 +2024,7 @@ const app = new Vue({ } /* get token */ - function getToken(mode, track, artist, songid, lang, time) { + function getToken(mode, track, artist, songid, lang, time, id) { if (attempt > 2) { app.loadAMLyrics(); } else { @@ -2044,7 +2045,7 @@ const app = new Vue({ app.mxmtoken = token; if (mode == 1) { - getMXMSubs(track, artist, app.mxmtoken, lang, time); + getMXMSubs(track, artist, app.mxmtoken, lang, time, id); } else { getMXMTrans(songid, lang, app.mxmtoken); } @@ -2066,11 +2067,12 @@ const app = new Vue({ } } - function getMXMSubs(track, artist, token, lang, time) { + function getMXMSubs(track, artist, token, lang, time, id) { let usertoken = encodeURIComponent(token); let richsyncQuery = (app.cfg.lyrics.mxm_karaoke) ? "&optional_calls=track.richsync" : "" let timecustom = (!time || (time && time < 0)) ? '' : `&f_subtitle_length=${time}&q_duration=${time}&f_subtitle_length_max_deviation=40`; - let url = "https://apic-desktop.musixmatch.com/ws/1.1/macro.subtitles.get?format=json&namespace=lyrics_richsynched" + richsyncQuery + "&subtitle_format=lrc&q_artist=" + artist + "&q_track=" + track + "&usertoken=" + usertoken + timecustom + "&app_id=web-desktop-app-v1.0&t=" + revisedRandId(); + let itunesid = (id && id != "") ? `&track_itunes_id=${id}` : ''; + let url = "https://apic-desktop.musixmatch.com/ws/1.1/macro.subtitles.get?format=json&namespace=lyrics_richsynched" + richsyncQuery + "&subtitle_format=lrc&q_artist=" + artist + "&q_track=" + track + itunesid + "&usertoken=" + usertoken + timecustom + "&app_id=web-desktop-app-v1.0&t=" + revisedRandId(); let req = new XMLHttpRequest(); req.overrideMimeType("application/json"); req.open('GET', url, true); @@ -2201,7 +2203,7 @@ const app = new Vue({ if (track != "" & track != "No Title Found") { if (app.mxmtoken != null && app.mxmtoken != '') { - getMXMSubs(track, artist, app.mxmtoken, lang, time) + getMXMSubs(track, artist, app.mxmtoken, lang, time, id) } else { getToken(1, track, artist, '', lang, time); } From 0fd57fdff787d265496aaff012ae4cb0461b31a3 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Mon, 10 Jan 2022 19:24:57 +0700 Subject: [PATCH 21/23] try to catch download.next --- src/renderer/index.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/renderer/index.js b/src/renderer/index.js index bc1ff0b1..215705f3 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -1568,9 +1568,13 @@ const app = new Vue({ processChunk(response) }) } else { + + if (downloaded.next != null && typeof downloaded.next === "function") { downloaded.next("", params, {includeResponseMeta: !0}).then((response) => { processChunk(response) - }) + }) } else { + console.log("Download next", downloaded.next) + } } } @@ -1644,9 +1648,12 @@ const app = new Vue({ processChunk(response) }) } else { + if (downloaded.next != null && typeof downloaded.next === "function") { downloaded.next("", params, {includeResponseMeta: !0}).then((response) => { processChunk(response) - }) + }) } else { + console.log("Download next", downloaded.next) + } } } @@ -1721,9 +1728,13 @@ const app = new Vue({ processChunk(response) }) } else { - downloaded.next("", "artists", {includeResponseMeta: !0}).then((response) => { - processChunk(response) - }) + if (downloaded.next != null && typeof downloaded.next === "function") { + downloaded.next("", "artists", {includeResponseMeta: !0}).then((response) => { + processChunk(response) + }) } else { + console.log("Download next", downloaded.next) + } + } } From b4d8f8fe410ad13aa5ca9cf8b235d609e4b34839 Mon Sep 17 00:00:00 2001 From: vapormusic Date: Mon, 10 Jan 2022 19:34:40 +0700 Subject: [PATCH 22/23] fix some vids not playing --- src/renderer/apple-hls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/apple-hls.js b/src/renderer/apple-hls.js index a3a3398a..e4936dda 100644 --- a/src/renderer/apple-hls.js +++ b/src/renderer/apple-hls.js @@ -23260,7 +23260,7 @@ } if (null != (l = "string" != typeof (h = g.pathwayID) ? im("invalid steering manifest PATHWAY-PRIORITY list item data type") : /^[\w\-\.]+$/.test(h) ? void 0 : im("steering manifest contains invalid pathway ID: " + h))) break; - if (g.hdcpLevel === "NONE" && (g.url.includes("gr230"))){ + if (g.hdcpLevel === "NONE"){ n.push(g)} } return { From 42e3d4d8e5f45b4049804198dcb670eccc4f6e61 Mon Sep 17 00:00:00 2001 From: Core Date: Mon, 10 Jan 2022 20:23:54 +0000 Subject: [PATCH 23/23] Changed lfm scrobble delay to percentage --- index.js | 2 +- src/main/lastfm.js | 2 +- src/renderer/views/pages/settings.ejs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index afe9bb0f..601d830e 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ const configDefaults = { }, "lastfm": { "enabled": false, - "scrobble_after": 30, + "scrobble_after": 50, "auth_token": "", "enabledRemoveFeaturingArtists": true, "NowPlaying": "true" diff --git a/src/main/lastfm.js b/src/main/lastfm.js index 74dfa5b2..2178645e 100644 --- a/src/main/lastfm.js +++ b/src/main/lastfm.js @@ -61,7 +61,7 @@ const lfm = { }, scrobbleSong: async function (attributes) { - await new Promise(resolve => setTimeout(resolve, app.cfg.get('lastfm.scrobble_after') * 1000)); + await new Promise(resolve => setTimeout(resolve, (attributes.durationInMillis / (app.cfg.get('lastfm.scrobble_after') / 100)))); const currentAttributes = app.media; if (!app.lastfm || app.lastfm.cachedAttributes === attributes ) { diff --git a/src/renderer/views/pages/settings.ejs b/src/renderer/views/pages/settings.ejs index 9372feb9..99156ca3 100644 --- a/src/renderer/views/pages/settings.ejs +++ b/src/renderer/views/pages/settings.ejs @@ -454,10 +454,10 @@
- LastFM Scrobble Delay + LastFM Scrobble Delay (%)
- +