From db7017324a762b2faf56c188e539b019635ba091 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 28 Jul 2023 16:48:19 +0200 Subject: [PATCH 1/4] refactor: refactor SettingsTimelapseTab.vue Signed-off-by: Stefan Dej --- .../settings/SettingsTimelapseTab.vue | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/src/components/settings/SettingsTimelapseTab.vue b/src/components/settings/SettingsTimelapseTab.vue index a92b1fb06..d0c349a4a 100644 --- a/src/components/settings/SettingsTimelapseTab.vue +++ b/src/components/settings/SettingsTimelapseTab.vue @@ -4,8 +4,8 @@

{{ $t('Settings.TimelapseTab.General') }}

+ :title="$t('Settings.TimelapseTab.Camera')" + :sub-title="$t('Settings.TimelapseTab.CameraDescription')"> + :title="$t('Settings.TimelapseTab.Mode')" + :sub-title="$t('Settings.TimelapseTab.ModeDescription')"> + :title="$t('Settings.TimelapseTab.HyperlapseCycle')" + :sub-title="$t('Settings.TimelapseTab.HyperlapseCycleDescription')"> + :title="$t('Settings.TimelapseTab.StreamDelayCompensation')" + :sub-title="$t('Settings.TimelapseTab.StreamDelayCompensationDescription')">

{{ $t('Settings.TimelapseTab.Parkhead') }}

+ :title="$t('Settings.TimelapseTab.Parkpos')" + :sub-title="$t('Settings.TimelapseTab.ParkposDescription')"> + :title="$t('Settings.TimelapseTab.PosX')" + :sub-title="$t('Settings.TimelapseTab.PosXDescription')"> + :title="$t('Settings.TimelapseTab.PosY')" + :sub-title="$t('Settings.TimelapseTab.PosYDescription')"> + :title="$t('Settings.TimelapseTab.PosDZ')" + :sub-title="$t('Settings.TimelapseTab.PosDZDescription')"> + :title="$t('Settings.TimelapseTab.TravelSpeed')" + :sub-title="$t('Settings.TimelapseTab.TravelSpeedDescription')"> + :title="$t('Settings.TimelapseTab.RetractSpeed')" + :sub-title="$t('Settings.TimelapseTab.RetractSpeedDescription')"> + :title="$t('Settings.TimelapseTab.RetractDistance')" + :sub-title="$t('Settings.TimelapseTab.RetractDistanceDescription')"> + hide-spin-buttons /> + :title="$t('Settings.TimelapseTab.UnretractSpeed')" + :sub-title="$t('Settings.TimelapseTab.UnretractSpeedDescription')"> + :title="$t('Settings.TimelapseTab.UnretractDistance')" + :sub-title="$t('Settings.TimelapseTab.UnretractDistanceDescription')"> + :title="$t('Settings.TimelapseTab.ParkTime')" + :sub-title="$t('Settings.TimelapseTab.ParkTimeDescription')">

{{ $t('Settings.TimelapseTab.RenderingOptions') }}

