From afcdf0a7acc64a977db15fa701eaf79c8c5bbafb Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 16:39:51 +0100 Subject: [PATCH 01/62] localisation for mediaitem context menu --- .../views/components/mediaitem-square.ejs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/web-remote/views/components/mediaitem-square.ejs b/src/web-remote/views/components/mediaitem-square.ejs index 0d8d27da..ffaa7d75 100644 --- a/src/web-remote/views/components/mediaitem-square.ejs +++ b/src/web-remote/views/components/mediaitem-square.ejs @@ -320,7 +320,7 @@ { "icon": "./assets/feather/heart.svg", "id": "love", - "name": "Love", + "name": app.getLz("action.love"), "hidden": false, "disabled": true, "action": function() { @@ -331,7 +331,7 @@ "icon": "./assets/feather/heart.svg", "id": "unlove", "active": true, - "name": "Unlove", + "name": app.getLz("action.unlove"), "hidden": true, "action": function() { app.unlove(self.item) @@ -340,7 +340,7 @@ { "icon": "./assets/feather/thumbs-down.svg", "id": "dislike", - "name": "Dislike", + "name": app.getLz("action.dislike"), "hidden": false, "disabled": true, "action": function() { @@ -350,7 +350,7 @@ { "icon": "./assets/feather/thumbs-down.svg", "id": "undo_dislike", - "name": "Undo dislike", + "name": app.getLz("action.undoDislike"), "active": true, "hidden": true, "action": function() { @@ -362,7 +362,7 @@ { "icon": "./assets/feather/list.svg", "id": "addToPlaylist", - "name": "Add to Playlist...", + "name": app.getLz("action.addToPlaylist") + " ...", "action": function() { app.promptAddToPlaylist() } @@ -370,7 +370,7 @@ { "id": "addToLibrary", "icon": "./assets/feather/plus.svg", - "name": "Add to library", + "name": app.getLz("action.addToLibrary") + " ...", "hidden": false, "disabled": true, "action": function() { @@ -383,7 +383,7 @@ { "id": "removeFromLibrary", "icon": "./assets/feather/x-circle.svg", - "name": "Remove from library", + "name": app.getLz("action.removeFromLibrary"), "hidden": true, "action": async function() { console.log("remove"); @@ -394,7 +394,7 @@ } }, { - "name": "Play Next", + "name": app.getLz("action.playNext"), "icon": "./assets/arrow-bend-up.svg", "action": function() { app.mk.playNext({ [self.item.attributes.playParams.kind ?? self.item.type]: self.item.attributes.playParams.id ?? self.item.id }) @@ -403,7 +403,7 @@ } }, { - "name": "Play Later", + "name": app.getLz("action.playLater"), "icon": "./assets/arrow-bend-down.svg", "action": function() { app.mk.playLater({ [self.item.attributes.playParams.kind ?? self.item.type]: self.item.attributes.playParams.id ?? self.item.id }) @@ -413,7 +413,7 @@ }, { "icon": "./assets/feather/share.svg", - "name": "Share", + "name": app.getLz("action.share"), "action": function() { self.app.copyToClipboard(self.item.attributes.url) } From 9b14f51e573b8817cc7cd25b70adccd0f3d8fb75 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 16:51:47 +0100 Subject: [PATCH 02/62] fixes removing songs issue #1442 --- src/renderer/main/vueapp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index fecf32cb..7fe421b4 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -4597,7 +4597,7 @@ const app = new Vue({ name: app.getLz("action.removeFromLibrary"), hidden: true, action: function () { - self.removeFromLibrary(); + self.removeFromLibrary(app.mk.nowPlayingItem.type, MusicKitInterop.getAttributes().songId); }, }, { From ebd03b9f8ae46dcd3fb778669bfece598c8357b9 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 17:16:20 +0100 Subject: [PATCH 03/62] aids formatting no more --- .prettierrc | 7 +++++-- package.json | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.prettierrc b/.prettierrc index 03328464..2980127b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,2 +1,5 @@ -bracketSameLine: true -printWidth: 240 +{ + "printWidth": 300, + "singleAttributePerLine": true, + "bracketSameLine": true +} diff --git a/package.json b/package.json index 42e31a07..083c0106 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "msft": "npm run build && electron-builder -c msft-package.json", "mstest": "npm run build && electron-builder -c msft-test.json", "postinstall": "electron-builder install-app-deps", - "prettier": "npx prettier --write '**/*.{js,json,ts,css,less}'" + "format:check": "prettier --check \"src/**/*.{js,json,ts,css,less}\"", + "format:write": "prettier --write \"src/**/*.{js,json,ts,css,less}\"" }, "dependencies": { "@sentry/electron": "^4.0.2", From d372ba23b117765e15c55109c43eeb03bf7ccf1c Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 17:17:47 +0100 Subject: [PATCH 04/62] ok --- .github/workflows/cider-chores.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 2b26ea4d..740b265c 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -61,7 +61,7 @@ jobs: ref: ${{ github.head_ref }} - name: Prettify code - run: npm run prettier + run: npm run format:write - name: Commit Prettier Code uses: stefanzweifel/git-auto-commit-action@v4.14.1 From bde6dd3779ad698342422e22583843595cfc439b Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 17:20:33 +0100 Subject: [PATCH 05/62] stop [ci skip] --- .github/workflows/cider-chores.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 740b265c..47edc384 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -61,7 +61,9 @@ jobs: ref: ${{ github.head_ref }} - name: Prettify code - run: npm run format:write + uses: creyD/prettier_action@v4.2 + with: + prettier_options: --write "src/**/*.{js,json,ts,css,less}" - name: Commit Prettier Code uses: stefanzweifel/git-auto-commit-action@v4.14.1 From eba6c640081a86dd8d116c5144122169024148e3 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 17:22:11 +0100 Subject: [PATCH 06/62] ci test --- src/main/base/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/base/app.ts b/src/main/base/app.ts index f59c6788..2e569628 100644 --- a/src/main/base/app.ts +++ b/src/main/base/app.ts @@ -27,7 +27,7 @@ export class AppEvents { */ private start(): void { AppEvents.initLogging(); - console.info("[AppEvents] App started"); + console.info("[AppEvents] App started "); /********************************************************************************************************************** * Startup arguments handling From ef6508d19b614c06a91d329e041345c37bf96411 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 17:24:33 +0100 Subject: [PATCH 07/62] stop it --- .github/workflows/cider-chores.yml | 2 +- src/main/base/app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 47edc384..ed891362 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -63,7 +63,7 @@ jobs: - name: Prettify code uses: creyD/prettier_action@v4.2 with: - prettier_options: --write "src/**/*.{js,json,ts,css,less}" + prettier_options: --write src/**/*.{js,json,ts,css,less} - name: Commit Prettier Code uses: stefanzweifel/git-auto-commit-action@v4.14.1 diff --git a/src/main/base/app.ts b/src/main/base/app.ts index 2e569628..f59c6788 100644 --- a/src/main/base/app.ts +++ b/src/main/base/app.ts @@ -27,7 +27,7 @@ export class AppEvents { */ private start(): void { AppEvents.initLogging(); - console.info("[AppEvents] App started "); + console.info("[AppEvents] App started"); /********************************************************************************************************************** * Startup arguments handling From 12fa15242c21efaf94b8845b303c89228f278617 Mon Sep 17 00:00:00 2001 From: coredev-uk Date: Fri, 16 Sep 2022 16:25:00 +0000 Subject: [PATCH 08/62] Prettified Code! --- src/main/base/browserwindow.ts | 8 +- src/main/base/wsapi.ts | 4 +- src/main/plugins/lastfm.ts | 16 +- src/main/plugins/menubar.ts | 15 +- src/main/plugins/raop.ts | 3 +- src/renderer/audio/audio.js | 8 +- src/renderer/audio/renderer.js | 4 +- src/renderer/hlscider.js | 174 ++++-------------- src/renderer/main/components/i18n-editor.js | 43 ++++- .../main/components/sidebar-library-item.js | 10 +- src/renderer/main/components/svg-icon.js | 8 +- src/renderer/main/vueapp.js | 17 +- src/web-remote/vue.js | 40 +--- 13 files changed, 108 insertions(+), 242 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 26312caa..3cdbe555 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -558,15 +558,11 @@ export class BrowserWindow { res.send("Stopped"); break; case "next": - BrowserWindow.win.webContents.executeJavaScript( - "if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex);}" - ); + BrowserWindow.win.webContents.executeJavaScript("if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex);}"); res.send("Next"); break; case "previous": - BrowserWindow.win.webContents.executeJavaScript( - "if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex);}" - ); + BrowserWindow.win.webContents.executeJavaScript("if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex);}"); res.send("Previous"); break; default: { diff --git a/src/main/base/wsapi.ts b/src/main/base/wsapi.ts index 7fc25619..d161b279 100644 --- a/src/main/base/wsapi.ts +++ b/src/main/base/wsapi.ts @@ -208,9 +208,7 @@ export class wsapi { response.message = "Next"; break; case "previous": - this._win.webContents.executeJavaScript( - `if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex)}` - ); + this._win.webContents.executeJavaScript(`if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex)}`); response.message = "Previous"; break; case "musickit-api": diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index ba912370..b9d4cc2a 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -170,13 +170,7 @@ export default class lastfm { return; } - if ( - !this._authenticated || - !attributes || - this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || - (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name) - ) - return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return; // Scrobble const scrobble = { @@ -216,13 +210,7 @@ export default class lastfm { return; } - if ( - !this._authenticated || - !attributes || - this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || - (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name) - ) - return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return; const nowPlaying = { artist: attributes.lfmTrack.artist.name, diff --git a/src/main/plugins/menubar.ts b/src/main/plugins/menubar.ts index 261605e4..dc652dec 100644 --- a/src/main/plugins/menubar.ts +++ b/src/main/plugins/menubar.ts @@ -53,20 +53,7 @@ export default class Thumbar { { label: utils.getLocale(utils.getStoreValue("general.language"), "menubar.options.view"), submenu: [ - ...(this.isMac - ? [ - { role: "reload" }, - { role: "forceReload" }, - { role: "toggleDevTools" }, - { type: "separator" }, - { role: "resetZoom" }, - { role: "zoomIn" }, - { role: "zoomOut" }, - { type: "separator" }, - { role: "togglefullscreen" }, - { type: "separator" }, - ] - : []), + ...(this.isMac ? [{ role: "reload" }, { role: "forceReload" }, { role: "toggleDevTools" }, { type: "separator" }, { role: "resetZoom" }, { role: "zoomIn" }, { role: "zoomOut" }, { type: "separator" }, { role: "togglefullscreen" }, { type: "separator" }] : []), { label: utils.getLocale(utils.getStoreValue("general.language"), "term.search"), accelerator: utils.getStoreValue("general.keybindings.search").join("+"), diff --git a/src/main/plugins/raop.ts b/src/main/plugins/raop.ts index 74eb513b..cdca5b52 100644 --- a/src/main/plugins/raop.ts +++ b/src/main/plugins/raop.ts @@ -259,8 +259,7 @@ export default class RAOP { // this.airtunes.stopAll(() => { // console.log("end"); // }); - if (this.devices[idx]?.state != null && this.devices[idx].state != -1) - this._win.webContents.executeJavaScript(`app.airplayDisconnect(true, ${JSON.stringify([ipv4, ipport, sepassword, title, artist, album, artworkURL, txt, airplay2dv])})`).catch((err: any) => console.error(err)); + if (this.devices[idx]?.state != null && this.devices[idx].state != -1) this._win.webContents.executeJavaScript(`app.airplayDisconnect(true, ${JSON.stringify([ipv4, ipport, sepassword, title, artist, album, artworkURL, txt, airplay2dv])})`).catch((err: any) => console.error(err)); // this.airtunes = null; // this.device = null; // this.ipairplay = ""; diff --git a/src/renderer/audio/audio.js b/src/renderer/audio/audio.js index 99645e24..9a993c14 100644 --- a/src/renderer/audio/audio.js +++ b/src/renderer/audio/audio.js @@ -301,9 +301,7 @@ const CiderAudio = { filterlessGain = filterlessGain * spatialProfile.gainComp; } filterlessGain = Math.pow(10, (-1 * (20 * Math.log10(filterlessGain))) / 20).toFixed(4); - filterlessGain > 1.0 - ? CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudio.context.currentTime + 0.3) - : CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(filterlessGain, CiderAudio.context.currentTime + 0.3); + filterlessGain > 1.0 ? CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudio.context.currentTime + 0.3) : CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(filterlessGain, CiderAudio.context.currentTime + 0.3); console.debug(`[Cider][Audio] IntelliGainComp: ${filterlessGain > 1.0 ? 0 : (20 * Math.log10(filterlessGain)).toFixed(2)} dB (${filterlessGain > 1.0 ? 1 : filterlessGain})`); return; } @@ -358,9 +356,7 @@ const CiderAudio = { maxGain = maxGain * spatialProfile.gainComp; } maxGain = Math.pow(10, (-1 * (20 * Math.log10(maxGain))) / 20).toFixed(4); - maxGain > 1.0 - ? CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudio.context.currentTime + 0.3) - : CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(maxGain, CiderAudio.context.currentTime + 0.3); + maxGain > 1.0 ? CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudio.context.currentTime + 0.3) : CiderAudio.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(maxGain, CiderAudio.context.currentTime + 0.3); console.debug(`[Cider][Audio] IntelliGainComp: ${maxGain > 1.0 ? 0 : (20 * Math.log10(maxGain)).toFixed(2)} dB (${maxGain > 1.0 ? 1 : maxGain})`); }, sendAudio: function () { diff --git a/src/renderer/audio/renderer.js b/src/renderer/audio/renderer.js index 8ab2ea60..04d6cd8a 100644 --- a/src/renderer/audio/renderer.js +++ b/src/renderer/audio/renderer.js @@ -171,9 +171,7 @@ const CiderAudioRenderer = { maxGain = maxGain * spatialProfile.gainComp; } maxGain = Math.pow(10, (-1 * (20 * Math.log10(maxGain))) / 20).toFixed(4); - maxGain > 1.0 - ? CiderAudioRenderer.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudioRenderer.context.currentTime + 0.3) - : CiderAudioRenderer.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(maxGain, CiderAudioRenderer.context.currentTime + 0.3); + maxGain > 1.0 ? CiderAudioRenderer.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(1.0, CiderAudioRenderer.context.currentTime + 0.3) : CiderAudioRenderer.audioNodes.intelliGainComp.gain.exponentialRampToValueAtTime(maxGain, CiderAudioRenderer.context.currentTime + 0.3); console.debug(`[Cider][Audio] IntelliGainComp: ${maxGain > 1.0 ? 0 : (20 * Math.log10(maxGain)).toFixed(2)} dB (${maxGain > 1.0 ? 1 : maxGain})`); }, atmosphereRealizer2_n6: function (status, destination) { diff --git a/src/renderer/hlscider.js b/src/renderer/hlscider.js index 9e4c34da..f7da6d23 100644 --- a/src/renderer/hlscider.js +++ b/src/renderer/hlscider.js @@ -1589,9 +1589,7 @@ typeof window !== "undefined" && } var levelDetails = levelInfo.details; - var avgDuration = - (partCurrent ? (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.partTarget) : levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.averagetargetduration) || - currentFragDuration; + var avgDuration = (partCurrent ? (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.partTarget) : levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.averagetargetduration) || currentFragDuration; var adjustedbw = void 0; // follow algorithm captured from stagefright : // https://android.googlesource.com/platform/frameworks/av/+/master/media/libstagefright/httplive/LiveSession.cpp // Pick the highest bandwidth stream below or equal to estimated bandwidth. @@ -1607,9 +1605,7 @@ typeof window !== "undefined" && var bitrate = levels[i].maxBitrate; var fetchDuration = (bitrate * avgDuration) / adjustedbw; - _utils_logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace( - "level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: " + i + "/" + Math.round(adjustedbw) + "/" + bitrate + "/" + avgDuration + "/" + maxFetchDuration + "/" + fetchDuration - ); // if adjusted bw is greater than level bitrate AND + _utils_logger__WEBPACK_IMPORTED_MODULE_6__["logger"].trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: " + i + "/" + Math.round(adjustedbw) + "/" + bitrate + "/" + avgDuration + "/" + maxFetchDuration + "/" + fetchDuration); // if adjusted bw is greater than level bitrate AND if ( adjustedbw > bitrate && // fragment fetchDuration unknown OR live stream OR fragment fetchDuration less than max allowed fetch duration, then this level matches @@ -1971,11 +1967,7 @@ typeof window !== "undefined" && if (this.bufferFlushed) { this.bufferFlushed = false; - this.afterBufferFlushed( - this.mediaBuffer ? this.mediaBuffer : this.media, - _loader_fragment__WEBPACK_IMPORTED_MODULE_7__["ElementaryStreamTypes"].AUDIO, - _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO - ); + this.afterBufferFlushed(this.mediaBuffer ? this.mediaBuffer : this.media, _loader_fragment__WEBPACK_IMPORTED_MODULE_7__["ElementaryStreamTypes"].AUDIO, _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO); } var bufferInfo = this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO); @@ -2024,10 +2016,7 @@ typeof window !== "undefined" && return; } - if ( - ((_frag$decryptdata = frag.decryptdata) === null || _frag$decryptdata === void 0 ? void 0 : _frag$decryptdata.keyFormat) === "identity" && - !((_frag$decryptdata2 = frag.decryptdata) !== null && _frag$decryptdata2 !== void 0 && _frag$decryptdata2.key) - ) { + if (((_frag$decryptdata = frag.decryptdata) === null || _frag$decryptdata === void 0 ? void 0 : _frag$decryptdata.keyFormat) === "identity" && !((_frag$decryptdata2 = frag.decryptdata) !== null && _frag$decryptdata2 !== void 0 && _frag$decryptdata2.key)) { this.loadKey(frag, trackDetails); } else { this.loadFragment(frag, trackDetails, targetBufferTime); @@ -2176,12 +2165,7 @@ typeof window !== "undefined" && var transmuxer = this.transmuxer; if (!transmuxer) { - transmuxer = this.transmuxer = new _demux_transmuxer_interface__WEBPACK_IMPORTED_MODULE_9__["default"]( - this.CiderHls, - _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO, - this._handleTransmuxComplete.bind(this), - this._handleTransmuxerFlush.bind(this) - ); + transmuxer = this.transmuxer = new _demux_transmuxer_interface__WEBPACK_IMPORTED_MODULE_9__["default"](this.CiderHls, _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)); } // Check if we have video initPTS // If not we need to wait for it @@ -2198,9 +2182,7 @@ typeof window !== "undefined" && var chunkMeta = new _types_transmuxer__WEBPACK_IMPORTED_MODULE_10__["ChunkMetadata"](frag.level, frag.sn, frag.stats.chunkCount, payload.byteLength, partIndex, partial); transmuxer.push(payload, initSegmentData, audioCodec, "", frag, part, details.totalduration, accurateTimeOffset, chunkMeta, initPTS); } else { - _utils_logger__WEBPACK_IMPORTED_MODULE_14__["logger"].log( - "Unknown video PTS for cc " + frag.cc + ", waiting for video PTS before demuxing audio frag " + frag.sn + " of [" + details.startSN + " ," + details.endSN + "],track " + trackId - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_14__["logger"].log("Unknown video PTS for cc " + frag.cc + ", waiting for video PTS before demuxing audio frag " + frag.sn + " of [" + details.startSN + " ," + details.endSN + "],track " + trackId); var _this$waitingData = (this.waitingData = this.waitingData || { frag: frag, @@ -3267,9 +3249,7 @@ typeof window !== "undefined" && state = this.state; var currentTime = media ? media.currentTime : 0; var bufferInfo = _utils_buffer_helper__WEBPACK_IMPORTED_MODULE_3__["BufferHelper"].bufferInfo(mediaBuffer || media, currentTime, config.maxBufferHole); - this.log( - "media seeking to " + (Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(currentTime) ? currentTime.toFixed(3) : currentTime) + ", state: " + state - ); + this.log("media seeking to " + (Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(currentTime) ? currentTime.toFixed(3) : currentTime) + ", state: " + state); if (state === State.ENDED) { this.resetLoadingState(); @@ -3619,19 +3599,7 @@ typeof window !== "undefined" && } } - this.log( - "Loading fragment " + - frag.sn + - " cc: " + - frag.cc + - " " + - (details ? "of [" + details.startSN + "-" + details.endSN + "] " : "") + - (this.logPrefix === "[stream-controller]" ? "level" : "track") + - ": " + - frag.level + - ", target: " + - parseFloat(targetBufferTime.toFixed(3)) - ); // Don't update nextLoadPosition for fragments which are not buffered + this.log("Loading fragment " + frag.sn + " cc: " + frag.cc + " " + (details ? "of [" + details.startSN + "-" + details.endSN + "] " : "") + (this.logPrefix === "[stream-controller]" ? "level" : "track") + ": " + frag.level + ", target: " + parseFloat(targetBufferTime.toFixed(3))); // Don't update nextLoadPosition for fragments which are not buffered if (Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(frag.sn) && !this.bitrateTest) { this.nextLoadPosition = frag.start + frag.duration; @@ -4099,18 +4067,7 @@ typeof window !== "undefined" && if (firstLevelLoad || (!aligned && !slidingStart)) { Object(_utils_discontinuities__WEBPACK_IMPORTED_MODULE_9__["alignStream"])(fragPrevious, lastLevel, details); var alignedSlidingStart = details.fragments[0].start; - this.log( - "Live playlist sliding: " + - alignedSlidingStart.toFixed(2) + - " start-sn: " + - (previousDetails ? previousDetails.startSN : "na") + - "->" + - details.startSN + - " prev-sn: " + - (fragPrevious ? fragPrevious.sn : "na") + - " fragments: " + - length - ); + this.log("Live playlist sliding: " + alignedSlidingStart.toFixed(2) + " start-sn: " + (previousDetails ? previousDetails.startSN : "na") + "->" + details.startSN + " prev-sn: " + (fragPrevious ? fragPrevious.sn : "na") + " fragments: " + length); return alignedSlidingStart; } @@ -5767,11 +5724,7 @@ typeof window !== "undefined" && ot: ot, }; - if ( - ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].VIDEO || - ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].AUDIO || - ot == _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MUXED - ) { + if (ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].VIDEO || ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].AUDIO || ot == _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MUXED) { data.br = level.bitrate / 1000; data.tb = _this.getTopBandwidth(ot); data.bl = _this.getBufferLength(ot); @@ -5871,10 +5824,7 @@ typeof window !== "undefined" && // apply baseline data _extends(data, this.createData()); - var isVideo = - data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].INIT || - data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].VIDEO || - data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MUXED; + var isVideo = data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].INIT || data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].VIDEO || data.ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MUXED; if (this.starved && isVideo) { data.bs = true; @@ -8610,10 +8560,7 @@ typeof window !== "undefined" && levels = levels.filter(function (_ref2) { var audioCodec = _ref2.audioCodec, videoCodec = _ref2.videoCodec; - return ( - (!audioCodec || Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_3__["isCodecSupportedInMp4"])(audioCodec, "audio")) && - (!videoCodec || Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_3__["isCodecSupportedInMp4"])(videoCodec, "video")) - ); + return (!audioCodec || Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_3__["isCodecSupportedInMp4"])(audioCodec, "audio")) && (!videoCodec || Object(_utils_codecs__WEBPACK_IMPORTED_MODULE_3__["isCodecSupportedInMp4"])(videoCodec, "video")); }); if (data.audioTracks) { @@ -9319,10 +9266,7 @@ typeof window !== "undefined" && ccOffset = oldFrag.cc - newFrag.cc; } - if ( - Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(oldFrag.startPTS) && - Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(oldFrag.endPTS) - ) { + if (Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(oldFrag.startPTS) && Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(oldFrag.endPTS)) { newFrag.start = newFrag.startPTS = oldFrag.startPTS; newFrag.startDTS = oldFrag.startDTS; newFrag.appendedPTS = oldFrag.appendedPTS; @@ -9902,10 +9846,7 @@ typeof window !== "undefined" && } // We want to load the key if we're dealing with an identity key, because we will decrypt // this content using the key we fetch. Other keys will be handled by the DRM CDM via EME. - if ( - ((_frag$decryptdata = frag.decryptdata) === null || _frag$decryptdata === void 0 ? void 0 : _frag$decryptdata.keyFormat) === "identity" && - !((_frag$decryptdata2 = frag.decryptdata) !== null && _frag$decryptdata2 !== void 0 && _frag$decryptdata2.key) - ) { + if (((_frag$decryptdata = frag.decryptdata) === null || _frag$decryptdata === void 0 ? void 0 : _frag$decryptdata.keyFormat) === "identity" && !((_frag$decryptdata2 = frag.decryptdata) !== null && _frag$decryptdata2 !== void 0 && _frag$decryptdata2.key)) { this.loadKey(frag, levelDetails); } else { this.loadFragment(frag, levelDetails, targetBufferTime); @@ -10257,13 +10198,7 @@ typeof window !== "undefined" && // this.log(`Transmuxing ${frag.sn} of [${details.startSN} ,${details.endSN}],level ${frag.level}, cc ${frag.cc}`); var transmuxer = (this.transmuxer = - this.transmuxer || - new _demux_transmuxer_interface__WEBPACK_IMPORTED_MODULE_8__["default"]( - this.CiderHls, - _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].MAIN, - this._handleTransmuxComplete.bind(this), - this._handleTransmuxerFlush.bind(this) - )); + this.transmuxer || new _demux_transmuxer_interface__WEBPACK_IMPORTED_MODULE_8__["default"](this.CiderHls, _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].MAIN, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this))); var partIndex = part ? part.index : -1; var partial = partIndex !== -1; var chunkMeta = new _types_transmuxer__WEBPACK_IMPORTED_MODULE_9__["ChunkMetadata"](frag.level, frag.sn, frag.stats.chunkCount, payload.byteLength, partIndex, partial); @@ -14779,8 +14714,8 @@ typeof window !== "undefined" && */ var chromeVersion = null; var BitratesMap = [ - 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, - 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, + 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, + 64, 80, 96, 112, 128, 144, 160, ]; var SamplingRateMap = [44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000]; var SamplesCoefficients = [ @@ -18354,9 +18289,7 @@ typeof window !== "undefined" && var _sourceBuffer$prototy; var sourceBuffer = getSourceBuffer(); - return ( - typeof (sourceBuffer === null || sourceBuffer === void 0 ? void 0 : (_sourceBuffer$prototy = sourceBuffer.prototype) === null || _sourceBuffer$prototy === void 0 ? void 0 : _sourceBuffer$prototy.changeType) === "function" - ); + return typeof (sourceBuffer === null || sourceBuffer === void 0 ? void 0 : (_sourceBuffer$prototy = sourceBuffer.prototype) === null || _sourceBuffer$prototy === void 0 ? void 0 : _sourceBuffer$prototy.changeType) === "function"; } /***/ @@ -18743,10 +18676,7 @@ typeof window !== "undefined" && var start = segment.byteRangeStartOffset; var end = segment.byteRangeEndOffset; - if ( - Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(start) && - Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(end) - ) { + if (Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(start) && Object(_home_runner_work_CiderHls_js_CiderHls_js_src_polyfills_number__WEBPACK_IMPORTED_MODULE_0__["isFiniteNumber"])(end)) { loaderContext.rangeStart = start; loaderContext.rangeEnd = end; } @@ -18854,12 +18784,7 @@ typeof window !== "undefined" && this._url = null; this.baseurl = void 0; this.relurl = void 0; - this.elementaryStreams = - ((_this$elementaryStrea = {}), - (_this$elementaryStrea[ElementaryStreamTypes.AUDIO] = null), - (_this$elementaryStrea[ElementaryStreamTypes.VIDEO] = null), - (_this$elementaryStrea[ElementaryStreamTypes.AUDIOVIDEO] = null), - _this$elementaryStrea); + this.elementaryStreams = ((_this$elementaryStrea = {}), (_this$elementaryStrea[ElementaryStreamTypes.AUDIO] = null), (_this$elementaryStrea[ElementaryStreamTypes.VIDEO] = null), (_this$elementaryStrea[ElementaryStreamTypes.AUDIOVIDEO] = null), _this$elementaryStrea); this.baseurl = baseurl; } // setByteRange converts a EXT-X-BYTERANGE attribute into a two element array @@ -19730,11 +19655,7 @@ typeof window !== "undefined" && function isMP4Url(url) { var _URLToolkit$parseURL$, _URLToolkit$parseURL; - return MP4_REGEX_SUFFIX.test( - (_URLToolkit$parseURL$ = (_URLToolkit$parseURL = url_toolkit__WEBPACK_IMPORTED_MODULE_1__["parseURL"](url)) === null || _URLToolkit$parseURL === void 0 ? void 0 : _URLToolkit$parseURL.path) != null - ? _URLToolkit$parseURL$ - : "" - ); + return MP4_REGEX_SUFFIX.test((_URLToolkit$parseURL$ = (_URLToolkit$parseURL = url_toolkit__WEBPACK_IMPORTED_MODULE_1__["parseURL"](url)) === null || _URLToolkit$parseURL === void 0 ? void 0 : _URLToolkit$parseURL.path) != null ? _URLToolkit$parseURL$ : ""); } var M3U8Parser = /*#__PURE__*/ (function () { @@ -20819,9 +20740,7 @@ typeof window !== "undefined" && timeout = false; } - _utils_logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn( - "[playlist-loader]: A network " + (timeout ? "timeout" : "error") + " occurred while loading " + context.type + " level: " + context.level + " id: " + context.id + ' group-id: "' + context.groupId + '"' - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn("[playlist-loader]: A network " + (timeout ? "timeout" : "error") + " occurred while loading " + context.type + " level: " + context.level + " id: " + context.id + ' group-id: "' + context.groupId + '"'); var details = _errors__WEBPACK_IMPORTED_MODULE_2__["ErrorDetails"].UNKNOWN; var fatal = false; var loader = this.getInternalLoader(context); @@ -21004,20 +20923,20 @@ typeof window !== "undefined" && if (channelCount === 1) { // ffmpeg -y -f lavfi -i "aevalsrc=0:d=0.05" -c:a libfdk_aac -profile:a aac_he -b:a 4k output.aac && hexdump -v -e '16/1 "0x%x," "\n"' -v output.aac return new Uint8Array([ - 0x1, 0x40, 0x22, 0x80, 0xa3, 0x4e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x1c, 0x6, 0xf1, 0xc1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, - 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, + 0x1, 0x40, 0x22, 0x80, 0xa3, 0x4e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x1c, 0x6, 0xf1, 0xc1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, + 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, ]); } else if (channelCount === 2) { // ffmpeg -y -f lavfi -i "aevalsrc=0|0:d=0.05" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 "0x%x," "\n"' -v output.aac return new Uint8Array([ - 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, - 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, + 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, + 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, ]); } else if (channelCount === 3) { // ffmpeg -y -f lavfi -i "aevalsrc=0|0|0:d=0.05" -c:a libfdk_aac -profile:a aac_he_v2 -b:a 4k output.aac && hexdump -v -e '16/1 "0x%x," "\n"' -v output.aac return new Uint8Array([ - 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, - 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, + 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0, 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, + 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5e, ]); } @@ -22334,13 +22253,7 @@ typeof window !== "undefined" && initSegment = this.generateIS(audioTrack, videoTrack, timeOffset); } - audio = this.remuxAudio( - audioTrack, - audioTimeOffset, - this.isAudioContiguous, - accurateTimeOffset, - hasVideo || enoughVideoSamples || playlistType === _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO ? videoTimeOffset : undefined - ); + audio = this.remuxAudio(audioTrack, audioTimeOffset, this.isAudioContiguous, accurateTimeOffset, hasVideo || enoughVideoSamples || playlistType === _types_loader__WEBPACK_IMPORTED_MODULE_6__["PlaylistLevelType"].AUDIO ? videoTimeOffset : undefined); if (enoughVideoSamples) { var audioTrackLength = audio ? audio.endPTS - audio.startPTS : 0; // if initSegment was generated without video samples, regenerate it again @@ -22531,9 +22444,7 @@ typeof window !== "undefined" && if (ptsDtsShift < averageSampleDuration * -2) { // Fix for "CNN special report, with CC" in test-streams (including Safari browser) // With large PTS < DTS errors such as this, we want to correct CTS while maintaining increasing DTS values - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn( - "PTS < DTS detected in video samples, offsetting DTS from PTS by " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(-averageSampleDuration, true) + " ms" - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn("PTS < DTS detected in video samples, offsetting DTS from PTS by " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(-averageSampleDuration, true) + " ms"); var lastDts = ptsDtsShift; for (var _i = 0; _i < nbSamples; _i++) { @@ -22543,9 +22454,7 @@ typeof window !== "undefined" && } else { // Fix for "Custom IV with bad PTS DTS" in test-streams // With smaller PTS < DTS errors we can simply move all DTS back. This increases CTS without causing buffer gaps or decode errors in Safari - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn( - "PTS < DTS detected in video samples, shifting DTS by " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(ptsDtsShift, true) + " ms to overcome this issue" - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn("PTS < DTS detected in video samples, shifting DTS by " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(ptsDtsShift, true) + " ms to overcome this issue"); for (var _i2 = 0; _i2 < nbSamples; _i2++) { inputSamples[_i2].dts = inputSamples[_i2].dts + ptsDtsShift; @@ -22563,13 +22472,9 @@ typeof window !== "undefined" && if (foundHole || foundOverlap) { if (foundHole) { - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn( - "AVC: " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(delta, true) + " ms (" + delta + "dts) hole between fragments detected, filling it" - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn("AVC: " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(delta, true) + " ms (" + delta + "dts) hole between fragments detected, filling it"); } else { - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn( - "AVC: " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(-delta, true) + " ms (" + delta + "dts) overlapping between fragments detected" - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn("AVC: " + Object(_utils_timescale_conversion__WEBPACK_IMPORTED_MODULE_7__["toMsFromMpegTsClock"])(-delta, true) + " ms (" + delta + "dts) overlapping between fragments detected"); } firstDTS = nextAvcDts; @@ -22682,9 +22587,7 @@ typeof window !== "undefined" && mp4SampleDuration = lastFrameDuration; } - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].log( - "[mp4-remuxer]: It is approximately " + deltaToFrameEnd / 90 + " ms to the next segment; using duration " + mp4SampleDuration / 90 + " ms for the last video frame." - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].log("[mp4-remuxer]: It is approximately " + deltaToFrameEnd / 90 + " ms to the next segment; using duration " + mp4SampleDuration / 90 + " ms for the last video frame."); } else { mp4SampleDuration = lastFrameDuration; } @@ -22759,10 +22662,7 @@ typeof window !== "undefined" && var timeOffsetMpegTS = timeOffset * inputTimeScale; this.isAudioContiguous = contiguous = - contiguous || - (inputSamples.length && - nextAudioPts > 0 && - ((accurateTimeOffset && Math.abs(timeOffsetMpegTS - nextAudioPts) < 9000) || Math.abs(normalizePts(inputSamples[0].pts - initPTS, timeOffsetMpegTS) - nextAudioPts) < 20 * inputSampleDuration)); // compute normalized PTS + contiguous || (inputSamples.length && nextAudioPts > 0 && ((accurateTimeOffset && Math.abs(timeOffsetMpegTS - nextAudioPts) < 9000) || Math.abs(normalizePts(inputSamples[0].pts - initPTS, timeOffsetMpegTS) - nextAudioPts) < 20 * inputSampleDuration)); // compute normalized PTS inputSamples.forEach(function (sample) { sample.pts = normalizePts(sample.pts - initPTS, timeOffsetMpegTS); @@ -22833,9 +22733,7 @@ typeof window !== "undefined" && this.nextAudioPts = nextAudioPts = nextPts; } - _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn( - "[mp4-remuxer]: Injecting " + missing + " audio frame @ " + (nextPts / inputTimeScale).toFixed(3) + "s due to " + Math.round((1000 * delta) / inputTimeScale) + " ms gap." - ); + _utils_logger__WEBPACK_IMPORTED_MODULE_5__["logger"].warn("[mp4-remuxer]: Injecting " + missing + " audio frame @ " + (nextPts / inputTimeScale).toFixed(3) + "s due to " + Math.round((1000 * delta) / inputTimeScale) + " ms gap."); for (var j = 0; j < missing; j++) { var newStamp = Math.max(nextPts, 0); diff --git a/src/renderer/main/components/i18n-editor.js b/src/renderer/main/components/i18n-editor.js index 0482fac6..24cbb25f 100644 --- a/src/renderer/main/components/i18n-editor.js +++ b/src/renderer/main/components/i18n-editor.js @@ -9,35 +9,60 @@ export const i18nEditor = Vue.component("i18n-editor", {

i18n Editor

- + + - +

diff --git a/src/renderer/main/components/sidebar-library-item.js b/src/renderer/main/components/sidebar-library-item.js index e02ba490..419343eb 100644 --- a/src/renderer/main/components/sidebar-library-item.js +++ b/src/renderer/main/components/sidebar-library-item.js @@ -2,8 +2,14 @@ import { html } from "../html.js"; export const sidebarLibraryItem = Vue.component("sidebar-library-item", { template: html` - `, diff --git a/src/renderer/main/components/svg-icon.js b/src/renderer/main/components/svg-icon.js index b2c197dc..8ed68095 100644 --- a/src/renderer/main/components/svg-icon.js +++ b/src/renderer/main/components/svg-icon.js @@ -1,7 +1,13 @@ import { html } from "../html.js"; export const svgIcon = Vue.component("svg-icon", { - template: html`
`, + template: html` +
+ `, props: { name: { type: String, diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index d9ec091d..8e95b1d2 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -3104,9 +3104,7 @@ const app = new Vue({ return; } try { - let mfu = await app.mk.api.v3.music( - "/v1/me/library/playlists?platform=web&extend=editorialVideo&fields%5Bplaylists%5D=lastModifiedDate&filter%5Bfeatured%5D=made-for-you&include%5Blibrary-playlists%5D=catalog&fields%5Blibrary-playlists%5D=artwork%2Cname%2CplayParams%2CdateAdded" - ); + let mfu = await app.mk.api.v3.music("/v1/me/library/playlists?platform=web&extend=editorialVideo&fields%5Bplaylists%5D=lastModifiedDate&filter%5Bfeatured%5D=made-for-you&include%5Blibrary-playlists%5D=catalog&fields%5Blibrary-playlists%5D=artwork%2Cname%2CplayParams%2CdateAdded"); this.madeforyou = mfu.data; } catch (e) { console.log(e); @@ -3286,10 +3284,7 @@ const app = new Vue({ let id, songLang = ""; try { - if ( - jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["header"]["status_code"] == 200 && - jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["header"]["status_code"] == 200 - ) { + if (jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["header"]["status_code"] == 200 && jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["header"]["status_code"] == 200) { id = jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["body"]["track"]["track_id"] ?? ""; lrcfile = jsonResponse["message"]["body"]["macro_calls"]["track.subtitles.get"]["message"]["body"]["subtitle_list"][0]["subtitle"]["subtitle_body"]; vanity_id = jsonResponse["message"]["body"]["macro_calls"]["matcher.track.get"]["message"]["body"]["track"]["commontrack_vanity_id"]; @@ -4202,13 +4197,7 @@ const app = new Vue({ } this.currentArtUrl = ""; this.currentArtUrlRaw = ""; - 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.currentArtUrlRaw = this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ?? ""; this.currentArtUrl = (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"] ?? "").replace("{w}", artworkSize).replace("{h}", artworkSize); if (this.mk.nowPlayingItem._assets[0].artworkURL) { diff --git a/src/web-remote/vue.js b/src/web-remote/vue.js index e9e49672..a58f80cc 100644 --- a/src/web-remote/vue.js +++ b/src/web-remote/vue.js @@ -696,8 +696,7 @@ } function it(e, n, i, o, a, s) { var c, u, l, f; - for (c in e) - (u = e[c]), (l = n[c]), (f = nt(c)), t(u) || (t(l) ? (t(u.fns) && (u = e[c] = rt(u, s)), r(f.once) && (u = e[c] = a(f.name, u, f.capture)), i(f.name, u, f.capture, f.passive, f.params)) : u !== l && ((l.fns = u), (e[c] = l))); + for (c in e) (u = e[c]), (l = n[c]), (f = nt(c)), t(u) || (t(l) ? (t(u.fns) && (u = e[c] = rt(u, s)), r(f.once) && (u = e[c] = a(f.name, u, f.capture)), i(f.name, u, f.capture, f.passive, f.params)) : u !== l && ((l.fns = u), (e[c] = l))); for (c in n) t(e[c]) && o((f = nt(c)).name, n[c], f.capture); } function ot(e, i, o) { @@ -1166,8 +1165,7 @@ var u, l; if ("string" == typeof i) { var f; - (l = (e.$vnode && e.$vnode.ns) || F.getTagNamespace(i)), - (u = F.isReservedTag(i) ? new pe(F.parsePlatformTagName(i), a, s, void 0, void 0, e) : (a && a.pre) || !n((f = Le(e.$options, "components", i))) ? new pe(i, a, s, void 0, void 0, e) : Mt(f, a, e, s, i)); + (l = (e.$vnode && e.$vnode.ns) || F.getTagNamespace(i)), (u = F.isReservedTag(i) ? new pe(F.parsePlatformTagName(i), a, s, void 0, void 0, e) : (a && a.pre) || !n((f = Le(e.$options, "components", i))) ? new pe(i, a, s, void 0, void 0, e) : Mt(f, a, e, s, i)); } else u = Mt(i, a, e, s); return Array.isArray(u) ? u @@ -1862,9 +1860,7 @@ (function (e) { I.forEach(function (t) { e[t] = function (e, n) { - return n - ? ("component" === t && s(n) && ((n.name = n.name || e), (n = this.options._base.extend(n))), "directive" === t && "function" == typeof n && (n = { bind: n, update: n }), (this.options[t + "s"][e] = n), n) - : this.options[t + "s"][e]; + return n ? ("component" === t && s(n) && ((n.name = n.name || e), (n = this.options._base.extend(n))), "directive" === t && "function" == typeof n && (n = { bind: n, update: n }), (this.options[t + "s"][e] = n), n) : this.options[t + "s"][e]; }; }); })(e); @@ -2264,11 +2260,7 @@ } function Mr(t, n, r, i, o, a, s, c) { var u; - (i = i || e).right - ? c - ? (n = "(" + n + ")==='click'?'contextmenu':(" + n + ")") - : "click" === n && ((n = "contextmenu"), delete i.right) - : i.middle && (c ? (n = "(" + n + ")==='click'?'mouseup':(" + n + ")") : "click" === n && (n = "mouseup")), + (i = i || e).right ? (c ? (n = "(" + n + ")==='click'?'contextmenu':(" + n + ")") : "click" === n && ((n = "contextmenu"), delete i.right)) : i.middle && (c ? (n = "(" + n + ")==='click'?'mouseup':(" + n + ")") : "click" === n && (n = "mouseup")), i.capture && (delete i.capture, (n = Ir("!", n, c))), i.once && (delete i.once, (n = Ir("~", n, c))), i.passive && (delete i.passive, (n = Ir("&", n, c))), @@ -2558,9 +2550,7 @@ Oi = "transitionend", Si = "animation", Ti = "animationend"; - Ci && - (void 0 === window.ontransitionend && void 0 !== window.onwebkittransitionend && ((Ai = "WebkitTransition"), (Oi = "webkitTransitionEnd")), - void 0 === window.onanimationend && void 0 !== window.onwebkitanimationend && ((Si = "WebkitAnimation"), (Ti = "webkitAnimationEnd"))); + Ci && (void 0 === window.ontransitionend && void 0 !== window.onwebkittransitionend && ((Ai = "WebkitTransition"), (Oi = "webkitTransitionEnd")), void 0 === window.onanimationend && void 0 !== window.onwebkitanimationend && ((Si = "WebkitAnimation"), (Ti = "webkitAnimationEnd"))); var Ni = V ? window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) @@ -2786,11 +2776,7 @@ var f = e.data, p = e.children, m = e.tag; - n(m) - ? ((e.elm = e.ns ? u.createElementNS(e.ns, m) : u.createElement(m, e)), g(e), h(e, p, t), n(f) && y(e, t), v(i, e.elm, o)) - : r(e.isComment) - ? ((e.elm = u.createComment(e.text)), v(i, e.elm, o)) - : ((e.elm = u.createTextNode(e.text)), v(i, e.elm, o)); + n(m) ? ((e.elm = e.ns ? u.createElementNS(e.ns, m) : u.createElement(m, e)), g(e), h(e, p, t), n(f) && y(e, t), v(i, e.elm, o)) : r(e.isComment) ? ((e.elm = u.createComment(e.text)), v(i, e.elm, o)) : ((e.elm = u.createTextNode(e.text)), v(i, e.elm, o)); } } function d(e, t) { @@ -2894,9 +2880,7 @@ ? (x(h, b, o, i, y), w && u.insertBefore(e, h.elm, u.nextSibling(m.elm)), (h = r[++p]), (b = i[--y])) : or(m, g) ? (x(m, g, o, i, d), w && u.insertBefore(e, m.elm, h.elm), (m = r[--v]), (g = i[++d])) - : (t(s) && (s = ar(r, p, v)), - t((c = n(g.key) ? s[g.key] : C(g, r, p, v))) ? f(g, o, e, h.elm, !1, i, d) : or((l = r[c]), g) ? (x(l, g, o, i, d), (r[c] = void 0), w && u.insertBefore(e, l.elm, h.elm)) : f(g, o, e, h.elm, !1, i, d), - (g = i[++d])); + : (t(s) && (s = ar(r, p, v)), t((c = n(g.key) ? s[g.key] : C(g, r, p, v))) ? f(g, o, e, h.elm, !1, i, d) : or((l = r[c]), g) ? (x(l, g, o, i, d), (r[c] = void 0), w && u.insertBefore(e, l.elm, h.elm)) : f(g, o, e, h.elm, !1, i, d), (g = i[++d])); p > v ? _(e, t(i[y + 1]) ? null : i[y + 1].elm, i, d, y, o) : d > y && $(r, p, v); })(p, h, y, o, l) : n(y) @@ -3015,8 +2999,7 @@ }) : Ji(e, t, n.context), (e._vOptions = [].map.call(e.options, Zi))) - : ("textarea" === n.tag || Yn(e.type)) && - ((e._vModifiers = t.modifiers), t.modifiers.lazy || (e.addEventListener("compositionstart", Gi), e.addEventListener("compositionend", Xi), e.addEventListener("change", Xi), W && (e.vmodel = !0))); + : ("textarea" === n.tag || Yn(e.type)) && ((e._vModifiers = t.modifiers), t.modifiers.lazy || (e.addEventListener("compositionstart", Gi), e.addEventListener("compositionend", Xi), e.addEventListener("change", Xi), W && (e.vmodel = !0))); }, componentUpdated: function (e, t, n) { if ("select" === n.tag) { @@ -3884,8 +3867,7 @@ if (e.component) return Br(e, r, i), !1; if ("select" === o) !(function (e, t, n) { - var r = - 'var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return ' + (n && n.number ? "_n(val)" : "val") + "});"; + var r = 'var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return ' + (n && n.number ? "_n(val)" : "val") + "});"; (r = r + " " + Ur(t, "$event.target.multiple ? $$selectedVal : $$selectedVal[0]")), Mr(e, "change", r, null, !0); })(e, r, i); else if ("input" === o && "checkbox" === a) @@ -4408,9 +4390,7 @@ function Ya(e) { return e.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); } - new RegExp( - "\\b" + "do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b") + "\\b" - ); + new RegExp("\\b" + "do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b") + "\\b"); function Qa(e, t) { try { return new Function(e); From f03b61e5c5c4a593b4b0175b11fe6b32ba03a07c Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 18:05:06 +0100 Subject: [PATCH 09/62] prettier update --- .github/workflows/cider-chores.yml | 4 +--- .prettierignore | 2 +- .prettierrc | 12 ++++++++++-- package.json | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index ed891362..740b265c 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -61,9 +61,7 @@ jobs: ref: ${{ github.head_ref }} - name: Prettify code - uses: creyD/prettier_action@v4.2 - with: - prettier_options: --write src/**/*.{js,json,ts,css,less} + run: npm run format:write - name: Commit Prettier Code uses: stefanzweifel/git-auto-commit-action@v4.14.1 diff --git a/.prettierignore b/.prettierignore index c8c940fc..ee6ef80d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,4 @@ -src/renderer/apple-hls* +src/renderer/*hls*.js build/* src/renderer/lib/* *.min.* diff --git a/.prettierrc b/.prettierrc index 2980127b..13322606 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,13 @@ { - "printWidth": 300, + "printWidth": 600, "singleAttributePerLine": true, - "bracketSameLine": true + "bracketSameLine": true, + "overrides": [ + { + "files": "src/renderer/main/**/*.js", + "options": { + "bracketSameLine": false + } + } + ] } diff --git a/package.json b/package.json index 083c0106..208b2d5c 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "msft": "npm run build && electron-builder -c msft-package.json", "mstest": "npm run build && electron-builder -c msft-test.json", "postinstall": "electron-builder install-app-deps", - "format:check": "prettier --check \"src/**/*.{js,json,ts,css,less}\"", - "format:write": "prettier --write \"src/**/*.{js,json,ts,css,less}\"" + "format:check": "npx prettier --check \"src/**/*.{js,json,ts,less}\"", + "format:write": "npx prettier --write \"src/**/*.{js,json,ts,less}\"" }, "dependencies": { "@sentry/electron": "^4.0.2", From 94e8cd460ae2ecdd6438e708009c05db92b8ab11 Mon Sep 17 00:00:00 2001 From: coredev-uk Date: Fri, 16 Sep 2022 17:05:40 +0000 Subject: [PATCH 10/62] chore: Prettified Code [ci skip] --- src/main/base/browserwindow.ts | 17 +-- src/main/plugins/chromecast.ts | 6 +- src/renderer/main/components/i18n-editor.js | 27 ++-- .../main/components/sidebar-library-item.js | 6 +- src/renderer/main/components/svg-icon.js | 3 +- src/web-remote/vue.js | 138 ++---------------- 6 files changed, 38 insertions(+), 159 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 3cdbe555..cf4beadd 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -731,18 +731,11 @@ export class BrowserWindow { details.requestHeaders["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cider/1.0.0 Chrome/96.0.4664.45 Electron/16.0.0 Safari/537.36"; } if (details.url.includes("https://qq.com")) { - (details.requestHeaders["Accept"] = "*/*"), - (details.requestHeaders["Accept-Encoding"] = "gzip, deflate, br"), - (details.requestHeaders["Accept-Language"] = "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"), - (details.requestHeaders["Referer"] = "https://y.qq.com/"), - (details.requestHeaders["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 ("); + (details.requestHeaders["Accept"] = "*/*"), (details.requestHeaders["Accept-Encoding"] = "gzip, deflate, br"), (details.requestHeaders["Accept-Language"] = "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"), (details.requestHeaders["Referer"] = "https://y.qq.com/"), (details.requestHeaders["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 ("); ("KHTML, like Gecko) Mobile/17D50 UCBrowser/12.8.2.1268 Mobile AliApp(TUnionSDK/0.1.20.3) "); } if (details.url.includes("https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg")) { - (details.requestHeaders["Accept"] = "*/*"), - (details.requestHeaders["Accept-Encoding"] = "gzip, deflate, br"), - (details.requestHeaders["Accept-Language"] = "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"), - (details.requestHeaders["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 ("); + (details.requestHeaders["Accept"] = "*/*"), (details.requestHeaders["Accept-Encoding"] = "gzip, deflate, br"), (details.requestHeaders["Accept-Language"] = "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"), (details.requestHeaders["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 ("); ("KHTML, like Gecko) Mobile/17D50 UCBrowser/12.8.2.1268 Mobile AliApp(TUnionSDK/0.1.20.3) "); details.requestHeaders["Referer"] = "https://y.qq.com/portal/player.html"; } @@ -1504,11 +1497,7 @@ export class BrowserWindow { if (details.family === "IPv4" && !details.internal) { if (!/(loopback|vmware|internal|hamachi|vboxnet|virtualbox)/gi.test(dev + (alias ? ":" + alias : ""))) { if (details.address.substring(0, 8) === "192.168." || details.address.substring(0, 7) === "172.16." || details.address.substring(0, 3) === "10.") { - if ( - !ip.startsWith("192.168.") || - (String(ip2).startsWith("192.168.") && !ip.startsWith("192.168.") && String(ip2).startsWith("172.16.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.")) || - (String(ip2).startsWith("10.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.") && !ip.startsWith("10.")) - ) { + if (!ip.startsWith("192.168.") || (String(ip2).startsWith("192.168.") && !ip.startsWith("192.168.") && String(ip2).startsWith("172.16.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.")) || (String(ip2).startsWith("10.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.") && !ip.startsWith("10."))) { ip = details.address; } ++alias; diff --git a/src/main/plugins/chromecast.ts b/src/main/plugins/chromecast.ts index 46110e4e..84dc9321 100644 --- a/src/main/plugins/chromecast.ts +++ b/src/main/plugins/chromecast.ts @@ -200,11 +200,7 @@ export default class ChromecastPlugin { if (details.family === "IPv4" && !details.internal) { if (!/(loopback|vmware|internal|hamachi|vboxnet|virtualbox)/gi.test(dev + (alias ? ":" + alias : ""))) { if (details.address.substring(0, 8) === "192.168." || details.address.substring(0, 7) === "172.16." || details.address.substring(0, 3) === "10.") { - if ( - !ip.startsWith("192.168.") || - (ip2.startsWith("192.168.") && !ip.startsWith("192.168.") && ip2.startsWith("172.16.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.")) || - (ip2.startsWith("10.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.") && !ip.startsWith("10.")) - ) { + if (!ip.startsWith("192.168.") || (ip2.startsWith("192.168.") && !ip.startsWith("192.168.") && ip2.startsWith("172.16.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.")) || (ip2.startsWith("10.") && !ip.startsWith("192.168.") && !ip.startsWith("172.16.") && !ip.startsWith("10."))) { ip = details.address; } ++alias; diff --git a/src/renderer/main/components/i18n-editor.js b/src/renderer/main/components/i18n-editor.js index 24cbb25f..f64a3517 100644 --- a/src/renderer/main/components/i18n-editor.js +++ b/src/renderer/main/components/i18n-editor.js @@ -12,20 +12,24 @@ export const i18nEditor = Vue.component("i18n-editor", {
@@ -35,7 +39,8 @@ export const i18nEditor = Vue.component("i18n-editor", { diff --git a/src/renderer/main/components/sidebar-library-item.js b/src/renderer/main/components/sidebar-library-item.js index 419343eb..db9f687b 100644 --- a/src/renderer/main/components/sidebar-library-item.js +++ b/src/renderer/main/components/sidebar-library-item.js @@ -5,11 +5,13 @@ export const sidebarLibraryItem = Vue.component("sidebar-library-item", { `, diff --git a/src/renderer/main/components/svg-icon.js b/src/renderer/main/components/svg-icon.js index 8ed68095..99671d07 100644 --- a/src/renderer/main/components/svg-icon.js +++ b/src/renderer/main/components/svg-icon.js @@ -6,7 +6,8 @@ export const svgIcon = Vue.component("svg-icon", { class="_svg-icon" :class="classes" :svg-name="name" - :style="{'--icon': 'url(' + url + ')'}"> + :style="{'--icon': 'url(' + url + ')'}" + > `, props: { name: { diff --git a/src/web-remote/vue.js b/src/web-remote/vue.js index a58f80cc..12f41ec6 100644 --- a/src/web-remote/vue.js +++ b/src/web-remote/vue.js @@ -262,29 +262,7 @@ ue.pop(), (ce.target = ue[ue.length - 1]); } var pe = function (e, t, n, r, i, o, a, s) { - (this.tag = e), - (this.data = t), - (this.children = n), - (this.text = r), - (this.elm = i), - (this.ns = void 0), - (this.context = o), - (this.fnContext = void 0), - (this.fnOptions = void 0), - (this.fnScopeId = void 0), - (this.key = t && t.key), - (this.componentOptions = a), - (this.componentInstance = void 0), - (this.parent = void 0), - (this.raw = !1), - (this.isStatic = !1), - (this.isRootInsert = !0), - (this.isComment = !1), - (this.isCloned = !1), - (this.isOnce = !1), - (this.asyncFactory = s), - (this.asyncMeta = void 0), - (this.isAsyncPlaceholder = !1); + (this.tag = e), (this.data = t), (this.children = n), (this.text = r), (this.elm = i), (this.ns = void 0), (this.context = o), (this.fnContext = void 0), (this.fnOptions = void 0), (this.fnScopeId = void 0), (this.key = t && t.key), (this.componentOptions = a), (this.componentInstance = void 0), (this.parent = void 0), (this.raw = !1), (this.isStatic = !1), (this.isRootInsert = !0), (this.isComment = !1), (this.isCloned = !1), (this.isOnce = !1), (this.asyncFactory = s), (this.asyncMeta = void 0), (this.isAsyncPlaceholder = !1); }, de = { child: { configurable: !0 } }; (de.child.get = function () { @@ -722,20 +700,7 @@ ? (function e(o, a) { var s = []; var c, u, l, f; - for (c = 0; c < o.length; c++) - t((u = o[c])) || - "boolean" == typeof u || - ((l = s.length - 1), - (f = s[l]), - Array.isArray(u) - ? u.length > 0 && (ct((u = e(u, (a || "") + "_" + c))[0]) && ct(f) && ((s[l] = he(f.text + u[0].text)), u.shift()), s.push.apply(s, u)) - : i(u) - ? ct(f) - ? (s[l] = he(f.text + u)) - : "" !== u && s.push(he(u)) - : ct(u) && ct(f) - ? (s[l] = he(f.text + u.text)) - : (r(o._isVList) && n(u.tag) && t(u.key) && n(a) && (u.key = "__vlist" + a + "_" + c + "__"), s.push(u))); + for (c = 0; c < o.length; c++) t((u = o[c])) || "boolean" == typeof u || ((l = s.length - 1), (f = s[l]), Array.isArray(u) ? u.length > 0 && (ct((u = e(u, (a || "") + "_" + c))[0]) && ct(f) && ((s[l] = he(f.text + u[0].text)), u.shift()), s.push.apply(s, u)) : i(u) ? (ct(f) ? (s[l] = he(f.text + u)) : "" !== u && s.push(he(u))) : ct(u) && ct(f) ? (s[l] = he(f.text + u.text)) : (r(o._isVList) && n(u.tag) && t(u.key) && n(a) && (u.key = "__vlist" + a + "_" + c + "__"), s.push(u))); return s; })(e) : void 0; @@ -1883,9 +1848,7 @@ Mn = function (e, t) { return Bn(t) || "false" === t ? "false" : "contenteditable" === e && In(t) ? t : "true"; }, - Fn = p( - "allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible" - ), + Fn = p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"), Pn = "http://www.w3.org/1999/xlink", Rn = function (e) { return ":" === e.charAt(5) && "xlink" === e.slice(0, 5); @@ -2105,19 +2068,7 @@ } } function hr(e, t, n, r) { - r || e.tagName.indexOf("-") > -1 - ? mr(e, t, n) - : Fn(t) - ? Bn(n) - ? e.removeAttribute(t) - : ((n = "allowfullscreen" === t && "EMBED" === e.tagName ? "true" : t), e.setAttribute(t, n)) - : Ln(t) - ? e.setAttribute(t, Mn(t, n)) - : Rn(t) - ? Bn(n) - ? e.removeAttributeNS(Pn, Hn(t)) - : e.setAttributeNS(Pn, t, n) - : mr(e, t, n); + r || e.tagName.indexOf("-") > -1 ? mr(e, t, n) : Fn(t) ? (Bn(n) ? e.removeAttribute(t) : ((n = "allowfullscreen" === t && "EMBED" === e.tagName ? "true" : t), e.setAttribute(t, n))) : Ln(t) ? e.setAttribute(t, Mn(t, n)) : Rn(t) ? (Bn(n) ? e.removeAttributeNS(Pn, Hn(t)) : e.setAttributeNS(Pn, t, n)) : mr(e, t, n); } function mr(e, t, n) { if (Bn(n)) e.removeAttribute(t); @@ -2260,11 +2211,7 @@ } function Mr(t, n, r, i, o, a, s, c) { var u; - (i = i || e).right ? (c ? (n = "(" + n + ")==='click'?'contextmenu':(" + n + ")") : "click" === n && ((n = "contextmenu"), delete i.right)) : i.middle && (c ? (n = "(" + n + ")==='click'?'mouseup':(" + n + ")") : "click" === n && (n = "mouseup")), - i.capture && (delete i.capture, (n = Ir("!", n, c))), - i.once && (delete i.once, (n = Ir("~", n, c))), - i.passive && (delete i.passive, (n = Ir("&", n, c))), - i.native ? (delete i.native, (u = t.nativeEvents || (t.nativeEvents = {}))) : (u = t.events || (t.events = {})); + (i = i || e).right ? (c ? (n = "(" + n + ")==='click'?'contextmenu':(" + n + ")") : "click" === n && ((n = "contextmenu"), delete i.right)) : i.middle && (c ? (n = "(" + n + ")==='click'?'mouseup':(" + n + ")") : "click" === n && (n = "mouseup")), i.capture && (delete i.capture, (n = Ir("!", n, c))), i.once && (delete i.once, (n = Ir("~", n, c))), i.passive && (delete i.passive, (n = Ir("&", n, c))), i.native ? (delete i.native, (u = t.nativeEvents || (t.nativeEvents = {}))) : (u = t.events || (t.events = {})); var l = Hr({ value: r.trim(), dynamic: c }, s); i !== e && (l.modifiers = i); var f = u[n]; @@ -2628,30 +2575,7 @@ n(i._leaveCb) && ((i._leaveCb.cancelled = !0), i._leaveCb()); var a = $i(e.data.transition); if (!t(a) && !n(i._enterCb) && 1 === i.nodeType) { - for ( - var s = a.css, - c = a.type, - u = a.enterClass, - l = a.enterToClass, - p = a.enterActiveClass, - d = a.appearClass, - v = a.appearToClass, - h = a.appearActiveClass, - m = a.beforeEnter, - y = a.enter, - g = a.afterEnter, - _ = a.enterCancelled, - b = a.beforeAppear, - $ = a.appear, - w = a.afterAppear, - C = a.appearCancelled, - x = a.duration, - k = Zt, - A = Zt.$vnode; - A && A.parent; - - ) - (k = A.context), (A = A.parent); + for (var s = a.css, c = a.type, u = a.enterClass, l = a.enterToClass, p = a.enterActiveClass, d = a.appearClass, v = a.appearToClass, h = a.appearActiveClass, m = a.beforeEnter, y = a.enter, g = a.afterEnter, _ = a.enterCancelled, b = a.beforeAppear, $ = a.appear, w = a.afterAppear, C = a.appearCancelled, x = a.duration, k = Zt, A = Zt.$vnode; A && A.parent; ) (k = A.context), (A = A.parent); var O = !k._isMounted || !e.isRootInsert; if (!O || $ || "" === $) { var S = O && d ? d : u, @@ -3361,9 +3285,7 @@ }, $o = p("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"), wo = p("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"), - Co = p( - "address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track" - ), + Co = p("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"), xo = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/, ko = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/, Ao = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + P.source + "]*", @@ -3765,14 +3687,7 @@ for (t = 0, n = u.length; t < n; t++) if (((r = i = u[t].name), (o = u[t].value), Xo.test(r))) if (((e.hasBindings = !0), (a = ma(r.replace(Xo, ""))) && (r = r.replace(ia, "")), ra.test(r))) - (r = r.replace(ra, "")), - (o = Or(o)), - (c = ta.test(r)) && (r = r.slice(1, -1)), - a && - (a.prop && !c && "innerHtml" === (r = b(r)) && (r = "innerHTML"), - a.camel && !c && (r = b(r)), - a.sync && ((s = Ur(o, "$event")), c ? Mr(e, '"update:"+(' + r + ")", s, null, !1, 0, u[t], !0) : (Mr(e, "update:" + b(r), s, null, !1, 0, u[t]), C(r) !== b(r) && Mr(e, "update:" + C(r), s, null, !1, 0, u[t])))), - (a && a.prop) || (!e.component && Wo(e.tag, e.attrsMap.type, r)) ? Er(e, r, o, u[t], c) : jr(e, r, o, u[t], c); + (r = r.replace(ra, "")), (o = Or(o)), (c = ta.test(r)) && (r = r.slice(1, -1)), a && (a.prop && !c && "innerHtml" === (r = b(r)) && (r = "innerHTML"), a.camel && !c && (r = b(r)), a.sync && ((s = Ur(o, "$event")), c ? Mr(e, '"update:"+(' + r + ")", s, null, !1, 0, u[t], !0) : (Mr(e, "update:" + b(r), s, null, !1, 0, u[t]), C(r) !== b(r) && Mr(e, "update:" + C(r), s, null, !1, 0, u[t])))), (a && a.prop) || (!e.component && Wo(e.tag, e.attrsMap.type, r)) ? Er(e, r, o, u[t], c) : jr(e, r, o, u[t], c); else if (Go.test(r)) (r = r.replace(Go, "")), (c = ta.test(r)) && (r = r.slice(1, -1)), Mr(e, r, o, a, !1, 0, u[t], c); else { var l = (r = r.replace(Xo, "")).match(na), @@ -3876,28 +3791,7 @@ i = Fr(e, "value") || "null", o = Fr(e, "true-value") || "true", a = Fr(e, "false-value") || "false"; - Er(e, "checked", "Array.isArray(" + t + ")?_i(" + t + "," + i + ")>-1" + ("true" === o ? ":(" + t + ")" : ":_q(" + t + "," + o + ")")), - Mr( - e, - "change", - "var $$a=" + - t + - ",$$el=$event.target,$$c=$$el.checked?(" + - o + - "):(" + - a + - ");if(Array.isArray($$a)){var $$v=" + - (r ? "_n(" + i + ")" : i) + - ",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&(" + - Ur(t, "$$a.concat([$$v])") + - ")}else{$$i>-1&&(" + - Ur(t, "$$a.slice(0,$$i).concat($$a.slice($$i+1))") + - ")}}else{" + - Ur(t, "$$c") + - "}", - null, - !0 - ); + Er(e, "checked", "Array.isArray(" + t + ")?_i(" + t + "," + i + ")>-1" + ("true" === o ? ":(" + t + ")" : ":_q(" + t + "," + o + ")")), Mr(e, "change", "var $$a=" + t + ",$$el=$event.target,$$c=$$el.checked?(" + o + "):(" + a + ");if(Array.isArray($$a)){var $$v=" + (r ? "_n(" + i + ")" : i) + ",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&(" + Ur(t, "$$a.concat([$$v])") + ")}else{$$i>-1&&(" + Ur(t, "$$a.slice(0,$$i).concat($$a.slice($$i+1))") + ")}}else{" + Ur(t, "$$c") + "}", null, !0); })(e, r, i); else if ("input" === o && "radio" === a) !(function (e, t, n) { @@ -4225,19 +4119,7 @@ for (r = 0, i = n.length; r < i; r++) { (o = n[r]), (a = !0); var u = t.directives[o.name]; - u && (a = !!u(e, o, t.warn)), - a && - ((c = !0), - (s += - '{name:"' + - o.name + - '",rawName:"' + - o.rawName + - '"' + - (o.value ? ",value:(" + o.value + "),expression:" + JSON.stringify(o.value) : "") + - (o.arg ? ",arg:" + (o.isDynamicArg ? o.arg : '"' + o.arg + '"') : "") + - (o.modifiers ? ",modifiers:" + JSON.stringify(o.modifiers) : "") + - "},")); + u && (a = !!u(e, o, t.warn)), a && ((c = !0), (s += '{name:"' + o.name + '",rawName:"' + o.rawName + '"' + (o.value ? ",value:(" + o.value + "),expression:" + JSON.stringify(o.value) : "") + (o.arg ? ",arg:" + (o.isDynamicArg ? o.arg : '"' + o.arg + '"') : "") + (o.modifiers ? ",modifiers:" + JSON.stringify(o.modifiers) : "") + "},")); } if (c) return s.slice(0, -1) + "]"; })(e, t); From 6dafd1f173d6ac851b88fc9728f55b30083adef6 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 18:06:17 +0100 Subject: [PATCH 11/62] shit --- .prettierrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierrc b/.prettierrc index 13322606..b93c35c2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,7 +6,7 @@ { "files": "src/renderer/main/**/*.js", "options": { - "bracketSameLine": false + "singleAttributePerLine": false } } ] From 3d4776a8db6476ecb7f964c6c93681364aca7dde Mon Sep 17 00:00:00 2001 From: coredev-uk Date: Fri, 16 Sep 2022 17:06:51 +0000 Subject: [PATCH 12/62] chore: Prettified Code [ci skip] --- src/renderer/main/components/i18n-editor.js | 52 ++++--------------- .../main/components/sidebar-library-item.js | 12 +---- src/renderer/main/components/svg-icon.js | 9 +--- 3 files changed, 12 insertions(+), 61 deletions(-) diff --git a/src/renderer/main/components/i18n-editor.js b/src/renderer/main/components/i18n-editor.js index f64a3517..0482fac6 100644 --- a/src/renderer/main/components/i18n-editor.js +++ b/src/renderer/main/components/i18n-editor.js @@ -9,69 +9,35 @@ export const i18nEditor = Vue.component("i18n-editor", {

i18n Editor

- + + - +

diff --git a/src/renderer/main/components/sidebar-library-item.js b/src/renderer/main/components/sidebar-library-item.js index db9f687b..e02ba490 100644 --- a/src/renderer/main/components/sidebar-library-item.js +++ b/src/renderer/main/components/sidebar-library-item.js @@ -2,16 +2,8 @@ import { html } from "../html.js"; export const sidebarLibraryItem = Vue.component("sidebar-library-item", { template: html` - `, diff --git a/src/renderer/main/components/svg-icon.js b/src/renderer/main/components/svg-icon.js index 99671d07..b2c197dc 100644 --- a/src/renderer/main/components/svg-icon.js +++ b/src/renderer/main/components/svg-icon.js @@ -1,14 +1,7 @@ import { html } from "../html.js"; export const svgIcon = Vue.component("svg-icon", { - template: html` -
- `, + template: html`
`, props: { name: { type: String, From 9ad96c4889ac0191617b79c60c85485cacc1000e Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 18:21:07 +0100 Subject: [PATCH 13/62] Update stale-issues.yml [ci skip] --- .github/workflows/stale-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 3307a8b2..7c3309c3 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -19,4 +19,4 @@ jobs: stale-issue-label: "stale" stale-pr-label: "stale" exempt-all-assignees: true - exempt-issue-labels: 'more-info,work-in-progress,accessibility-feature,help-wanted' + exempt-issue-labels: 'more-info,work-in-progress,accessibility-feature,help-wanted,persist' From 046cee6348f442d202eb769998d6d64185c3341f Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 18:39:39 +0100 Subject: [PATCH 14/62] Fix LastFM Filter Types --- src/i18n/en_US.json | 1 + src/i18n/source/en_US.json | 1 + src/main/base/browserwindow.ts | 2 +- src/main/plugins/lastfm.ts | 6 ++++-- src/main/plugins/raop.ts | 4 ++-- src/renderer/views/components/settings-window.ejs | 5 +++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 8d2dc287..3a64df6a 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -548,6 +548,7 @@ "settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)", "settings.option.connectivity.lastfmScrobble.filterLoop.description": "Prevent looped tracks from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.filterTypes": "Filter Media Types (Last.fm)", + "settings.option.connectivity.lastfmScrobble.filterTypes.description": "Prevent tracks of the selected media types from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.manualToken": "Enter Last.fm Token Manually", "settings.option.connectivity.lastfmScrobble.manualToken.link": "Click here to get a Last.fm token", "settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm Connection Timed Out", diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 8d2dc287..3a64df6a 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -548,6 +548,7 @@ "settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)", "settings.option.connectivity.lastfmScrobble.filterLoop.description": "Prevent looped tracks from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.filterTypes": "Filter Media Types (Last.fm)", + "settings.option.connectivity.lastfmScrobble.filterTypes.description": "Prevent tracks of the selected media types from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.manualToken": "Enter Last.fm Token Manually", "settings.option.connectivity.lastfmScrobble.manualToken.link": "Click here to get a Last.fm token", "settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm Connection Timed Out", diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index cf4beadd..3e06e7d2 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -1350,7 +1350,7 @@ export class BrowserWindow { .then(async (buffer) => { const metadata = await mm.parseBuffer(buffer, "audio/x-m4a"); let SoundCheckTag = metadata.native.iTunes[1].value; - console.log("sc", SoundCheckTag); + console.debug("sc", SoundCheckTag); BrowserWindow.win.webContents.send("SoundCheckTag", SoundCheckTag); }) .catch((err) => { diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index b9d4cc2a..bfceeea3 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -170,7 +170,7 @@ export default class lastfm { return; } - if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.type] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return; // Scrobble const scrobble = { @@ -210,7 +210,9 @@ export default class lastfm { return; } - if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.type] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return; + + console.log(this._utils.getStoreValue("connectivity.lastfm.filter_types")); const nowPlaying = { artist: attributes.lfmTrack.artist.name, diff --git a/src/main/plugins/raop.ts b/src/main/plugins/raop.ts index cdca5b52..9140ce8e 100644 --- a/src/main/plugins/raop.ts +++ b/src/main/plugins/raop.ts @@ -159,7 +159,7 @@ export default class RAOP { electron.ipcMain.on("getAirplayDevice", (event, data) => { this.castDevices = []; - console.log("scan for airplay devices"); + console.debug("scan for airplay devices"); const browser = this.mdns.createBrowser(this.mdns.tcp("raop")); browser.on("ready", browser.discover); @@ -168,7 +168,7 @@ export default class RAOP { if (service.addresses && service.fullname && service.fullname.includes("_raop._tcp")) { // console.log(service.txt) this._win.webContents.executeJavaScript(`console.log( - "${service.name} ${service.host}:${service.port} ${service.addresses} ${service.fullname}" + "${service.name} ${service.host}:${service.port} ${service.addresses} ${service.fullname}" )`); let itemname = service.fullname.substring(service.fullname.indexOf("@") + 1, service.fullname.indexOf("._raop._tcp")); this.ondeviceup(itemname, service.host, service.port, service.addresses, service.txt); diff --git a/src/renderer/views/components/settings-window.ejs b/src/renderer/views/components/settings-window.ejs index f4b6ec89..d569b7e9 100644 --- a/src/renderer/views/components/settings-window.ejs +++ b/src/renderer/views/components/settings-window.ejs @@ -1118,11 +1118,12 @@
{{$root.getLz('settings.option.connectivity.lastfmScrobble.filterTypes')}} + {{$root.getLz('settings.option.connectivity.lastfmScrobble.filterTypes.description')}}
From cf60a6ef06039271d13c6080a2e3e4b0efac3f71 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 19:11:54 +0100 Subject: [PATCH 15/62] localisation for misc notifications --- src/i18n/en_US.json | 2 ++ src/i18n/source/en_US.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 3a64df6a..6fe6649f 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -10,6 +10,7 @@ "notification.updatingLibrarySongs": "Updating library songs...", "notification.updatingLibraryAlbums": "Updating library albums...", "notification.updatingLibraryArtists": "Updating library artists...", + "notification.buildingPlaylistCache": "Building Playlist Cache...", "term.variables": "Variables", "term.appleInc": "Apple Inc.", "term.appleMusic": "Apple Music", @@ -494,6 +495,7 @@ "settings.option.visual.theme.viewInfo": "View Info", "settings.option.visual.theme.github.available": "Available", "settings.option.visual.theme.github.applied": "Applied", + "settings.notyf.visual.theme.updateAvailable": "[Themes] {{ theme }} has an update available", "settings.notyf.visual.theme.install.success": "Theme installed successfully", "settings.notyf.visual.theme.install.error": "Theme installation failed", "settings.header.visual.plugin": "Plugin", diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 3a64df6a..6fe6649f 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -10,6 +10,7 @@ "notification.updatingLibrarySongs": "Updating library songs...", "notification.updatingLibraryAlbums": "Updating library albums...", "notification.updatingLibraryArtists": "Updating library artists...", + "notification.buildingPlaylistCache": "Building Playlist Cache...", "term.variables": "Variables", "term.appleInc": "Apple Inc.", "term.appleMusic": "Apple Music", @@ -494,6 +495,7 @@ "settings.option.visual.theme.viewInfo": "View Info", "settings.option.visual.theme.github.available": "Available", "settings.option.visual.theme.github.applied": "Applied", + "settings.notyf.visual.theme.updateAvailable": "[Themes] {{ theme }} has an update available", "settings.notyf.visual.theme.install.success": "Theme installed successfully", "settings.notyf.visual.theme.install.error": "Theme installation failed", "settings.header.visual.plugin": "Plugin", From a81ff286bbe4ef1fe37ae58e3c8fbc6d7a9a2caa Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 19:12:16 +0100 Subject: [PATCH 16/62] auto language on oobe --- src/main/base/store.ts | 1 - src/renderer/main/vueapp.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/base/store.ts b/src/main/base/store.ts index ad94b9e8..a2a98363 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -240,7 +240,6 @@ export class Store { }; constructor() { - this.defaults.general.language = this.checkLocale(app.getLocale().replace("-", "_")) ?? "en_US"; Store.cfg = new ElectronStore({ name: "cider-config", defaults: this.defaults, diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 8e95b1d2..3341d4f9 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -1502,7 +1502,7 @@ const app = new Vue({ } } - this.library.backgroundNotification.message = "Building playlist cache..."; + this.library.backgroundNotification.message = app.getLz("notification.buildingPlaylistCache"); this.library.backgroundNotification.show = true; async function deepScan(parent = "p.playlistsroot") { From 599304ee4b5d83606fa7de4729e8f0b63b33bc7e Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 19:12:32 +0100 Subject: [PATCH 17/62] auto language on oobe --- src/renderer/main/vueapp.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 3341d4f9..eda5f8c7 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -294,6 +294,12 @@ const app = new Vue({ }, async oobeInit() { this.appMode = "oobe"; + for (const [k, v] of Object.entries(ipcRenderer.sendSync("get-i18n-listing"))) { + if (v.code === navigator.language.replace("-", "_")) { + this.cfg.general.language = v.code; + break; + } + } this.setLz(this.cfg.general.language); this.setLzManual(); clearTimeout(this.hangtimer); @@ -1210,7 +1216,7 @@ const app = new Vue({ const notify = notyf.open({ className: "notyf-info", type: "info", - message: `[Themes] ${theme.name} has an update available.`, + message: app.stringTemplateParser(app.getLz("settings.notyf.visual.theme.updateAvailable"), { repo: theme.name }), }); notify.on("click", () => { app.openSettingsPage("github-themes"); @@ -1486,15 +1492,15 @@ const app = new Vue({ const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks"); if (cachedPlaylist) { - console.debug("using cached playlists"); + console.debug("[CiderCache] Using cached playlist"); this.playlists.listing = cachedPlaylist; self.sortPlaylists(); } else { - console.debug("playlist has no cache"); + console.debug("[CiderCache] Playlist has no cache"); } if (cachedTrackMapping) { - console.debug("using cached track mapping"); + console.debug("[CiderCache] Using cached track mapping"); this.playlists.trackMapping = cachedTrackMapping; } if (localOnly) { From cf1d9c415cd6723f54e23fb6a31a926361cecb31 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 20:14:34 +0100 Subject: [PATCH 18/62] attempt at fixing #982 --- src/renderer/main/vueapp.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index eda5f8c7..2f35bbb6 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -2433,12 +2433,26 @@ const app = new Vue({ self.library.songs.displayListing.sort((a, b) => { let aa = a.attributes[prefs.sort]; let bb = b.attributes[prefs.sort]; - if (prefs.sort == "genre") { + if (prefs.sort === "genre") { aa = a.attributes.genreNames[0]; bb = b.attributes.genreNames[0]; - } else if (prefs.sort == "dateAdded") { + } else if (prefs.sort === "dateAdded") { aa = a.relationships?.albums?.data[0]?.attributes?.dateAdded; bb = b.relationships?.albums?.data[0]?.attributes?.dateAdded; + } else if (prefs.sort === "artistName") { + if (a.relationships?.artists?.data[0]?.id === b.relationships?.artists?.data[0]?.id) { + aa = a.attributes.albumName; + bb = b.attributes.albumName; + } + if (a.relationships?.albums?.data[0]?.id === b.relationships?.albums?.data[0]?.id) { + aa = a.attributes.trackNumber; + bb = b.attributes.trackNumber; + } + } else if (prefs.sort === "albumName") { + if (a.relationships?.albums?.data[0]?.id === b.relationships?.albums?.data[0]?.id) { + aa = a.attributes.trackNumber; + bb = b.attributes.trackNumber; + } } if (aa == null) { aa = ""; @@ -2446,13 +2460,13 @@ const app = new Vue({ if (bb == null) { bb = ""; } - if (prefs.sortOrder == "asc") { + if (prefs.sortOrder === "asc") { if (aa.toString().match(/^\d+$/) && bb.toString().match(/^\d+$/)) { return aa - bb; } else { return aa.toString().toLowerCase().localeCompare(bb.toString().toLowerCase()); } - } else if (prefs.sortOrder == "desc") { + } else if (prefs.sortOrder === "desc") { if (aa.toString().match(/^\d+$/) && bb.toString().match(/^\d+$/)) { return bb - aa; } else { From 5b01c1599622519b07c4d3464f7880ad0713b19a Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 20:14:47 +0100 Subject: [PATCH 19/62] and this just annoys me [ci skip] --- src/main/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index 50d3af87..abae1125 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,7 +1,7 @@ require("v8-compile-cache"); import { app, components, ipcMain } from "electron"; - +import { join } from "path"; import { Store } from "./base/store"; import { AppEvents } from "./base/app"; import { Plugins } from "./base/plugins"; @@ -9,6 +9,10 @@ import { BrowserWindow } from "./base/browserwindow"; import { init as Sentry } from "@sentry/electron"; import { RewriteFrames } from "@sentry/integrations"; +if (!app.isPackaged) { + app.setPath("userData", join(app.getPath("appData"), "Cider")); +} + // Analytics for debugging fun yeah. Sentry({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214", From 4045c4f86bc7e9c225d87d152820e11fb3e41964 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 21:02:50 +0100 Subject: [PATCH 20/62] crowdin action --- .github/workflows/cider-chores.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 740b265c..7daa90e4 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - node-version: [ 18 ] + node-version: [18] permissions: contents: write @@ -31,7 +31,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - cache: 'pnpm' + cache: "pnpm" - name: Update lockfile run: pnpm i --lockfile-only @@ -48,7 +48,7 @@ jobs: strategy: matrix: - node-version: [ 18 ] + node-version: [18] permissions: contents: write @@ -69,3 +69,21 @@ jobs: commit_message: "chore: Prettified Code\n [ci skip]" commit_user_name: "cider-chore[bot]" commit_user_email: "cider-chore[bot]@users.noreply.github.com" + + synchronize-with-crowdin: + runs-on: ubuntu-latest + if: ${{ false }} # disable for now + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: crowdin action + uses: crowdin/github-action@1.4.13 + with: + upload_translations: true + download_translations: true + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} From dfb1ede0d44a7e08815170b2366d88029b7d1f6a Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 16 Sep 2022 23:10:19 +0100 Subject: [PATCH 21/62] oops --- src/renderer/main/vueapp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 2f35bbb6..28e316e2 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -1216,7 +1216,7 @@ const app = new Vue({ const notify = notyf.open({ className: "notyf-info", type: "info", - message: app.stringTemplateParser(app.getLz("settings.notyf.visual.theme.updateAvailable"), { repo: theme.name }), + message: app.stringTemplateParser(app.getLz("settings.notyf.visual.theme.updateAvailable"), { theme: theme.name }), }); notify.on("click", () => { app.openSettingsPage("github-themes"); From 09030df8b8d4f82d69b5eb6fada63ddb3ca59303 Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 17 Sep 2022 01:04:35 +0100 Subject: [PATCH 22/62] Remove from playlist icon --- src/renderer/views/pages/cider-playlist.ejs | 2 ++ src/renderer/views/pages/playlist-inline.ejs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/renderer/views/pages/cider-playlist.ejs b/src/renderer/views/pages/cider-playlist.ejs index 86e078d4..e67e0093 100644 --- a/src/renderer/views/pages/cider-playlist.ejs +++ b/src/renderer/views/pages/cider-playlist.ejs @@ -647,6 +647,7 @@ return { normal: [ { + icon: "./assets/feather/x-circle.svg", name: app.getLz('action.removeFromPlaylist'), action: () => { self.remove() @@ -655,6 +656,7 @@ ], multiple: [ { + icon: "./assets/feather/x-circle.svg", name: app.getLz('action.removeFromPlaylist'), action: () => { self.remove() diff --git a/src/renderer/views/pages/playlist-inline.ejs b/src/renderer/views/pages/playlist-inline.ejs index c42fc84b..1c306440 100644 --- a/src/renderer/views/pages/playlist-inline.ejs +++ b/src/renderer/views/pages/playlist-inline.ejs @@ -446,6 +446,7 @@ return { normal: [ { + icon: "./assets/feather/x-circle.svg", name: app.getLz('action.removeFromPlaylist'), action: () => { self.remove() @@ -454,6 +455,7 @@ ], multiple: [ { + icon: "./assets/feather/x-circle.svg", name: app.getLz('action.removeFromPlaylist'), action: () => { self.remove() From 31e76d540e838b112c47c78c20203d4d9336b755 Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 17 Sep 2022 01:04:58 +0100 Subject: [PATCH 23/62] duplicate item prompt on adding songs to playlist --- src/i18n/en_US.json | 1 + src/i18n/source/en_US.json | 1 + src/renderer/main/vueapp.js | 67 ++++++++++++++++++++++++++++--------- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 6fe6649f..9163dd1b 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -261,6 +261,7 @@ "action.removeFromQueue.success": "Removed from Queue", "action.removeFromQueue.error": "Error Removing from Queue", "action.createPlaylist": "Create a New Playlist", + "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.addToPlaylist": "Add to Playlist", "action.removeFromPlaylist": "Remove from Playlist", "action.addToFavorites": "Add to Favorites", diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 6fe6649f..9163dd1b 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -261,6 +261,7 @@ "action.removeFromQueue.success": "Removed from Queue", "action.removeFromQueue.error": "Error Removing from Queue", "action.createPlaylist": "Create a New Playlist", + "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.addToPlaylist": "Add to Playlist", "action.removeFromPlaylist": "Remove from Playlist", "action.addToFavorites": "Add to Favorites", diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 28e316e2..0ca0f6f3 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -663,9 +663,26 @@ const app = new Vue({ this.modals.addToPlaylist = false; app.newPlaylist(app.getLz("term.newPlaylist"), pl_items); }, + async isSongInPlaylist(song_ids, playlist_id) { + let isInPlaylist = false; + const playlistTracks = ( + await app.mk.api.v3.music(`/v1/me/library/playlists/${playlist_id}/tracks`, { + platform: "web", + l: app.mklang, + }) + ).data?.data; + + playlistTracks.forEach((track) => { + if (song_ids.includes(track.id)) { + isInPlaylist = true; + } + }); + return isInPlaylist; + }, async addSelectedToPlaylist(playlist_id) { let self = this; let pl_items = []; + const song_ids = []; for (let i = 0; i < self.selectedMediaItems.length; i++) { if (self.selectedMediaItems[i].kind == "song" || self.selectedMediaItems[i].kind == "songs") { self.selectedMediaItems[i].kind = "songs"; @@ -673,6 +690,7 @@ const app = new Vue({ id: self.selectedMediaItems[i].id, type: self.selectedMediaItems[i].kind, }); + song_ids.push(self.selectedMediaItems[i].id); } else if ((self.selectedMediaItems[i].kind == "album" || self.selectedMediaItems[i].kind == "albums") && self.selectedMediaItems[i].isLibrary != true) { self.selectedMediaItems[i].kind = "albums"; let res = await self.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/albums/${self.selectedMediaItems[i].id}/tracks`); @@ -680,12 +698,14 @@ const app = new Vue({ return { id: i.id, type: i.type }; }); pl_items = pl_items.concat(ids); + song_ids.push(...ids.map((id) => id.id)); } else if (self.selectedMediaItems[i].kind == "library-song" || 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, }); + song_ids.push(self.selectedMediaItems[i].id); } else if (self.selectedMediaItems[i].kind == "library-album" || self.selectedMediaItems[i].kind == "library-albums" || (self.selectedMediaItems[i].kind == "album" && self.selectedMediaItems[i].isLibrary == true)) { self.selectedMediaItems[i].kind = "library-albums"; let res = await self.mk.api.v3.music(`/v1/me/library/albums/${self.selectedMediaItems[i].id}/tracks`); @@ -693,32 +713,47 @@ const app = new Vue({ return { id: i.id, type: i.type }; }); pl_items = pl_items.concat(ids); + song_ids.push(...ids.map((id) => id.id)); } else { pl_items.push({ id: self.selectedMediaItems[i].id, type: self.selectedMediaItems[i].kind, }); + song_ids.push(self.selectedMediaItems[i].id); } } this.modals.addToPlaylist = false; - await app.mk.api.v3 - .music( - `/v1/me/library/playlists/${playlist_id}/tracks`, - {}, - { - fetchOptions: { - method: "POST", - body: JSON.stringify({ - data: pl_items, - }), - }, - } - ) - .then(() => { - if (this.page == "playlist_" + this.showingPlaylist.id) { - this.getPlaylistFromID(this.showingPlaylist.id, true); + + function addToPlaylist(pid, pitems) { + app.mk.api.v3 + .music( + `/v1/me/library/playlists/${pid}/tracks`, + {}, + { + fetchOptions: { + method: "POST", + body: JSON.stringify({ + data: pitems, + }), + }, + } + ) + .then(() => { + if (app.page === "playlist_" + pid) { + app.getPlaylistFromID(app.showingPlaylist.id, true); + } + }); + } + + if (await this.isSongInPlaylist(song_ids, playlist_id)) { + app.confirm(app.getLz("action.addToPlaylist.duplicate"), (result) => { + if (result === true) { + addToPlaylist(playlist_id, pl_items); } }); + } else { + addToPlaylist(playlist_id, pl_items); + } }, async init() { let self = this; From d7be56f65ba242271de91087b09690f581b9cfde Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 17 Sep 2022 01:06:19 +0100 Subject: [PATCH 24/62] moved function outside to stop redefine [ci skip] --- src/renderer/main/vueapp.js | 45 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 0ca0f6f3..1bf457d5 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -679,6 +679,26 @@ const app = new Vue({ }); return isInPlaylist; }, + addToPlaylist(pid, pitems) { + app.mk.api.v3 + .music( + `/v1/me/library/playlists/${pid}/tracks`, + {}, + { + fetchOptions: { + method: "POST", + body: JSON.stringify({ + data: pitems, + }), + }, + } + ) + .then(() => { + if (app.page === "playlist_" + pid) { + app.getPlaylistFromID(app.showingPlaylist.id, true); + } + }); + }, async addSelectedToPlaylist(playlist_id) { let self = this; let pl_items = []; @@ -724,35 +744,14 @@ const app = new Vue({ } this.modals.addToPlaylist = false; - function addToPlaylist(pid, pitems) { - app.mk.api.v3 - .music( - `/v1/me/library/playlists/${pid}/tracks`, - {}, - { - fetchOptions: { - method: "POST", - body: JSON.stringify({ - data: pitems, - }), - }, - } - ) - .then(() => { - if (app.page === "playlist_" + pid) { - app.getPlaylistFromID(app.showingPlaylist.id, true); - } - }); - } - if (await this.isSongInPlaylist(song_ids, playlist_id)) { app.confirm(app.getLz("action.addToPlaylist.duplicate"), (result) => { if (result === true) { - addToPlaylist(playlist_id, pl_items); + app.addToPlaylist(playlist_id, pl_items); } }); } else { - addToPlaylist(playlist_id, pl_items); + app.addToPlaylist(playlist_id, pl_items); } }, async init() { From f3f8c7f3fd8d882ec3d16557c57cb92046f1c816 Mon Sep 17 00:00:00 2001 From: yazninja Date: Mon, 19 Sep 2022 12:20:38 +0800 Subject: [PATCH 25/62] add playing class to album artwork --- src/renderer/views/components/fullscreen.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/views/components/fullscreen.ejs b/src/renderer/views/components/fullscreen.ejs index 74ccb487..728710aa 100644 --- a/src/renderer/views/components/fullscreen.ejs +++ b/src/renderer/views/components/fullscreen.ejs @@ -39,7 +39,7 @@
-
+
Date: Mon, 19 Sep 2022 21:53:29 +1000 Subject: [PATCH 26/62] Play button for mediaitem-smarthints (#1445) --- src/renderer/less/elements.less | 20 ++++ src/renderer/views/components/smarthints.ejs | 102 +++++++++++++++++-- 2 files changed, 114 insertions(+), 8 deletions(-) diff --git a/src/renderer/less/elements.less b/src/renderer/less/elements.less index 8322c8a2..52d77735 100644 --- a/src/renderer/less/elements.less +++ b/src/renderer/less/elements.less @@ -410,6 +410,10 @@ &:hover { background: var(--selected); border-radius: 6px; + + .circular-play-button { + opacity: 1; + } } &:active { background: var(--selected-click); @@ -418,6 +422,22 @@ } } +/* Circle Play Button */ +.circular-play-button { + position: relative; + opacity: 0; + top: -34px; + z-index: 5; + left: 8px; + align-items: center; + background: rgba(100, 100, 100, 0.5); + border: none; + cursor: pointer; + border-radius: 100%; + height: 26px; + box-shadow: var(--ciderShadow-Generic); +} + /* horizontal media scroller */ .cd-hmedia-scroller { &::-webkit-scrollbar-thumb { diff --git a/src/renderer/views/components/smarthints.ejs b/src/renderer/views/components/smarthints.ejs index c841d222..b8cec0f6 100644 --- a/src/renderer/views/components/smarthints.ejs +++ b/src/renderer/views/components/smarthints.ejs @@ -5,8 +5,14 @@
+ :url="item.attributes.artwork ? item.attributes.artwork.url : ''" + :size="32" + :style="{'position': 'relative', 'z-index': '-1'}" + > +
@@ -92,7 +98,7 @@ return this.contextMenu(event) } },{once: true})} - + }, async contextMenu(event) { let self = this @@ -296,7 +302,7 @@ menus.normal.items.find(x => x.id == 'addToLibrary').disabled = false } }) - + } catch (e) { console.log(e) } @@ -313,9 +319,9 @@ menus.normal.headerItems.find(x => x.id == 'dislike').hidden = true } } catch (err) { - + } - + if (this.contextExt) { if (this.contextExt.normal) { menus.normal.items = menus.normal.items.concat(this.contextExt.normal) @@ -373,7 +379,7 @@ window.open(app.getMediaItemArtwork(this.getArtworkUrl(), 1024, 1024)) } }, - + ] }, event) }, @@ -393,6 +399,87 @@ return `url("${artwork}")` } }, + playTrack(item) { + let parent = this.parent + let childIndex = this.index + 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."))) { + 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], + parameters: { l: this.app.mklang } + }).then(function() { + app.mk.play().then(function() { + var playlistId = id + + function getPlaylist(id, isLibrary) { + if (isLibrary) { + return this.app.mk.api.v3.music(`/v1/me/library/playlists/${id}`) + } else { + return this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/playlists/${id}`) + } + } + + try { + getPlaylist(id, 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.data.relationships.tracks.next) { + return + } else { + getPlaylistTracks(res.data.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) + + 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) + } + }) + }, }, beforeDestroy: function () { // this.item = null; @@ -401,4 +488,3 @@ } }); - \ No newline at end of file From 76b1d59e112ae0045229fce1addbda2026cc85f5 Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Tue, 20 Sep 2022 09:00:05 -0500 Subject: [PATCH 27/62] eslint moment --- .github/workflows/pr-chores.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-chores.yml b/.github/workflows/pr-chores.yml index 0abc6dd4..c191218a 100644 --- a/.github/workflows/pr-chores.yml +++ b/.github/workflows/pr-chores.yml @@ -29,6 +29,9 @@ jobs: - name: Install dependencies 👨🏻‍💻 run: pnpm install + + - name: Install ESLint 💼 + run: npm init @eslint/config - name: Run linter 👀 uses: wearerequired/lint-action@v2 From e01f98d157c295b1986d774d24b66f2468347685 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 15:31:15 +0100 Subject: [PATCH 28/62] Update cider-chores.yml --- .github/workflows/cider-chores.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 7daa90e4..9c026cfe 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -72,7 +72,6 @@ jobs: synchronize-with-crowdin: runs-on: ubuntu-latest - if: ${{ false }} # disable for now steps: - name: Checkout From 4e5300edf4f0f180c3a9b488b6b7911331463bbc Mon Sep 17 00:00:00 2001 From: vapormusic Date: Tue, 20 Sep 2022 17:51:32 +0700 Subject: [PATCH 29/62] some fixes --- src/main/base/browserwindow.ts | 8 ++++---- src/renderer/views/pages/oobe.ejs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index 3e06e7d2..c044894a 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -479,7 +479,7 @@ export class BrowserWindow { } } for (let i = 0; i < expectedFiles.length; i++) { - const file = join(utils.getPath("ciderCache"), expectedFiles[i]); + const file = join(join(app.getPath("userData"), "CiderCache"), expectedFiles[i]); if (!existsSync(file)) { writeFileSync(file, JSON.stringify([])); } @@ -1067,13 +1067,13 @@ export class BrowserWindow { }); ipcMain.handle("put-cache", (_event, arg) => { - writeFileSync(join(utils.getPath("ciderCache"), `${arg.file}.json`), arg.data); + writeFileSync(join(join(app.getPath("userData"), "CiderCache"), `${arg.file}.json`), arg.data); }); ipcMain.on("get-cache", (event, arg) => { let read = ""; - if (existsSync(join(utils.getPath("ciderCache"), `${arg}.json`))) { - read = readFileSync(join(utils.getPath("ciderCache"), `${arg}.json`), "utf8"); + if (existsSync(join(join(app.getPath("userData"), "CiderCache"), `${arg}.json`))) { + read = readFileSync(join(join(app.getPath("userData"), "CiderCache"), `${arg}.json`), "utf8"); } event.returnValue = read; }); diff --git a/src/renderer/views/pages/oobe.ejs b/src/renderer/views/pages/oobe.ejs index e4486f35..88057756 100644 --- a/src/renderer/views/pages/oobe.ejs +++ b/src/renderer/views/pages/oobe.ejs @@ -153,7 +153,9 @@
From bfdea6089bb3beefd1771aadc62b29f58978ea08 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 16:46:01 +0100 Subject: [PATCH 30/62] crowdin config --- crowdin.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 crowdin.yml diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..9ac8d3ef --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,3 @@ +files: + - source: /src/i18n/source/ + translation: /src/i18n/%locale_with_underscore%.json From c37b86289dd1f952926900391353a977a515bb6a Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 16:52:51 +0100 Subject: [PATCH 31/62] no --- .github/workflows/cider-chores.yml | 4 ++++ crowdin.yml | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 crowdin.yml diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 9c026cfe..952c090b 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -82,6 +82,10 @@ jobs: with: upload_translations: true download_translations: true + project_id: ${{ secrets.CROWDIN_PROJECT_ID }} + token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + source: '/src/i18n/source/' + translation: '/src/i18n/%locale_with_underscore%.json' env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} diff --git a/crowdin.yml b/crowdin.yml deleted file mode 100644 index 9ac8d3ef..00000000 --- a/crowdin.yml +++ /dev/null @@ -1,3 +0,0 @@ -files: - - source: /src/i18n/source/ - translation: /src/i18n/%locale_with_underscore%.json From 91e58ece445d9cf87deaf213c5488d63aa2b7072 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 16:57:34 +0100 Subject: [PATCH 32/62] aa --- .github/workflows/cider-chores.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 952c090b..702cf2e5 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -84,7 +84,7 @@ jobs: download_translations: true project_id: ${{ secrets.CROWDIN_PROJECT_ID }} token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - source: '/src/i18n/source/' + source: '/src/i18n/source/%locale_with_underscore%.json' translation: '/src/i18n/%locale_with_underscore%.json' env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From c359c71d20b99c4781127ed3eb49c48162fb9a09 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 16:58:50 +0100 Subject: [PATCH 33/62] please --- .github/workflows/cider-chores.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 702cf2e5..1f14036c 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -84,7 +84,7 @@ jobs: download_translations: true project_id: ${{ secrets.CROWDIN_PROJECT_ID }} token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - source: '/src/i18n/source/%locale_with_underscore%.json' + source: '/src/i18n/source/en_US.json' translation: '/src/i18n/%locale_with_underscore%.json' env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From 46e54ff41fe8bb0cbe2eeedda794ab5736e14563 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 17:05:40 +0100 Subject: [PATCH 34/62] please x2 --- .github/workflows/cider-chores.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 1f14036c..a1470acf 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -84,7 +84,7 @@ jobs: download_translations: true project_id: ${{ secrets.CROWDIN_PROJECT_ID }} token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - source: '/src/i18n/source/en_US.json' + source: '/src/i18n/source/**.*' translation: '/src/i18n/%locale_with_underscore%.json' env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} From fef9bcd041bca8bccb6946b375db18f70a7da8b8 Mon Sep 17 00:00:00 2001 From: Core Date: Tue, 20 Sep 2022 17:07:06 +0100 Subject: [PATCH 35/62] just to upload --- .github/workflows/cider-chores.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index a1470acf..660575b4 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -81,7 +81,7 @@ jobs: uses: crowdin/github-action@1.4.13 with: upload_translations: true - download_translations: true + download_translations: false project_id: ${{ secrets.CROWDIN_PROJECT_ID }} token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} source: '/src/i18n/source/**.*' From 09ebfc4b34e8670728608d34e64c4f13e9cd5411 Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Wed, 21 Sep 2022 09:01:16 -0500 Subject: [PATCH 36/62] Update Crowdin configuration file --- crowdin.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 crowdin.yml diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..3ce3bcbd --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,3 @@ +files: + - source: /src/i18n/source/en_US.json + translation: /src/i18n/%locale_with_underscore%.json From 8bf6eabe454a7366ec69f005c34d866edcd67f59 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 15:13:53 +0100 Subject: [PATCH 37/62] fuck eslint --- .github/workflows/pr-chores.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/pr-chores.yml b/.github/workflows/pr-chores.yml index c191218a..bd622916 100644 --- a/.github/workflows/pr-chores.yml +++ b/.github/workflows/pr-chores.yml @@ -30,12 +30,8 @@ jobs: - name: Install dependencies 👨🏻‍💻 run: pnpm install - - name: Install ESLint 💼 - run: npm init @eslint/config - - name: Run linter 👀 uses: wearerequired/lint-action@v2 with: - eslint: true prettier: true prettier_args: "'**/*.{js,json,ts,css,vue,less}'" From 356788d4dcb97224dd3666a9f637d957e80e5431 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 15:20:59 +0100 Subject: [PATCH 38/62] Source Update Workflow --- .github/workflows/cider-chores.yml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cider-chores.yml b/.github/workflows/cider-chores.yml index 660575b4..48136a22 100644 --- a/.github/workflows/cider-chores.yml +++ b/.github/workflows/cider-chores.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # Make sure the actual branch is checked out when running on pull requests ref: ${{ github.head_ref }} @@ -55,7 +55,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # Make sure the actual branch is checked out when running on pull requests ref: ${{ github.head_ref }} @@ -70,8 +70,34 @@ jobs: commit_user_name: "cider-chore[bot]" commit_user_email: "cider-chore[bot]@users.noreply.github.com" + update-i18n-source: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18] + + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Update Source Files + run: cp src/i18n/en_US.json src/i18n/source/en_US.json + + - name: Commit Updated Source File + uses: stefanzweifel/git-auto-commit-action@v4.14.1 + with: + commit_message: "chore: Updated i18n Source\n [ci skip]" + commit_user_name: "cider-chore[bot]" + commit_user_email: "cider-chore[bot]@users.noreply.github.com" + + synchronize-with-crowdin: runs-on: ubuntu-latest + if: ${{ false }} # disable for now steps: - name: Checkout From 0a21d3eb00cf97569d71b676c9f287bac45211b4 Mon Sep 17 00:00:00 2001 From: cryptofyre Date: Wed, 21 Sep 2022 09:21:02 -0500 Subject: [PATCH 39/62] Update crowdin translation image. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5c70150..c4cb84c6 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

GitHub Stars GitHub Forks - +
Buy Me A Coffee Open Collective From eb7788f86d311147535789fdfa5ffa01796a3d38 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 21:25:55 +0100 Subject: [PATCH 40/62] Implemented mediaSession API functions --- src/preload/cider-preload.js | 141 +++++++++++++++++++++++++++++++---- 1 file changed, 127 insertions(+), 14 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index ba968b2f..ec289917 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -6,10 +6,13 @@ let cache = { playParams: { id: 0 }, status: null, remainingTime: 0 }, const MusicKitInterop = { init: function () { + this.initMediaSession(); + /* MusicKit.Events.playbackStateDidChange */ MusicKit.getInstance().addEventListener(MusicKit.Events.playbackStateDidChange, () => { const attributes = MusicKitInterop.getAttributes(); if (!attributes) return; + MusicKitInterop.updateMediaState(attributes); if (MusicKitInterop.filterTrack(attributes, true, false)) { global.ipcRenderer.send("playbackStateDidChange", attributes); global.ipcRenderer.send("wsapi-updatePlaybackState", attributes); @@ -35,6 +38,13 @@ const MusicKitInterop = { const attributes = MusicKitInterop.getAttributes(); if (!attributes) return; ipcRenderer.send("playbackTimeDidChange", attributes); + if ("mediaSession" in navigator) { + navigator.mediaSession.setPositionState({ + duration: attributes.duration, + playbackRate: app?.cfg?.audio?.playbackRate ?? 1, + position: attributes.currentPlaybackTime, + }); + } }); /* MusicKit.Events.nowPlayingItemDidChange */ @@ -43,6 +53,7 @@ const MusicKitInterop = { if (!attributes) return; attributes.primaryArtist = app.cfg.connectivity.lastfm.remove_featured ? await this.fetchSongRelationships() : attributes.artistName; + MusicKitInterop.updateMediaSession(attributes); global.ipcRenderer.send("nowPlayingItemDidChange", attributes); if (MusicKitInterop.filterTrack(attributes, false, true)) { @@ -142,7 +153,7 @@ const MusicKitInterop = { attributes.songId = attributes.songId ?? attributes.playParams?.catalogId ?? attributes.playParams?.id; attributes.type = nowPlayingItem?.type ?? ""; - attributes.status = isPlayingExport ?? null; + attributes.status = nowPlayingItem == null ? null : !!isPlayingExport; attributes.name = attributes?.name ?? "no-title-found"; attributes.artwork = attributes?.artwork ?? { url: "" }; attributes.artwork.url = (attributes?.artwork?.url ?? "").replace(`{f}`, "png"); @@ -205,22 +216,124 @@ const MusicKitInterop = { }, next: () => { - // try { - // app.prevButtonBackIndicator = false; - // } catch (e) { } - // if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null) - // MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex); - MusicKit.getInstance() - .skipToNextItem() - .then((r) => console.debug(`[cider:preload] [next] Skipping to Next ${r}`)); + if (app) { + app.skipToNextItem(); + } else { + MusicKit.getInstance() + .skipToNextItem() + .then((r) => console.debug(`[cider:preload] [next] Skipping to Next ${r}`)); + } }, previous: () => { - // if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) - // MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex); - MusicKit.getInstance() - .skipToPreviousItem() - .then((r) => console.debug(`[cider:preload] [previous] Skipping to Previous ${r}`)); + if (app) { + app.skipToPreviousItem(); + } else { + MusicKit.getInstance() + .skipToPreviousItem() + .then((r) => console.debug(`[cider:preload] [previous] Skipping to Previous ${r}`)); + } + }, + + initMediaSession: () => { + if ("mediaSession" in navigator) { + console.debug("[cider:preload] [initMediaSession] Media Session API supported"); + navigator.mediaSession.setActionHandler("play", () => { + MusicKitInterop.play(); + console.log("[cider:preload] [initMediaSession] Play"); + }); + navigator.mediaSession.setActionHandler("pause", () => { + MusicKitInterop.pause(); + console.log("[cider:preload] [initMediaSession] Pause"); + }); + navigator.mediaSession.setActionHandler("stop", () => { + MusicKit.getInstance().stop(); + console.log("[cider:preload] [initMediaSession] Stop"); + }); + navigator.mediaSession.setActionHandler("seekbackward", ({ seekOffset }) => { + MusicKit.getInstance().seekToTime(MusicKit.getInstance().currentPlaybackTime - seekOffset); + console.log(`[cider:preload] [initMediaSession] Seek Backward ${seekOffset}`); + }); + navigator.mediaSession.setActionHandler("seekforward", ({ seekOffset }) => { + MusicKit.getInstance().seekToTime(MusicKit.getInstance().currentPlaybackTime + seekOffset); + console.log(`[cider:preload] [initMediaSession] Seek Forward ${seekOffset}`); + }); + navigator.mediaSession.setActionHandler("seekto", ({ seekTime, fastSeek }) => { + MusicKit.getInstance().seekToTime(seekTime); + console.log(`[cider:preload] [initMediaSession] Seek To ${seekTime}`); + }); + navigator.mediaSession.setActionHandler("previoustrack", () => { + MusicKitInterop.previous(); + console.log("[cider:preload] [initMediaSession] Previous Track"); + }); + navigator.mediaSession.setActionHandler("nexttrack", () => { + MusicKitInterop.next(); + console.log("[cider:preload] [initMediaSession] Next Track"); + }); + } else { + console.debug("[cider:preload] [initMediaSession] Media Session API not supported"); + } + }, + + updateMediaSession: (a) => { + if ("mediaSession" in navigator) { + navigator.mediaSession.metadata = new MediaMetadata({ + title: a.name, + artist: a.artistName, + album: a.albumName, + artwork: [ + { + src: a.artwork.url.replace("/{w}x{h}bb", "/96x96bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "96x96", + type: "image/jpeg", + }, + { + src: a.artwork.url.replace("/{w}x{h}bb", "/128x128bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "128x128", + type: "image/jpeg", + }, + { + src: a.artwork.url.replace("/{w}x{h}bb", "/192x192bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "192x192", + type: "image/jpeg", + }, + { + src: a.artwork.url.replace("/{w}x{h}bb", "/256x256bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "256x256", + type: "image/jpeg", + }, + { + src: a.artwork.url.replace("/{w}x{h}bb", "/384x384bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "384x384", + type: "image/jpeg", + }, + { + src: a.artwork.url.replace("/{w}x{h}bb", "/512x512bb").replace("/2000x2000bb", "/35x35bb"), + sizes: "512x512", + type: "image/jpeg", + }, + ], + }); + } + }, + + updateMediaState: (a) => { + if ("mediaSession" in navigator) { + switch (a.status) { + default: + case null: + navigator.mediaSession.playbackState = "none"; + break; + + case false: + navigator.mediaSession.playbackState = "paused"; + break; + + case true: + navigator.mediaSession.playbackState = "playing"; + break; + } + } }, }; From 5214ca9ad249e598e5de30fe7b6efc279f2f9ead Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 21:27:02 +0100 Subject: [PATCH 41/62] Cleaned up playback function, commented mediaKeyFixes --- src/renderer/main/vueapp.js | 48 ++++++++++--------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 1bf457d5..b2178464 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -195,7 +195,6 @@ const app = new Vue({ type: "", }, MVsource: null, - prevButtonBackIndicator: false, currentSongInfo: {}, page: "", pageHistory: [], @@ -2233,40 +2232,20 @@ const app = new Vue({ } }, prevButton() { - if (!app.prevButtonBackIndicator && app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) { - app.prevButtonBackIndicator = true; - try { - clearTimeout(app.pauseButtonTimer); - } catch (e) {} + if (app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) { app.mk.seekToTime(0); - app.pauseButtonTimer = setTimeout(() => { - app.prevButtonBackIndicator = false; - }, 3000); } else { - try { - clearTimeout(app.pauseButtonTimer); - } catch (e) {} - app.prevButtonBackIndicator = false; app.skipToPreviousItem(); } }, isDisabled() { - if (!app.mk.nowPlayingItem || app.mk.nowPlayingItem.attributes.playParams.kind == "radioStation") { - return true; - } - return false; + return !app.mk.nowPlayingItem || app.mk.nowPlayingItem.attributes.playParams.kind === "radioStation"; }, isPrevDisabled() { - if (this.isDisabled() || (app.mk.queue._position == 0 && app.mk.currentPlaybackTime <= 2)) { - return true; - } - return false; + return this.isDisabled() || (app.mk.queue._position === 0 && app.mk.currentPlaybackTime <= 2); }, isNextDisabled() { - if (this.isDisabled() || app.mk.queue._position + 1 == app.mk.queue.length) { - return true; - } - return false; + return this.isDisabled() || app.mk.queue._position + 1 === app.mk.queue.length; }, async getNowPlayingItemDetailed(target) { @@ -5082,21 +5061,18 @@ const app = new Vue({ } }, skipToNextItem() { - app.prevButtonBackIndicator = false; - // app.mk.skipToNextItem() is buggy somehow so use this - if (this.mk.queue.nextPlayableItemIndex != -1 && this.mk.queue.nextPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.nextPlayableItemIndex); + if (this.mk.queue.nextPlayableItemIndex !== -1 && this.mk.queue.nextPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.nextPlayableItemIndex); }, skipToPreviousItem() { - // app.mk.skipToPreviousItem() is buggy somehow so use this - if (this.mk.queue.previousPlayableItemIndex != -1 && this.mk.queue.previousPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex); + if (this.mk.queue.previousPlayableItemIndex !== -1 && this.mk.queue.previousPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex); }, mediaKeyFixes() { - navigator.mediaSession.setActionHandler("previoustrack", function () { - app.prevButton(); - }); - navigator.mediaSession.setActionHandler("nexttrack", function () { - app.skipToNextItem(); - }); + // navigator.mediaSession.setActionHandler("previoustrack", function () { + // app.skipToPreviousItem(); + // }); + // navigator.mediaSession.setActionHandler("nexttrack", function () { + // app.skipToNextItem(); + // }); }, authCC() { ipcRenderer.send("cc-auth"); From 20722371dd191a003c0139aee89bc18786f159fa Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 21:27:19 +0100 Subject: [PATCH 42/62] Simplified wsapi renderer calls --- src/main/base/wsapi.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/base/wsapi.ts b/src/main/base/wsapi.ts index d161b279..06cc632e 100644 --- a/src/main/base/wsapi.ts +++ b/src/main/base/wsapi.ts @@ -200,15 +200,11 @@ export class wsapi { response.message = "Unmuted"; break; case "next": - this._win.webContents.executeJavaScript(`if (MusicKit.getInstance().queue.nextPlayableItemIndex != -1 && MusicKit.getInstance().queue.nextPlayableItemIndex != null) { - try { - app.prevButtonBackIndicator = false; - } catch (e) { } - MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.nextPlayableItemIndex);}`); + this._win.webContents.executeJavaScript(`MusicKitInterop.next()`); response.message = "Next"; break; case "previous": - this._win.webContents.executeJavaScript(`if (MusicKit.getInstance().queue.previousPlayableItemIndex != -1 && MusicKit.getInstance().queue.previousPlayableItemIndex != null) {MusicKit.getInstance().changeToMediaAtIndex(MusicKit.getInstance().queue.previousPlayableItemIndex)}`); + this._win.webContents.executeJavaScript(`MusicKitInterop.previous()`); response.message = "Previous"; break; case "musickit-api": From feba6faedf23bcc544ea675e9133848bd4dbb854 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 22:31:00 +0100 Subject: [PATCH 43/62] Fix duration --- src/preload/cider-preload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index ec289917..3de6cf72 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -40,7 +40,7 @@ const MusicKitInterop = { ipcRenderer.send("playbackTimeDidChange", attributes); if ("mediaSession" in navigator) { navigator.mediaSession.setPositionState({ - duration: attributes.duration, + duration: attributes.durationInMillis / 1000, playbackRate: app?.cfg?.audio?.playbackRate ?? 1, position: attributes.currentPlaybackTime, }); From 0648c75a014465b3b19ab7d95d5ce510bbf12fcf Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 22:53:58 +0100 Subject: [PATCH 44/62] Added check --- src/preload/cider-preload.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index 3de6cf72..c5852484 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -6,8 +6,6 @@ let cache = { playParams: { id: 0 }, status: null, remainingTime: 0 }, const MusicKitInterop = { init: function () { - this.initMediaSession(); - /* MusicKit.Events.playbackStateDidChange */ MusicKit.getInstance().addEventListener(MusicKit.Events.playbackStateDidChange, () => { const attributes = MusicKitInterop.getAttributes(); @@ -38,7 +36,7 @@ const MusicKitInterop = { const attributes = MusicKitInterop.getAttributes(); if (!attributes) return; ipcRenderer.send("playbackTimeDidChange", attributes); - if ("mediaSession" in navigator) { + if ("mediaSession" in navigator && attributes.currentPlaybackTime <= attributes.durationInMillis / 1000) { navigator.mediaSession.setPositionState({ duration: attributes.durationInMillis / 1000, playbackRate: app?.cfg?.audio?.playbackRate ?? 1, @@ -237,6 +235,8 @@ const MusicKitInterop = { initMediaSession: () => { if ("mediaSession" in navigator) { + const defaultSkipTime = 10; + console.debug("[cider:preload] [initMediaSession] Media Session API supported"); navigator.mediaSession.setActionHandler("play", () => { MusicKitInterop.play(); @@ -250,13 +250,15 @@ const MusicKitInterop = { MusicKit.getInstance().stop(); console.log("[cider:preload] [initMediaSession] Stop"); }); - navigator.mediaSession.setActionHandler("seekbackward", ({ seekOffset }) => { - MusicKit.getInstance().seekToTime(MusicKit.getInstance().currentPlaybackTime - seekOffset); - console.log(`[cider:preload] [initMediaSession] Seek Backward ${seekOffset}`); + navigator.mediaSession.setActionHandler("seekbackward", (details) => { + const skipTime = details.seekOffset || defaultSkipTime; + MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime - skipTime, 0)); + console.log(`[cider:preload] [initMediaSession] Seek Backward ${skipTime}`); }); - navigator.mediaSession.setActionHandler("seekforward", ({ seekOffset }) => { - MusicKit.getInstance().seekToTime(MusicKit.getInstance().currentPlaybackTime + seekOffset); - console.log(`[cider:preload] [initMediaSession] Seek Forward ${seekOffset}`); + navigator.mediaSession.setActionHandler("seekforward", (details) => { + const skipTime = details.seekOffset || defaultSkipTime; + MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime + skipTime, 0)); + console.log(`[cider:preload] [initMediaSession] Seek Forward ${skipTime}`); }); navigator.mediaSession.setActionHandler("seekto", ({ seekTime, fastSeek }) => { MusicKit.getInstance().seekToTime(seekTime); @@ -319,6 +321,7 @@ const MusicKitInterop = { updateMediaState: (a) => { if ("mediaSession" in navigator) { + console.log("[cider:preload] [updateMediaState] Updating Media State to " + a.status); switch (a.status) { default: case null: From 11bd1814843f3d40a6e167c0b03b8cd18d3bd1e4 Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 22:54:35 +0100 Subject: [PATCH 45/62] Moved function call --- src/renderer/main/vueapp.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index b2178464..6f382399 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -5067,6 +5067,7 @@ const app = new Vue({ if (this.mk.queue.previousPlayableItemIndex !== -1 && this.mk.queue.previousPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex); }, mediaKeyFixes() { + MusicKitInterop.initMediaSession(); // navigator.mediaSession.setActionHandler("previoustrack", function () { // app.skipToPreviousItem(); // }); From 793c65ac314c9ca67ae0f2ba072af12e8b84568b Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 23:24:59 +0100 Subject: [PATCH 46/62] More checks --- src/preload/cider-preload.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index c5852484..cf8c1b4f 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -36,13 +36,7 @@ const MusicKitInterop = { const attributes = MusicKitInterop.getAttributes(); if (!attributes) return; ipcRenderer.send("playbackTimeDidChange", attributes); - if ("mediaSession" in navigator && attributes.currentPlaybackTime <= attributes.durationInMillis / 1000) { - navigator.mediaSession.setPositionState({ - duration: attributes.durationInMillis / 1000, - playbackRate: app?.cfg?.audio?.playbackRate ?? 1, - position: attributes.currentPlaybackTime, - }); - } + MusicKitInterop.updatePositionState(attributes); }); /* MusicKit.Events.nowPlayingItemDidChange */ @@ -338,6 +332,16 @@ const MusicKitInterop = { } } }, + + updatePositionState: (a) => { + if ("mediaSession" in navigator && a.currentPlaybackTime <= a.durationInMillis / 1000 && a.currentPlaybackTime >= 0) { + navigator.mediaSession.setPositionState({ + duration: a.durationInMillis / 1000, + playbackRate: app?.cfg?.audio?.playbackRate ?? 1, + position: a.currentPlaybackTime, + }); + } + }, }; process.once("loaded", () => { From 6e048db633e573fc344a6e198f27bb9b2907868d Mon Sep 17 00:00:00 2001 From: Core Date: Wed, 21 Sep 2022 23:58:39 +0100 Subject: [PATCH 47/62] autoplay persists on app launches --- src/main/base/store.ts | 5 +++++ src/renderer/main/vueapp.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/main/base/store.ts b/src/main/base/store.ts index a2a98363..f0ea4d16 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -231,6 +231,11 @@ export class Store { settings: false, }, }, + musickit: { + "stored-attributes": { + autoplayEnabled: "", + }, + }, }; private migrations: any = {}; private schema: ElectronStore.Schema = { diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 1bf457d5..a3d7ea87 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -292,6 +292,21 @@ const app = new Vue({ setWindowHash(route = "") { window.location.hash = `#${route}`; }, + monitorMusickit() { + if (!app.cfg.musickit) return; + + for (const [attr, value] of Object.entries(app.cfg.musickit["stored-attributes"])) { + console.log(`Musickit value: ` + app.mk[attr]); + console.log(`Config value: ` + value); + if (value !== "" && app.mk[attr] !== value) { + app.mk[attr] = value; + } + this.$watch(`mk.${attr}`, (val) => { + console.log(`MK ${attr} changed to ${val}`); + app.cfg.musickit["stored-attributes"][attr] = val; + }); + } + }, async oobeInit() { this.appMode = "oobe"; for (const [k, v] of Object.entries(ipcRenderer.sendSync("get-i18n-listing"))) { @@ -826,6 +841,7 @@ const app = new Vue({ }; } MusicKitInterop.init(); + this.monitorMusickit(); // Set the volume // Check the value of this.cfg.audio.muted From 573e346acfe342a8742cab749c6630bcd1b0b0cb Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 00:08:32 +0100 Subject: [PATCH 48/62] Fix [ci skip] --- .github/workflows/pr-chores.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-chores.yml b/.github/workflows/pr-chores.yml index bd622916..66e14ae9 100644 --- a/.github/workflows/pr-chores.yml +++ b/.github/workflows/pr-chores.yml @@ -29,9 +29,9 @@ jobs: - name: Install dependencies 👨🏻‍💻 run: pnpm install - + - name: Run linter 👀 uses: wearerequired/lint-action@v2 with: prettier: true - prettier_args: "'**/*.{js,json,ts,css,vue,less}'" + prettier_args: "'src/**/*.{js,json,ts,css,vue,less}'" From 38dd440531f2c42f4cdc251207f10ddf14436198 Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 00:26:22 +0100 Subject: [PATCH 49/62] This is weird [ci skip] --- src/main/base/store.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/base/store.ts b/src/main/base/store.ts index f0ea4d16..bb6383c8 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -1,9 +1,6 @@ import * as ElectronStore from "electron-store"; import { app, ipcMain } from "electron"; import fetch from "electron-fetch"; -import { existsSync } from "fs"; -import { join } from "path"; -import { utils } from "./utils"; export class Store { static cfg: ElectronStore; @@ -122,7 +119,7 @@ export class Store { }, audio: { volume: 1, - volumeStep: 0.05, + volumeStep: 0.01, maxVolume: 1, lastVolume: 1, muted: false, @@ -336,8 +333,4 @@ export class Store { Store.cfg.store = store; }); } - - private checkLocale(language: string) { - return existsSync(join(utils.getPath("i18nPath"), `${language}.json`)) ? language : "en_US"; - } } From 65ef41ab0195fcacadcd44373b628152158ccd8c Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 00:52:55 +0100 Subject: [PATCH 50/62] version fix --- resources/version.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/version.sh b/resources/version.sh index 3b657cb8..769cbeaa 100755 --- a/resources/version.sh +++ b/resources/version.sh @@ -9,8 +9,9 @@ else STABLE_SHA=$(curl -s https://api.github.com/repos/ciderapp/Cider/branches/stable | grep '"sha"' | head -1 | cut -d '"' -f 4) fi + SHA_DATE=$(git show -s --format=%ci $STABLE_SHA) -COMMIT_SINCE_STABLE=$(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE") +COMMIT_SINCE_STABLE=$(printf "%03d\n" $(git rev-list $STABLE_SHA..HEAD --count --since="$SHA_DATE")) CURRENT_VERSION=$(node -p -e "require('./package.json').version") # Set the version number for commits on main branch From 50a8524f55619a6884cefccb3fe21d59b5a8f1bc Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 15:46:49 +0100 Subject: [PATCH 51/62] Fix --- src/main/plugins/lastfm.ts | 10 +++++----- src/preload/cider-preload.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index bfceeea3..2c3f2613 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -50,17 +50,17 @@ export default class lastfm { }); this._utils.getIPCMain().on("lastfm:nowPlayingChange", (event: any, attributes: any) => { - if (this._utils.getStoreValue("connectivity.lastfm.filter_loop") || this._utils.getStoreValue("general.privateEnabled") || attributes.type === "radioStation") return; + if (this._utils.getStoreValue("connectivity.lastfm.filter_loop") || this._utils.getStoreValue("general.privateEnabled") || attributes.kind === "radioStation") return; this.updateNowPlayingTrack(attributes); }); this._utils.getIPCMain().on("lastfm:FilteredNowPlayingItemDidChange", (event: any, attributes: any) => { - if (this._utils.getStoreValue("general.privateEnabled") || attributes.type === "radioStation") return; + if (this._utils.getStoreValue("general.privateEnabled") || attributes.kind === "radioStation") return; this.updateNowPlayingTrack(attributes); }); this._utils.getIPCMain().on("lastfm:scrobbleTrack", (event: any, attributes: any) => { - if (this._utils.getStoreValue("general.privateEnabled") || attributes.type === "radioStation") return; + if (this._utils.getStoreValue("general.privateEnabled") || attributes.kind === "radioStation") return; this.scrobbleTrack(attributes); }); } @@ -170,7 +170,7 @@ export default class lastfm { return; } - if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.type] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return; // Scrobble const scrobble = { @@ -210,7 +210,7 @@ export default class lastfm { return; } - if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.type] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return; + if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return; console.log(this._utils.getStoreValue("connectivity.lastfm.filter_types")); diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index cf8c1b4f..afc3cf74 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -144,7 +144,7 @@ const MusicKitInterop = { const attributes = nowPlayingItem != null ? nowPlayingItem.attributes : {}; attributes.songId = attributes.songId ?? attributes.playParams?.catalogId ?? attributes.playParams?.id; - attributes.type = nowPlayingItem?.type ?? ""; + attributes.kind = nowPlayingItem?.type ?? attributes.type ?? attributes.playParams.kind ?? ""; attributes.status = nowPlayingItem == null ? null : !!isPlayingExport; attributes.name = attributes?.name ?? "no-title-found"; attributes.artwork = attributes?.artwork ?? { url: "" }; From 30dec87400cb980257d445eadca9f778bebc89f4 Mon Sep 17 00:00:00 2001 From: Maikiwi Date: Thu, 22 Sep 2022 11:40:27 -0700 Subject: [PATCH 52/62] aftermath of coding at 2am 200 days ago --- src/renderer/audio/audio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/audio/audio.js b/src/renderer/audio/audio.js index 9a993c14..cbf84d1e 100644 --- a/src/renderer/audio/audio.js +++ b/src/renderer/audio/audio.js @@ -972,8 +972,6 @@ const CiderAudio = { MusicKit.getInstance().pause(); // Pause first } - CiderAudioRenderer.off(); // Clean up IMMEDIATELY - CiderAudio.audioNodes.optimizedNode = CiderAudio.context.createConvolver(); CiderAudio.audioNodes.optimizedNode.normalize = false; @@ -981,6 +979,8 @@ const CiderAudio = { CiderAudio.audioNodes.optimizedNode.buffer = res; }); + CiderAudioRenderer.off(); // Clean up IMMEDIATELY + // Load the sucker up CiderAudio.hierarchical_unloading(); From eba946cc47d708999d0b6cddc99ba3c94eb407c8 Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 20:45:38 +0100 Subject: [PATCH 53/62] Update config.yml [ci skip] --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 27466672..de9c5422 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -136,11 +136,11 @@ jobs: if [[ "${APP_VERSION}" = *"beta"* ]]; then echo $'**Beta Release**\nA full changelog is unavailable, but you can view the branch comparison [here](https://github.com/ciderapp/cider/compare/stable...main).\nThese builds are considered bleeding edge, expect bugs and please do not use this as a representation of the fu ll app.\nOur full support disclaimer can be found [here](https://docs.cider.sh/support/disclaimer#support-nightly-beta-releases).' > release-notes.md gh release create "v${APP_VERSION}" --prerelease --title "Cider Version ${APP_VERSION} (${CIRCLE_BRANCH})" --notes-file release-notes.md -R ciderapp/cider-releases ~/Cider/dist/artifacts/*.deb ~/Cider/dist/artifacts/*.AppImage ~/Cider/dist/artifacts/*.snap ~/Cider/dist/artifacts/*.exe ~/Cider/dist/artifacts/*.yml ~/Cider/dist/artifacts/*.blockmap - curl http://129.146.42.180/api/v1/github/sync/main + curl -s http://129.146.42.180/api/v1/github/sync/main else echo $'**Stable Release**\nA full changelog is unavailable, but you can view the branch comparison [here](https://github.com/ciderapp/cider/compare/stable...main).\nThese are the most stable builds we can provide. If you experience any issues, please report them [here](https://github.com/ciderapp/cider/issues/new).\nOur full support disclaimer can be found [here](https://docs.cider.sh/support/disclaimer#support-releases).' > release-notes.md gh release create "v${APP_VERSION}" --title "Cider Version ${APP_VERSION} (${CIRCLE_BRANCH})" --notes-file release-notes.md -R ciderapp/cider-releases ~/Cider/dist/artifacts/*.deb ~/Cider/dist/artifacts/*.AppImage ~/Cider/dist/artifacts/*.snap ~/Cider/dist/artifacts/*.exe ~/Cider/dist/artifacts/*.yml ~/Cider/dist/artifacts/*.blockmap - curl http://129.146.42.180/api/v1/github/sync/stable + curl -s http://129.146.42.180/api/v1/github/sync/stable fi; # Orchestrate our job run sequence From 71496052df08a2bbfb7f9b5bd4f18d7806bad86e Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 22:50:59 +0100 Subject: [PATCH 54/62] Small fix --- src/preload/cider-preload.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index afc3cf74..1314f33d 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -144,7 +144,7 @@ const MusicKitInterop = { const attributes = nowPlayingItem != null ? nowPlayingItem.attributes : {}; attributes.songId = attributes.songId ?? attributes.playParams?.catalogId ?? attributes.playParams?.id; - attributes.kind = nowPlayingItem?.type ?? attributes.type ?? attributes.playParams.kind ?? ""; + attributes.kind = nowPlayingItem?.type ?? attributes?.type ?? attributes.playParams?.kind ?? ""; attributes.status = nowPlayingItem == null ? null : !!isPlayingExport; attributes.name = attributes?.name ?? "no-title-found"; attributes.artwork = attributes?.artwork ?? { url: "" }; @@ -229,42 +229,38 @@ const MusicKitInterop = { initMediaSession: () => { if ("mediaSession" in navigator) { - const defaultSkipTime = 10; - console.debug("[cider:preload] [initMediaSession] Media Session API supported"); navigator.mediaSession.setActionHandler("play", () => { MusicKitInterop.play(); - console.log("[cider:preload] [initMediaSession] Play"); }); navigator.mediaSession.setActionHandler("pause", () => { MusicKitInterop.pause(); - console.log("[cider:preload] [initMediaSession] Pause"); }); navigator.mediaSession.setActionHandler("stop", () => { MusicKit.getInstance().stop(); - console.log("[cider:preload] [initMediaSession] Stop"); }); navigator.mediaSession.setActionHandler("seekbackward", (details) => { - const skipTime = details.seekOffset || defaultSkipTime; - MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime - skipTime, 0)); - console.log(`[cider:preload] [initMediaSession] Seek Backward ${skipTime}`); + if (details.seekOffset) { + MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime - details.seekOffset, 0)); + } else { + MusicKit.getInstance().seekBackward(); + } }); navigator.mediaSession.setActionHandler("seekforward", (details) => { - const skipTime = details.seekOffset || defaultSkipTime; - MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime + skipTime, 0)); - console.log(`[cider:preload] [initMediaSession] Seek Forward ${skipTime}`); + if (details.seekOffset) { + MusicKit.getInstance().seekToTime(Math.max(MusicKit.getInstance().currentPlaybackTime + details.seekOffset, 0)); + } else { + MusicKit.getInstance().seekForward(); + } }); navigator.mediaSession.setActionHandler("seekto", ({ seekTime, fastSeek }) => { MusicKit.getInstance().seekToTime(seekTime); - console.log(`[cider:preload] [initMediaSession] Seek To ${seekTime}`); }); navigator.mediaSession.setActionHandler("previoustrack", () => { MusicKitInterop.previous(); - console.log("[cider:preload] [initMediaSession] Previous Track"); }); navigator.mediaSession.setActionHandler("nexttrack", () => { MusicKitInterop.next(); - console.log("[cider:preload] [initMediaSession] Next Track"); }); } else { console.debug("[cider:preload] [initMediaSession] Media Session API not supported"); From dcc82aa72ef9df62c90f4710fcc838dd1192d931 Mon Sep 17 00:00:00 2001 From: Core Date: Thu, 22 Sep 2022 23:45:42 +0100 Subject: [PATCH 55/62] Musickit error handling --- src/i18n/en_US.json | 1 + src/renderer/main/vueapp.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 9163dd1b..d17e39db 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -229,6 +229,7 @@ "home.followedArtists": "Followed Artists", "error.appleMusicSubRequired": "Apple Music requires a subscription.", "error.connectionError": "There was a problem connecting to Apple Music.", + "error.musickitError": "MusicKit Encountered an Error: ", "error.noResults": "No Results.", "error.noResults.description": "Try a new search.", "podcast.followOnCider": "Follow On Cider", diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 49b3606c..f11d4470 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -305,6 +305,20 @@ const app = new Vue({ app.cfg.musickit["stored-attributes"][attr] = val; }); } + const ERROR_CODES = ["drmUnsupported", "mediaPlaybackError"]; + /* MusicKit.Events */ + ERROR_CODES.forEach((code) => { + MusicKit.getInstance().addEventListener(MusicKit.Events[code], (e) => { + console.error(`[MusicKit] MusicKit Error ${code}`); + console.error({ e: e }); + app.notyf.open({ + duration: 20000, + type: "error", + className: "notyf-info", + message: `${app.getLz("error.musickitError")} \n${code.toUpperCase()}`, + }); + }); + }); }, async oobeInit() { this.appMode = "oobe"; From 0a237278c2548c472652523a9c64cd164eff5209 Mon Sep 17 00:00:00 2001 From: coredev-uk Date: Thu, 22 Sep 2022 22:46:03 +0000 Subject: [PATCH 56/62] chore: Updated i18n Source [ci skip] --- src/i18n/source/en_US.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 9163dd1b..d17e39db 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -229,6 +229,7 @@ "home.followedArtists": "Followed Artists", "error.appleMusicSubRequired": "Apple Music requires a subscription.", "error.connectionError": "There was a problem connecting to Apple Music.", + "error.musickitError": "MusicKit Encountered an Error: ", "error.noResults": "No Results.", "error.noResults.description": "Try a new search.", "podcast.followOnCider": "Follow On Cider", From a7753f8bf07105fce1359c48f05641155477fa8b Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Thu, 22 Sep 2022 21:54:04 -0700 Subject: [PATCH 57/62] Updated en_US.json to match cider 2 --- src/i18n/en_US.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index d17e39db..a6be2f27 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -219,6 +219,7 @@ "action.favorite": "Favorite", "action.removeFavorite": "Remove Favorite", "action.refresh": "Refresh", + "action.save": "Save", "home.title": "Home", "home.recentlyPlayed": "Recently Played", "home.recentlyAdded": "Recently Added", @@ -229,9 +230,9 @@ "home.followedArtists": "Followed Artists", "error.appleMusicSubRequired": "Apple Music requires a subscription.", "error.connectionError": "There was a problem connecting to Apple Music.", - "error.musickitError": "MusicKit Encountered an Error: ", "error.noResults": "No Results.", "error.noResults.description": "Try a new search.", + "error.musickitError": "MusicKit Encountered an Error: ", "podcast.followOnCider": "Follow On Cider", "podcast.followedOnCider": "Following On Cider", "podcast.subscribeOnItunes": "Subscribe On iTunes", @@ -250,6 +251,7 @@ "action.done": "Done", "action.submit": "Submit", "action.editTracklist": "Edit Tracklist", + "action.editDescription": "Edit Description", "action.addToLibrary": "Add to Library", "action.addToLibrary.success": "Added to Library", "action.addToLibrary.error": "Error Adding to Library", @@ -262,8 +264,8 @@ "action.removeFromQueue.success": "Removed from Queue", "action.removeFromQueue.error": "Error Removing from Queue", "action.createPlaylist": "Create a New Playlist", - "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.addToPlaylist": "Add to Playlist", + "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.removeFromPlaylist": "Remove from Playlist", "action.addToFavorites": "Add to Favorites", "action.follow": "Follow", @@ -540,6 +542,7 @@ "settings.option.connectivity.discordRPC.buttons.viewOnAppleMusic": "View on Apple Music", "settings.option.connectivity.discordRPC.buttons.viewOnOtherMusicServices": "View on Other Music Services", "settings.option.connectivity.discordRPC.showSongLink": "Show Song.link button instead of Apple Music button on Discord Rich Presence", + "settings.option.connectivity.discordRPC.hideButtons": "Hide buttons on Discord Rich Presence", "settings.option.connectivity.discordRPC.hideTimestamp": "Hide timestamp on Discord Rich Presence", "settings.option.connectivity.discordRPC.detailsFormat": "Details Format", "settings.option.connectivity.discordRPC.stateFormat": "State Format", From 50ed8a357eeddfd9dff83c3c21c67376552e8359 Mon Sep 17 00:00:00 2001 From: booploops Date: Fri, 23 Sep 2022 04:54:20 +0000 Subject: [PATCH 58/62] chore: Updated i18n Source [ci skip] --- src/i18n/source/en_US.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index d17e39db..a6be2f27 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -219,6 +219,7 @@ "action.favorite": "Favorite", "action.removeFavorite": "Remove Favorite", "action.refresh": "Refresh", + "action.save": "Save", "home.title": "Home", "home.recentlyPlayed": "Recently Played", "home.recentlyAdded": "Recently Added", @@ -229,9 +230,9 @@ "home.followedArtists": "Followed Artists", "error.appleMusicSubRequired": "Apple Music requires a subscription.", "error.connectionError": "There was a problem connecting to Apple Music.", - "error.musickitError": "MusicKit Encountered an Error: ", "error.noResults": "No Results.", "error.noResults.description": "Try a new search.", + "error.musickitError": "MusicKit Encountered an Error: ", "podcast.followOnCider": "Follow On Cider", "podcast.followedOnCider": "Following On Cider", "podcast.subscribeOnItunes": "Subscribe On iTunes", @@ -250,6 +251,7 @@ "action.done": "Done", "action.submit": "Submit", "action.editTracklist": "Edit Tracklist", + "action.editDescription": "Edit Description", "action.addToLibrary": "Add to Library", "action.addToLibrary.success": "Added to Library", "action.addToLibrary.error": "Error Adding to Library", @@ -262,8 +264,8 @@ "action.removeFromQueue.success": "Removed from Queue", "action.removeFromQueue.error": "Error Removing from Queue", "action.createPlaylist": "Create a New Playlist", - "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.addToPlaylist": "Add to Playlist", + "action.addToPlaylist.duplicate": "Item already exists in playlist. Do you want to continue?", "action.removeFromPlaylist": "Remove from Playlist", "action.addToFavorites": "Add to Favorites", "action.follow": "Follow", @@ -540,6 +542,7 @@ "settings.option.connectivity.discordRPC.buttons.viewOnAppleMusic": "View on Apple Music", "settings.option.connectivity.discordRPC.buttons.viewOnOtherMusicServices": "View on Other Music Services", "settings.option.connectivity.discordRPC.showSongLink": "Show Song.link button instead of Apple Music button on Discord Rich Presence", + "settings.option.connectivity.discordRPC.hideButtons": "Hide buttons on Discord Rich Presence", "settings.option.connectivity.discordRPC.hideTimestamp": "Hide timestamp on Discord Rich Presence", "settings.option.connectivity.discordRPC.detailsFormat": "Details Format", "settings.option.connectivity.discordRPC.stateFormat": "State Format", From 5383581f8f467c3f26f2c0fa2586f1f11bde27c2 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Fri, 23 Sep 2022 00:43:08 -0700 Subject: [PATCH 59/62] plugins adjustment --- src/renderer/main/ciderfrontapi.js | 9 +- src/renderer/main/vueapp.js | 1 + src/renderer/views/app/app-navigation.ejs | 291 ++++++++++------------ 3 files changed, 146 insertions(+), 155 deletions(-) diff --git a/src/renderer/main/ciderfrontapi.js b/src/renderer/main/ciderfrontapi.js index 8a7ef76a..95a57919 100644 --- a/src/renderer/main/ciderfrontapi.js +++ b/src/renderer/main/ciderfrontapi.js @@ -3,11 +3,16 @@ const CiderFrontAPI = { MenuEntry: function () { this.id = ""; this.name = ""; - this.onClick = () => {}; + this.onClick = () => { }; + this.top = false }, }, AddMenuEntry(entry) { - app.pluginMenuEntries.push(entry); + if (entry?.top) { + app.pluginMenuTopEntries.push(entry); + } else { + app.pluginMenuEntries.push(entry); + } app.pluginInstalled = true; }, StyleSheets: { diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index f11d4470..52fe2de6 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -18,6 +18,7 @@ const app = new Vue({ mk: {}, pluginInstalled: false, pluginMenuEntries: [], + pluginMenuTopEntries: [], lz: ipcRenderer.sendSync("get-i18n", "en_US"), lzListing: ipcRenderer.sendSync("get-i18n-listing"), radiohls: null, diff --git a/src/renderer/views/app/app-navigation.ejs b/src/renderer/views/app/app-navigation.ejs index 7e03c957..bf6da9dc 100644 --- a/src/renderer/views/app/app-navigation.ejs +++ b/src/renderer/views/app/app-navigation.ejs @@ -1,166 +1,151 @@
- -
-
- - - + + - + - + - + - + - + - + - + + - + -
+ +
+
+ + + + + + +
+
+
+ + +
- - - - - - -
-
-
- - - -
-
- - -
-
- -
- -
-
+
+ + +
+
+ +
+ +
+
From 4d9bccebd07be793993eefd8b1b3c4c2071079b9 Mon Sep 17 00:00:00 2001 From: booploops Date: Fri, 23 Sep 2022 07:43:42 +0000 Subject: [PATCH 60/62] chore: Prettified Code [ci skip] --- src/renderer/main/ciderfrontapi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/main/ciderfrontapi.js b/src/renderer/main/ciderfrontapi.js index 95a57919..6b87ad3f 100644 --- a/src/renderer/main/ciderfrontapi.js +++ b/src/renderer/main/ciderfrontapi.js @@ -3,8 +3,8 @@ const CiderFrontAPI = { MenuEntry: function () { this.id = ""; this.name = ""; - this.onClick = () => { }; - this.top = false + this.onClick = () => {}; + this.top = false; }, }, AddMenuEntry(entry) { From 3f4351d09fcb4e23557b83414e45fd9581450036 Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 23 Sep 2022 18:40:24 +0100 Subject: [PATCH 61/62] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 00c9fea1..5009beff 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -10,7 +10,7 @@ contact_links: url: https://discord.com/invite/AppleMusic about: For quick support, make a ticket or ask for community support here. - name: Cider Documentation - url: https://docs.cider.sh/support/troubleshooting + url: https://docs.cider.sh/support/faqs about: In most cases, these troubleshooting tips can resolve basic issues. Try them out before opening an issue. - name: GitHub Issues url: https://github.com/ciderapp/Cider/issues From b06a9283cc9962fc0d2706179666c2612ae8d10d Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 24 Sep 2022 23:21:50 +0100 Subject: [PATCH 62/62] Stop music before close --- src/main/base/browserwindow.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/base/browserwindow.ts b/src/main/base/browserwindow.ts index c044894a..f0b4731a 100644 --- a/src/main/base/browserwindow.ts +++ b/src/main/base/browserwindow.ts @@ -1445,16 +1445,18 @@ export class BrowserWindow { } }); - win.on("close", (e: any) => { + win.on("close", async (e: any) => { if ((process.platform === "darwin" || utils.getStoreValue("general.close_button_hide")) && !isQuitting) { e.preventDefault(); win.hide(); } else { - win.webContents.executeJavaScript(` + await win.webContents.executeJavaScript(` window.localStorage.setItem("currentTrack", JSON.stringify(app.mk.nowPlayingItem)); window.localStorage.setItem("currentTime", JSON.stringify(app.mk.currentPlaybackTime)); window.localStorage.setItem("currentQueue", JSON.stringify(app.mk.queue._unplayedQueueItems)); - ipcRenderer.send('stopGCast','');`); + ipcRenderer.send('stopGCast',''); + MusicKit.getInstance().stop(); + `); } });