Extracted FFMPEG path config into reusable snippet & added test button
This commit is contained in:
parent
bc97241eef
commit
d5a083b0b5
3 changed files with 65 additions and 9 deletions
|
|
@ -169,6 +169,10 @@ $(function() {
|
|||
self.settings = undefined;
|
||||
self.lastReceivedSettings = undefined;
|
||||
|
||||
self.webcam_ffmpegPathText = ko.observable();
|
||||
self.webcam_ffmpegPathOk = ko.observable(false);
|
||||
self.webcam_ffmpegPathBroken = ko.observable(false);
|
||||
|
||||
self.addTemperatureProfile = function() {
|
||||
self.temperature_profiles.push({name: "New", extruder:0, bed:0});
|
||||
};
|
||||
|
|
@ -253,6 +257,43 @@ $(function() {
|
|||
});
|
||||
};
|
||||
|
||||
self.testWebcamFfmpegPath = function() {
|
||||
if (!self.webcam_ffmpegPath()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var successCallback = function(response) {
|
||||
if (!response.result) {
|
||||
if (!response.exists) {
|
||||
self.webcam_ffmpegPathText(gettext("The path doesn't exist"));
|
||||
} else if (!response.typeok) {
|
||||
self.webcam_ffmpegPathText(gettext("The path is not a file"));
|
||||
} else if (!response.access) {
|
||||
self.webcam_ffmpegPathText(gettext("The path is not an executable"));
|
||||
}
|
||||
} else {
|
||||
self.webcam_ffmpegPathText(gettext("The path is valid"));
|
||||
}
|
||||
self.webcam_ffmpegPathOk(response.result);
|
||||
self.webcam_ffmpegPathBroken(!response.result);
|
||||
};
|
||||
|
||||
var path = self.webcam_ffmpegPath();
|
||||
$.ajax({
|
||||
url: API_BASEURL + "util/test",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({
|
||||
command: "path",
|
||||
path: path,
|
||||
check_type: "file",
|
||||
check_access: "x"
|
||||
}),
|
||||
contentType: "application/json; charset=UTF-8",
|
||||
success: successCallback
|
||||
})
|
||||
};
|
||||
|
||||
self.onSettingsShown = function() {
|
||||
self.requestData();
|
||||
};
|
||||
|
|
@ -698,15 +739,23 @@ $(function() {
|
|||
};
|
||||
|
||||
self.saveEnqueued = function(callback) {
|
||||
var data = self.enqueuedForSaving;
|
||||
self.enqueuedForSaving = undefined;
|
||||
var data = self.getEnqueued();
|
||||
self.resetEnqueued();
|
||||
|
||||
if (data == undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.saveData(data, callback);
|
||||
}
|
||||
};
|
||||
|
||||
self.getEnqueued = function() {
|
||||
return self.enqueuedForSaving;
|
||||
};
|
||||
|
||||
self.resetEnqueued = function() {
|
||||
self.enqueueForSaving = undefined;
|
||||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<div class="control-group" title="{{ _('Full path to the FFMPEG binary') }}">
|
||||
<label class="control-label" for="settings-webcamFfmpegPath">{{ _('Path to FFMPEG') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-block-level" data-bind="value: webcam_ffmpegPath" id="settings-webcamFfmpegPath">
|
||||
<button class="btn" type="button" data-bind="click: testWebcamFfmpegPath, enable: webcam_ffmpegPath(), css: {disabled: !webcam_ffmpegPath()}">{{ _('Test') }}</button>
|
||||
</div>
|
||||
<span class="help-block" data-bind="visible: webcam_ffmpegPathBroken() || webcam_ffmpegPathOk, text: webcam_ffmpegPathText"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
<form class="form-horizontal">
|
||||
{% include "dialogs/_snippets/configurewebcamurls.jinja2" %}
|
||||
<div class="control-group" title="{{ _('Full path to the FFMPEG binary') }}">
|
||||
<label class="control-label" for="settings-webcamFfmpegPath">{{ _('Path to FFMPEG') }}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-block-level" data-bind="value: webcam_ffmpegPath" id="settings-webcamFfmpegPath">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "dialogs/_snippets/configureffmpeg.jinja2" %}
|
||||
|
||||
<div class="control-group" title="{{ _('Bitrate to use for encoding the timelapse video') }}">
|
||||
<label class="control-label" for="settings-webcamBitrate">{{ _('Timelapse bitrate') }}</label>
|
||||
<div class="controls">
|
||||
|
|
|
|||
Loading…
Reference in a new issue