From 499659469e9eebd01f04a779c62bae96d333a265 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Sat, 29 Jan 2022 12:37:36 +0000 Subject: [PATCH] Playback Notifications Now Configurable and available on all systems DiscordRPC swapped to bool for clear activity Updated store file to bools and added playback notification Updated en_GB to fun language, as from what I've seen none of the US English words are different in GB English --- src/i18n/en_GB.jsonc | 8 +- src/i18n/en_US.jsonc | 5 +- src/main/base/store.ts | 9 +- src/main/plugins/discordrpc.ts | 4 +- src/main/plugins/minimizeToTray.ts | 5 +- src/renderer/index.js | 2 +- src/renderer/views/pages/settings.ejs | 1171 +++++++++++++------------ 7 files changed, 625 insertions(+), 579 deletions(-) diff --git a/src/i18n/en_GB.jsonc b/src/i18n/en_GB.jsonc index ac64c887..1606ba36 100644 --- a/src/i18n/en_GB.jsonc +++ b/src/i18n/en_GB.jsonc @@ -1,10 +1,10 @@ { // i18n Info - "i18n.languageName": "English (UK)", // name of language in native language + "i18n.languageName": "English (UK) (Roadman)", // name of language in native language "i18n.languageNameEnglish": "English (UK)", // name of language in English - "i18n.category": "main", // main = real language, fun = fun community languages - "i18n.authors": "", // Authors, if you contribute to this file feel free to add your name seperated with a space + "i18n.category": "fun", // main = real language, fun = fun community languages + "i18n.authors": "Core", // Authors, if you contribute to this file feel free to add your name seperated with a space "date.format": "${d} ${m}, ${y}", - "home.friendsListeningTo": "Bruv's Listening To" + "home.friendsListeningTo": "Mandems Listening To" } \ No newline at end of file diff --git a/src/i18n/en_US.jsonc b/src/i18n/en_US.jsonc index 85269319..d6467ba7 100644 --- a/src/i18n/en_US.jsonc +++ b/src/i18n/en_US.jsonc @@ -244,6 +244,7 @@ "settings.header.connectivity": "Connectivity", "settings.header.connectivity.description": "Adjust the connectivity settings for Cider.", "settings.option.connectivity.discordRPC": "Discord Rich Presence", // Dropdown + "settings.option.connectivity.playbackNotifications": "Playback Notifications", // Toggle // Refer to term.disabled for the disabled option "settings.header.connectivity.discordRPC.cider": "Display as 'Cider'", "settings.header.connectivity.discordRPC.appleMusic": "Display as 'Apple Music'", @@ -261,8 +262,8 @@ "settings.option.experimental.compactUI": "Compact UI", // Toggle "settings.option.experimental.closeButtonBehaviour": "Close Button Behavior", "settings.option.experimental.closeButtonBehaviour.quit": "Quit Cider", - "settings.option.experimental.closeButtonBehaviour.minimizeTaskbar": "Minimize to taskbar", - "settings.option.experimental.closeButtonBehaviour.minimizeTray": "Minimize to system tray", + "settings.option.experimental.closeButtonBehaviour.minimizeTaskbar": "Minimize to Taskbar", + "settings.option.experimental.closeButtonBehaviour.minimizeTray": "Minimize to Tray", // Refer to term.disabled & term.enabled // Spatialization Menu diff --git a/src/main/base/store.ts b/src/main/base/store.ts index 185aceb7..a1f067b6 100644 --- a/src/main/base/store.ts +++ b/src/main/base/store.ts @@ -7,10 +7,11 @@ export class ConfigStore { private defaults: any = { "general": { "close_behavior": 0, // 0 = close, 1 = minimize, 2 = minimize to tray - "startup_behavior": 0, // 0 = nothing, 1 = open on startup + "open_on_startup": false, "discord_rpc": 1, // 0 = disabled, 1 = enabled as Cider, 2 = enabled as Apple Music - "discordClearActivityOnPause": 1, // 0 = disabled, 1 = enabled - "language" : "en_US" + "discord_rpc_clear_on_pause": true, + "language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future + "playbackNotifications": true }, "home": { "followedArtists": [], @@ -163,4 +164,4 @@ export class ConfigStore { }) } -} \ No newline at end of file +} diff --git a/src/main/plugins/discordrpc.ts b/src/main/plugins/discordrpc.ts index f7fb3d26..3265320f 100644 --- a/src/main/plugins/discordrpc.ts +++ b/src/main/plugins/discordrpc.ts @@ -125,7 +125,7 @@ export default class DiscordRichPresence { // Check if its pausing (false) or playing (true) if (!attributes.status) { - if (DiscordRichPresence._store.general.discordClearActivityOnPause == 1) { + if (DiscordRichPresence._store.general.discord_rpc_clear_on_pause) { this._client.clearActivity() .catch((e: any) => console.error(`[DiscordRichPresence][clearActivity] ${e}`)); } else { @@ -138,7 +138,7 @@ export default class DiscordRichPresence { } } else if (this._activity && this._activityCache !== this._activity && this._activity.details) { - if (DiscordRichPresence._store.general.discordClearActivityOnPause != 1) { + if (!DiscordRichPresence._store.general.discord_rpc_clear_on_pause) { this._activity.smallImageKey = 'play'; this._activity.smallImageText = 'Playing'; } diff --git a/src/main/plugins/minimizeToTray.ts b/src/main/plugins/minimizeToTray.ts index 98050bc8..67bbc301 100644 --- a/src/main/plugins/minimizeToTray.ts +++ b/src/main/plugins/minimizeToTray.ts @@ -123,10 +123,7 @@ export default class MinimizeToTray { // listen for close event this._win.hide(); this.SetContextMenu(false); - }); - electron.ipcMain.handle("update-store-mtt", (event, value) => { - this._store.general["close_behavior"] = value; - }) + }); this._win.on("close", (e :any) => { if (this._forceQuit || this._store.general["close_behavior"] == '0' ) { this._app.quit(); diff --git a/src/renderer/index.js b/src/renderer/index.js index 2b2aae72..2ea1f04d 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -751,7 +751,7 @@ const app = new Vue({ app.loadLyrics(); // Playback Notifications - if ((app.platform === "darwin" || app.platform === "linux") && !document.hasFocus() && a.artistName && a.artwork && a.name) { + if (this.cfg.general.playbackNotifications && !document.hasFocus() && a.artistName && a.artwork && a.name) { if (this.notification) { this.notification.close() } diff --git a/src/renderer/views/pages/settings.ejs b/src/renderer/views/pages/settings.ejs index 2152ec1b..69f2a63e 100644 --- a/src/renderer/views/pages/settings.ejs +++ b/src/renderer/views/pages/settings.ejs @@ -10,8 +10,9 @@ {{$root.getLz('settings.option.audio.quality')}}
- + @@ -33,7 +34,8 @@ {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.description')}}
- +
@@ -47,20 +49,21 @@
-
- {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioNormalization')}} -
- {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioNormalization.description')}} +
+ {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioNormalization')}} +
+ {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioNormalization.description')}}
- +
-
- {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioSpatialization')}} -
- {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioSpatialization.description')}} +
+ {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioSpatialization')}} +
+ {{$root.getLz('settings.option.audio.enableAdvancedFunctionality.audioSpatialization.description')}}
@@ -76,10 +79,16 @@ {{$root.getLz('settings.option.visual.windowBackgroundStyle')}}
- + + +
@@ -89,23 +98,33 @@
-
+
{{$root.getLz('settings.option.visual.animatedArtworkQuality')}}
@@ -123,9 +142,13 @@ ({{$root.getLz('settings.option.visual.hardwareAcceleration.description')}})
- + +
@@ -135,7 +158,8 @@ {{$root.getLz('settings.option.visual.showPersonalInfo')}}
- +
@@ -144,564 +168,587 @@ {{$root.getLz('settings.header.lyrics')}}
-
-
- {{$root.getLz('settings.option.lyrics.enableMusixmatch')}} +
+
+ {{$root.getLz('settings.option.lyrics.enableMusixmatch')}} +
+
+ +
-
- +
+
+ {{$root.getLz('settings.option.lyrics.enableMusixmatchKaraoke')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.lyrics.musixmatchPreferredLanguage')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.lyrics.enableYoutubeLyrics')}} +
+
+ +
-
-
- {{$root.getLz('settings.option.lyrics.enableMusixmatchKaraoke')}} -
-
- -
+
+ {{$root.getLz('settings.header.connectivity')}}
-
-
- {{$root.getLz('settings.option.lyrics.musixmatchPreferredLanguage')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.lyrics.enableYoutubeLyrics')}} -
-
- -
-
-
-
- {{$root.getLz('settings.header.connectivity')}} -
-
+
-
-
- {{$root.getLz('settings.option.connectivity.discordRPC')}} +
+
+ {{$root.getLz('settings.option.connectivity.playbackNotifications')}} +
+
+ +
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.discordRPC.clearOnPause')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.lastfmScrobble')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.lastfmScrobble.delay')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.lastfmScrobble.nowPlaying')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.lastfmScrobble.removeFeatured')}} -
-
- -
-
-
-
- {{$root.getLz('settings.option.connectivity.lastfmScrobble.filterLoop')}} -
-
- -
-
-
-
- {{$root.getLz('settings.header.experimental')}} -
-
-
-
- {{$root.getLz('settings.option.experimental.compactUI')}} +
+
+ {{$root.getLz('settings.option.connectivity.discordRPC')}} +
+
+ +
-
- +
+
+ {{$root.getLz('settings.option.connectivity.discordRPC.clearOnPause')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.connectivity.lastfmScrobble')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.connectivity.lastfmScrobble.delay')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.connectivity.lastfmScrobble.nowPlaying')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.connectivity.lastfmScrobble.removeFeatured')}} +
+
+ +
+
+
+
+ {{$root.getLz('settings.option.connectivity.lastfmScrobble.filterLoop')}} +
+
+ +
+
+ {{$root.getLz('settings.header.experimental')}} +
+
-
-
- {{$root.getLz('term.language')}} +
+
+ {{$root.getLz('settings.option.experimental.compactUI')}} +
+
+ +
-
- + +
+
+ {{$root.getLz('term.language')}} +
+
+ +
+
+
+
+ {{$root.getLz("settings.option.experimental.closeButtonBehaviour")}} +
+
+ +
-
-
- {{$root.getLz("settings.option.experimental.closeButtonBehaviour")}} -
-
- -
-
-
{{$root.getLz('settings.header.unfinished')}}
-
-
- Theme +
+
+ Theme +
+
+ +
-
- +
+
+ Theme Options +
+
+ +
+
+
+
+ Scrollbars +
+
+ +
+
+
+
+ Refresh Rate +
+
+ +
+
+
+
+ Open Cider on Startup +
+
+ +
-
-
- Theme Options -
-
- -
-
-
-
- Scrollbars -
-
- -
-
-
-
- Refresh Rate -
-
- -
-
-
-
- Open Cider on Startup -
-
- -
-
-
\ No newline at end of file + Vue.component('cider-settings', { + template: "#cider-settings", + props: [], + data: function () { + return { + app: this.$root + } + }, + mounted: function () { + if (app.cfg.lastfm.enabled) { + const element = document.getElementById('lfmConnect'); + if (element) { + element.innerHTML = `Disconnect\n

(Authed: ${app.cfg.lastfm.auth_token})

`; + element.onclick = app.LastFMDeauthorize; + } + } + }, + methods: { + getLanguages: function () { + let langs = this.$root.lzListing + let categories = { + "main": [], + "fun": [], + "unsorted": [] + } + // sort by category if category is undefined or empty put it in "unsorted" + for (let i = 0; i < langs.length; i++) { + if (langs[i].category === undefined || langs[i].category === "") { + categories.unsorted.push(langs[i]) + } else { + categories[langs[i].category].push(langs[i]) + } + } + // return + return categories + }, + addExperiment(flag) { + app.cfg.advanced.experiments.push(flag); + }, + removeExperiment(flag) { + app.cfg.advanced.experiments.splice(app.cfg.advanced.experiments.indexOf(flag), 1); + }, + toggleAudioContext: function () { + if (app.cfg.advanced.AudioContext) { + CiderAudio.init(); + if (app.cfg.audio.normalization) { + CiderAudio.normalizerOn() + } + if (app.cfg.audio.spatial) { + CiderAudio.spatialOn() + } + } else { + CiderAudio.off(); + } + }, + toggleNormalization: function () { + if (app.cfg.audio.normalization) { + CiderAudio.normalizerOn() + } else { + CiderAudio.normalizerOff() + } + }, + toggleSpatial: function () { + if (app.cfg.audio.spatial) { + CiderAudio.spatialOn() + } else { + CiderAudio.spatialOff() + } + }, + changeAudioQuality: function () { + app.mk.bitrate = app.cfg.audio.quality + }, + toggleUserInfo: function () { + app.chrome.hideUserInfo = !app.cfg.visual.showuserinfo + }, + sendDataToMTT: function () { + ipcRenderer.invoke('setStoreValue', 'general.close_behavior', app.cfg.general.close_behavior); + } + } + }) +