From 0c94397c8d257c390b7853681641f6810dbc833a Mon Sep 17 00:00:00 2001 From: Marvin Schenkel Date: Mon, 7 Oct 2024 15:59:16 +0200 Subject: [PATCH] Add UI changes for dont stop the music. --- src/layouts/default/PlayerOSD/PlayerFullscreen.vue | 10 ++++++++++ src/plugins/api/index.ts | 8 ++++++++ src/plugins/api/interfaces.ts | 1 + src/translations/en.json | 4 +++- src/translations/en_GB.json | 4 +++- src/translations/nl.json | 4 +++- 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/layouts/default/PlayerOSD/PlayerFullscreen.vue b/src/layouts/default/PlayerOSD/PlayerFullscreen.vue index 1e745c77..94055c8e 100644 --- a/src/layouts/default/PlayerOSD/PlayerFullscreen.vue +++ b/src/layouts/default/PlayerOSD/PlayerFullscreen.vue @@ -612,6 +612,16 @@ const openQueueMenu = function (evt: Event) { a.label.toUpperCase() > b.label?.toUpperCase() ? 1 : -1, ), }, + { + label: store.activePlayerQueue!.dont_stop_the_music_enabled + ? 'dont_stop_the_music_enabled' + : 'dont_stop_the_music_disabled', + labelArgs: [], + action: () => { + api.queueCommandDontStopTheMusicToggle(store.activePlayerQueue!.queue_id); + }, + icon: 'mdi-all-inclusive' + } ]; eventbus.emit('contextmenu', { items: menuItems, diff --git a/src/plugins/api/index.ts b/src/plugins/api/index.ts index 4f41f33b..b90a44df 100644 --- a/src/plugins/api/index.ts +++ b/src/plugins/api/index.ts @@ -719,6 +719,14 @@ export class MusicAssistantApi { this.queueCommandRepeat(queueId, RepeatMode.OFF); } } + public queueCommandDontStopTheMusic(queueId: string, dont_stop_the_music_enabled: boolean) { + // Configure dont_stop_the_music setting on the the queue. + this.playerQueueCommand(queueId, 'dont_stop_the_music', { dont_stop_the_music_enabled }); + } + public queueCommandDontStopTheMusicToggle(queueId: string) { + // Toggle dont_stop_the_music mode of a queue + this.queueCommandDontStopTheMusic(queueId, !this.queues[queueId].dont_stop_the_music_enabled); + } public playerQueueCommand( queue_id: string, command: string, diff --git a/src/plugins/api/interfaces.ts b/src/plugins/api/interfaces.ts index f79e5e99..9392712f 100644 --- a/src/plugins/api/interfaces.ts +++ b/src/plugins/api/interfaces.ts @@ -522,6 +522,7 @@ export interface PlayerQueue { available: boolean; items: number; shuffle_enabled: boolean; + dont_stop_the_music_enabled: boolean; repeat_mode: RepeatMode; current_index?: number; index_in_buffer?: number; diff --git a/src/translations/en.json b/src/translations/en.json index 352bffdb..8b5ec9ba 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -527,5 +527,7 @@ "image_make_primary": "Make primary", "update_metadata": "Update metadata", "cancel": "Cancel", - "transfer_queue": "Transfer queue to another player" + "transfer_queue": "Transfer queue to another player", + "dont_stop_the_music_enabled": "Don't stop the music is enabled", + "dont_stop_the_music_disabled": "Don't stop the music is disabled" } \ No newline at end of file diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 3684710f..b2887ef8 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -527,5 +527,7 @@ "image_make_primary": "Make primary", "update_metadata": "Update metadata", "cancel": "Cancel", - "transfer_queue": "Transfer queue to another player" + "transfer_queue": "Transfer queue to another player", + "dont_stop_the_music_enabled": "Don't stop the music is enabled", + "dont_stop_the_music_disabled": "Don't stop the music is disabled" } \ No newline at end of file diff --git a/src/translations/nl.json b/src/translations/nl.json index dffed028..288996cb 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -483,5 +483,7 @@ "play_replace": "Nu afspelen (queue leegmaken)", "played": "Gespeeld", "background_task_added": "De actie wordt door de server op de achtergrond uitgevoerd en kan enige tijd in beslag nemen. Houd het serverlogboek in de gaten voor de voortgang", - "cancel": "Annuleren" + "cancel": "Annuleren", + "dont_stop_the_music_enabled": "Don't stop the music is ingeschakeld", + "dont_stop_the_music_disabled": "Don't stop the music is uitgeschakeld" } \ No newline at end of file