+ :title="$t('Settings.TimelapseTab.Targetlength')" + :sub-title="$t('Settings.TimelapseTab.TargetlengthDescription')"> + hide-spin-buttons /> + :title="$t('Settings.TimelapseTab.VariableFpsMin')" + :sub-title="$t('Settings.TimelapseTab.VariableFpsMinDescription')"> + :title="$t('Settings.TimelapseTab.VariableFpsMax')" + :sub-title="$t('Settings.TimelapseTab.VariableFpsMaxDescription')"> + :title="$t('Settings.TimelapseTab.OutputFramerate')" + :sub-title="$t('Settings.TimelapseTab.OutputFramerateDescription')"> + :title="$t('Settings.TimelapseTab.duplicatelastframe')" + :sub-title="$t('Settings.TimelapseTab.duplicatelastframeDescription')"> + :title="$t('Settings.TimelapseTab.ConstantRateFactor')" + :sub-title="$t('Settings.TimelapseTab.ConstantRateFactorDescription')"> + :title="$t('Settings.TimelapseTab.Pixelformat')" + :sub-title="$t('Settings.TimelapseTab.PixelformatDescription')"> + :title="$t('Settings.TimelapseTab.TimeFormatCode')" + :sub-title="$t('Settings.TimelapseTab.TimeFormatCodeDescription')"> + :title="$t('Settings.TimelapseTab.Extraoutputparams')" + :sub-title="$t('Settings.TimelapseTab.ExtraoutputparamsDescription')"> Date: Fri, 28 Jul 2023 16:48:39 +0200 Subject: [PATCH 2/4] fix: use webcam name instead of UUID for timelapse plugin Signed-off-by: Stefan Dej --- src/components/settings/SettingsTimelapseTab.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/settings/SettingsTimelapseTab.vue b/src/components/settings/SettingsTimelapseTab.vue index d0c349a4a..b01dccf3e 100644 --- a/src/components/settings/SettingsTimelapseTab.vue +++ b/src/components/settings/SettingsTimelapseTab.vue @@ -483,11 +483,11 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) { const output: any = [] webcams - .filter((webcam: GuiWebcamStateWebcam) => webcam.urlSnapshot !== '') + .filter((webcam: GuiWebcamStateWebcam) => webcam.snapshot_url !== '') .forEach((webcam: GuiWebcamStateWebcam) => { output.push({ text: webcam.name, - value: webcam.id, + value: webcam.name, }) }) From f21e660e51d8c0a7b7f3dd25e1339ca84e9bb258 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 28 Jul 2023 22:39:11 +0200 Subject: [PATCH 3/4] fix: add function to update timelapse webcam settings after moonraker webcam update Signed-off-by: Stefan Dej --- src/store/gui/webcams/actions.ts | 7 ++++++- src/store/server/timelapse/actions.ts | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/store/gui/webcams/actions.ts b/src/store/gui/webcams/actions.ts index 62d1abe07..eff69cfa0 100644 --- a/src/store/gui/webcams/actions.ts +++ b/src/store/gui/webcams/actions.ts @@ -23,9 +23,14 @@ export const actions: ActionTree = { Vue.$socket.emit('server.webcams.post_item', payload) }, - update({ dispatch }, payload: { webcam: GuiWebcamStateWebcam; oldWebcamName: string }) { + update({ dispatch, rootState }, payload: { webcam: GuiWebcamStateWebcam; oldWebcamName: string }) { Vue.$socket.emit('server.webcams.post_item', payload.webcam) if (payload.webcam.name !== payload.oldWebcamName) dispatch('delete', payload.oldWebcamName) + + // check if timelapse plugin is active, if not stop here + if (!rootState.server?.components.includes('timelapse')) return + + dispatch('server/timelapse/updateCamSettings', {}, { root: true }) }, delete(_, payload: string) { diff --git a/src/store/server/timelapse/actions.ts b/src/store/server/timelapse/actions.ts index 99452eb8f..6ae4df899 100644 --- a/src/store/server/timelapse/actions.ts +++ b/src/store/server/timelapse/actions.ts @@ -52,6 +52,10 @@ export const actions: ActionTree = { Vue.$socket.emit('machine.timelapse.post_settings', payload, { action: 'server/timelapse/initSettings' }) }, + updateCamSettings({ dispatch, state }) { + dispatch('saveSetting', { camera: state.settings.camera }) + }, + resetSnackbar({ commit }) { commit('resetSnackbar') }, From 9428711ef1b7ea5e661a832ad5d170e0f73049a5 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Fri, 28 Jul 2023 22:47:42 +0200 Subject: [PATCH 4/4] fix: send the new webcam name, if the name changes Signed-off-by: Stefan Dej --- src/store/gui/webcams/actions.ts | 6 +++++- src/store/server/timelapse/actions.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/store/gui/webcams/actions.ts b/src/store/gui/webcams/actions.ts index eff69cfa0..16833c8c6 100644 --- a/src/store/gui/webcams/actions.ts +++ b/src/store/gui/webcams/actions.ts @@ -30,7 +30,11 @@ export const actions: ActionTree = { // check if timelapse plugin is active, if not stop here if (!rootState.server?.components.includes('timelapse')) return - dispatch('server/timelapse/updateCamSettings', {}, { root: true }) + dispatch( + 'server/timelapse/updateCamSettings', + { newName: payload.webcam.name, oldName: payload.oldWebcamName }, + { root: true } + ) }, delete(_, payload: string) { diff --git a/src/store/server/timelapse/actions.ts b/src/store/server/timelapse/actions.ts index 6ae4df899..595036af1 100644 --- a/src/store/server/timelapse/actions.ts +++ b/src/store/server/timelapse/actions.ts @@ -52,8 +52,12 @@ export const actions: ActionTree = { Vue.$socket.emit('machine.timelapse.post_settings', payload, { action: 'server/timelapse/initSettings' }) }, - updateCamSettings({ dispatch, state }) { - dispatch('saveSetting', { camera: state.settings.camera }) + updateCamSettings({ dispatch, state }, payload) { + // check if the changed webcam is the timelapse webcam, if not stop here + if (state.settings.camera !== payload.oldName) return + + // send the new webcam name; if it is the same name, it will only update the settings + dispatch('saveSetting', { camera: payload.newName }) }, resetSnackbar({ commit }) {