Skip to content

Commit

Permalink
fix(timelapse): add warning if snapshoturl is set in moonraker
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Jun 26, 2024
1 parent 446ff5c commit 62ea576
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
44 changes: 34 additions & 10 deletions src/components/settings/SettingsTimelapseTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,19 @@
<v-divider class="my-2" />
<settings-row
:title="$t('Settings.TimelapseTab.Camera')"
:sub-title="$t('Settings.TimelapseTab.CameraDescription')">
:sub-title="$t('Settings.TimelapseTab.CameraDescriptionWithSnapshotUrl')">
<v-select
v-if="!blockedsettings.includes('camera') && !blockedsettings.includes('snapshoturl')"
v-model="camera"
:items="cameraOptions"
hide-details
outlined
dense
:disabled="blockedsettings.includes('camera') || blockedsettings.includes('snapshoturl')" />
:disabled="availableSnapshotWebcams.length === 0" />
<v-alert v-else dense text type="warning" class="mb-0">
{{ $t('Settings.TimelapseTab.CameraWarningAlreadySet') }}
<small>({{ $t('Settings.TimelapseTab.CameraWarningAlreadySetSmall') }})</small>
</v-alert>
</settings-row>
<v-divider class="my-2" />
<settings-row
Expand Down Expand Up @@ -552,18 +557,29 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
},
]
get availableSnapshotWebcams() {
return this.$store.getters['gui/webcams/getWebcams'].filter(
(webcam: GuiWebcamStateWebcam) => webcam.snapshot_url !== ''
)
}
get cameraOptions() {
const webcams = this.$store.getters['gui/webcams/getWebcams']
const output: any = []
webcams
.filter((webcam: GuiWebcamStateWebcam) => webcam.snapshot_url !== '')
.forEach((webcam: GuiWebcamStateWebcam) => {
output.push({
text: webcam.name,
value: webcam.name,
})
if (this.blockedsettings.includes('camera') || this.blockedsettings.includes('snapshoturl')) {
return [{ value: null, text: this.$t('Settings.TimelapseTab.SetInMoonrakerConf') }]
}
if (this.availableSnapshotWebcams.length === 0) {
return [{ value: null, text: this.$t('Settings.TimelapseTab.NoWebcamFound') }]
}
this.availableSnapshotWebcams.forEach((webcam: GuiWebcamStateWebcam) => {
output.push({
text: webcam.name,
value: webcam.name,
})
})
return caseInsensitiveSort(output, 'text')
}
Expand Down Expand Up @@ -853,6 +869,14 @@ export default class SettingsTimelapseTab extends Mixins(BaseMixin) {
}
get camera() {
if (
this.blockedsettings.includes('camera') ||
this.blockedsettings.includes('snapshoturl') ||
this.availableSnapshotWebcams.length === 0
) {
return null
}
return this.$store.state.server.timelapse.settings.camera
}
Expand Down
6 changes: 5 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,9 @@
"Autorender": "Autorender",
"AutorenderDescription": "If enabled, the timelapse video will automatically render at the end of the print",
"Camera": "Camera",
"CameraDescription": "Select which camera should be used",
"CameraDescriptionWithSnapshotUrl": "Select which camera should be used (with snapshot URL)",
"CameraWarningAlreadySet": "This value is already set in the Moonraker configuration file.",
"CameraWarningAlreadySetSmall": "snapshoturl in the [timelapse] section",
"ConstantRateFactor": "Constant Rate Factor",
"ConstantRateFactorDescription": "This configure quality vs file size of the rendered video. The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default and 51 is worst quality possible. A lower value generally leads to higher quality and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless.",
"duplicatelastframe": "Duplicate Last Frame",
Expand All @@ -1130,6 +1132,7 @@
"HyperlapseCycleDescription": "A snapshot will be taken any X seconds",
"Mode": "Mode",
"ModeDescription": "Select between Layer macro and Hyperlapse (time-based) mode",
"NoWebcamFound": "No Webcam available",
"OutputFramerate": "Output Framerate",
"OutputFramerateDescription": "Defines the framerate of the video. Note: this will be ignored if variable_fps is enabled",
"Parkhead": "Park Toolhead",
Expand Down Expand Up @@ -1160,6 +1163,7 @@
"RulesZeroAndPositive": "Value must be 0 or greater!",
"SaveFrames": "Save Frames",
"SaveFramesDescription": "Save the frames to a zip-file for external rendering",
"SetInMoonrakerConf": "Set in moonraker.conf",
"StreamDelayCompensation": "Stream Delay Compensation",
"StreamDelayCompensationDescription": "Delay frame capture",
"Targetlength": "Target Length",
Expand Down

0 comments on commit 62ea576

Please sign in to comment.