From 1f9c9bed42ddef19b4fa515870a3fe2e8213e323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 7 Mar 2018 14:56:10 +0100 Subject: [PATCH] Timelapse: Remove post roll capturing from timed timelapses As discussed in #2317 this option was confusing and frustrating too many people. Instead of an actual capture we'll now just do the same as for z-based timelapses and use the last image repeatedly. No, using the live webstream and capturing real time image is NOT an option and not going to happen here, see the discussion in #2317 on this as well. --- src/octoprint/server/api/timelapse.py | 11 +---- .../static/js/app/viewmodels/timelapse.js | 12 ------ src/octoprint/templates/tabs/timelapse.jinja2 | 11 +---- src/octoprint/timelapse.py | 43 +++---------------- 4 files changed, 7 insertions(+), 70 deletions(-) diff --git a/src/octoprint/server/api/timelapse.py b/src/octoprint/server/api/timelapse.py index 2c5af7336..2c54a5c86 100644 --- a/src/octoprint/server/api/timelapse.py +++ b/src/octoprint/server/api/timelapse.py @@ -43,8 +43,7 @@ def _config_for_timelapse(timelapse): return dict(type="timed", postRoll=timelapse.post_roll, fps=timelapse.fps, - interval=timelapse.interval, - capturePostRoll=timelapse.capture_post_roll) + interval=timelapse.interval) else: return dict(type="off") @@ -216,14 +215,6 @@ def setTimelapseConfig(): else: return make_response("Invalid value for interval: %d" % interval, 400) - if "capturePostRoll" in data: - try: - capturePostRoll = bool(data["capturePostRoll"]) - except ValueError: - return make_response("Invalid value for capturePostRoll: %r" % data["capturePostRoll"], 400) - else: - config["options"]["capturePostRoll"] = capturePostRoll - if "retractionZHop" in data: try: retractionZHop = float(data["retractionZHop"]) diff --git a/src/octoprint/static/js/app/viewmodels/timelapse.js b/src/octoprint/static/js/app/viewmodels/timelapse.js index 5599f7f12..74c1bf22f 100644 --- a/src/octoprint/static/js/app/viewmodels/timelapse.js +++ b/src/octoprint/static/js/app/viewmodels/timelapse.js @@ -11,7 +11,6 @@ $(function() { self.defaultInterval = 10; self.defaultRetractionZHop = 0; self.defaultMinDelay = 5.0; - self.defaultCapturePostRoll = true; self.timelapseType = ko.observable(undefined); self.timelapseTimedInterval = ko.observable(self.defaultInterval); @@ -19,7 +18,6 @@ $(function() { self.timelapseFps = ko.observable(self.defaultFps); self.timelapseRetractionZHop = ko.observable(self.defaultRetractionZHop); self.timelapseMinDelay = ko.observable(self.defaultMinDelay); - self.timelapseCapturePostRoll = ko.observable(self.defaultCapturePostRoll); self.serverConfig = ko.observable(); @@ -76,9 +74,6 @@ $(function() { self.timelapseMinDelay.subscribe(function() { self.isDirty(true); }); - self.timelapseCapturePostRoll.subscribe(function() { - self.isDirty(true); - }); self.persist.subscribe(function() { self.isDirty(true); }); @@ -176,12 +171,6 @@ $(function() { self.timelapseTimedInterval(self.defaultInterval); } - if (config.type === "timed" && config.capturePostRoll !== undefined){ - self.timelapseCapturePostRoll(config.capturePostRoll); - } else { - self.timelapseCapturePostRoll(self.defaultCapturePostRoll); - } - if (config.type === "zchange" && config.retractionZHop !== undefined && config.retractionZHop > 0) { self.timelapseRetractionZHop(config.retractionZHop); } else { @@ -386,7 +375,6 @@ $(function() { if (self.timelapseType() === "timed") { payload["interval"] = self.timelapseTimedInterval(); - payload["capturePostRoll"] = self.timelapseCapturePostRoll(); } if (self.timelapseType() === "zchange") { diff --git a/src/octoprint/templates/tabs/timelapse.jinja2 b/src/octoprint/templates/tabs/timelapse.jinja2 index 3c2cbf495..c47778de5 100644 --- a/src/octoprint/templates/tabs/timelapse.jinja2 +++ b/src/octoprint/templates/tabs/timelapse.jinja2 @@ -56,16 +56,7 @@ {{ _('sec') }} - {{ _('OctoPrint will take additional pictures to add this many seconds to the end of your rendered timelapse.') }} - - - -
-
- + {{ _('OctoPrint will use the final picture to add this many seconds to the end of your rendered timelapse.') }}
diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py index e8ae50c3f..8ecd40fb2 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -333,11 +333,7 @@ def configure_timelapse(config=None, persist=False): if "options" in config and "interval" in config["options"] and config["options"]["interval"] > 0: interval = config["options"]["interval"] - capture_post_roll = True - if "options" in config and "capturePostRoll" in config["options"] and isinstance(config["options"]["capturePostRoll"], bool): - capture_post_roll = config["options"]["capturePostRoll"] - - current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps, capture_post_roll=capture_post_roll) + current = TimedTimelapse(post_roll=postRoll, interval=interval, fps=fps) notify_callbacks(current) @@ -685,13 +681,11 @@ class ZTimelapse(Timelapse): class TimedTimelapse(Timelapse): - def __init__(self, interval=1, capture_post_roll=True, post_roll=0, fps=25): + def __init__(self, interval=1, post_roll=0, fps=25): Timelapse.__init__(self, post_roll=post_roll, fps=fps) self._interval = interval if self._interval < 1: self._interval = 1 # force minimum interval of 1s - self._capture_post_roll = capture_post_roll - self._postroll_captures = 0 self._timer = None self._logger.debug("TimedTimelapse initialized") @@ -699,16 +693,11 @@ class TimedTimelapse(Timelapse): def interval(self): return self._interval - @property - def capture_post_roll(self): - return self._capture_post_roll - def config_data(self): return { "type": "timed", "options": { - "interval": self._interval, - "capture_post_roll": self._capture_post_roll + "interval": self._interval } } @@ -724,40 +713,18 @@ class TimedTimelapse(Timelapse): on_finish=self._on_timer_finished) self._timer.start() - def on_print_done(self, event, payload): - if self._capture_post_roll: - self._postroll_captures = self._post_roll * self._fps - else: - self._postroll_captures = 0 - Timelapse.on_print_done(self, event, payload) - - def calculate_post_roll(self): - if self._capture_post_roll: - return self._post_roll * self._fps * self._interval - else: - return Timelapse.calculate_post_roll(self) - def process_post_roll(self): - if self._capture_post_roll: - return - - # we only use the final image as post roll if we - # are not supposed to capture it + # we only use the final image as post roll self._copying_postroll() self.post_roll_finished() def _timer_active(self): - return self._in_timelapse or self._postroll_captures > 0 + return self._in_timelapse def _timer_task(self): self.capture_image() - if self._postroll_captures > 0: - self._postroll_captures -= 1 def _on_timer_finished(self): - if self._capture_post_roll: - self.post_roll_finished() - # timer is done, delete it self._timer = None