diff --git a/src/octoprint/static/js/app/viewmodels/timelapse.js b/src/octoprint/static/js/app/viewmodels/timelapse.js index 1bd12991..a2b65374 100644 --- a/src/octoprint/static/js/app/viewmodels/timelapse.js +++ b/src/octoprint/static/js/app/viewmodels/timelapse.js @@ -93,7 +93,7 @@ $(function() { if (a["name"].toLocaleLowerCase() > b["name"].toLocaleLowerCase()) return 1; return 0; }, - "creation": function(a, b) { + "date": function(a, b) { // sorts descending if (a["date"] > b["date"]) return -1; if (a["date"] < b["date"]) return 1; diff --git a/src/octoprint/templates/tabs/timelapse.jinja2 b/src/octoprint/templates/tabs/timelapse.jinja2 index 82e6dc36..3c2cbf49 100644 --- a/src/octoprint/templates/tabs/timelapse.jinja2 +++ b/src/octoprint/templates/tabs/timelapse.jinja2 @@ -106,7 +106,7 @@ diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py index d117caeb..dcd2708d 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -92,7 +92,7 @@ def get_finished_timelapses(): "name": entry.name, "size": util.get_formatted_size(entry.stat().st_size), "bytes": entry.stat().st_size, - "date": util.get_formatted_datetime(datetime.datetime.fromtimestamp(entry.stat().st_ctime)) + "date": util.get_formatted_datetime(datetime.datetime.fromtimestamp(entry.stat().st_mtime)) }) return files @@ -116,8 +116,8 @@ def get_unrendered_timelapses(): jobs[prefix]["count"] += 1 jobs[prefix]["bytes"] += entry.stat().st_size - if jobs[prefix]["timestamp"] is None or entry.stat().st_ctime < jobs[prefix]["timestamp"]: - jobs[prefix]["timestamp"] = entry.stat().st_ctime + if jobs[prefix]["timestamp"] is None or entry.stat().st_mtime < jobs[prefix]["timestamp"]: + jobs[prefix]["timestamp"] = entry.stat().st_mtime with _job_lock: global current_render_job @@ -140,7 +140,7 @@ def get_unrendered_timelapses(): def delete_unrendered_timelapse(name): global _cleanup_lock - + pattern = "{}*.jpg".format(util.glob_escape(name)) basedir = settings().getBaseFolder("timelapse_tmp") @@ -290,7 +290,7 @@ def configure_timelapse(config=None, persist=False): ffmpeg_path = settings().get(["webcam", "ffmpeg"]) timelapse_precondition = snapshot_url is not None and snapshot_url.strip() != "" \ and ffmpeg_path is not None and ffmpeg_path.strip() != "" - + type = config["type"] if not timelapse_precondition and type is not None and type != "off": logging.getLogger(__name__).warn("Essential timelapse settings unconfigured (snapshot URL or FFMPEG path) " @@ -298,7 +298,7 @@ def configure_timelapse(config=None, persist=False): "in the config as well.") type = "off" config["type"] = "off" - + if not persist: # make sure we persist at least that timelapse is now disabled by default - we don't want the above # warning to log @@ -312,31 +312,31 @@ def configure_timelapse(config=None, persist=False): postRoll = 0 if "postRoll" in config and config["postRoll"] >= 0: postRoll = config["postRoll"] - + fps = 25 if "fps" in config and config["fps"] > 0: fps = config["fps"] - + if "zchange" == type: retractionZHop = 0 if "options" in config and "retractionZHop" in config["options"] and config["options"]["retractionZHop"] >= 0: retractionZHop = config["options"]["retractionZHop"] - + minDelay = 5 if "options" in config and "minDelay" in config["options"] and config["options"]["minDelay"] > 0: minDelay = config["options"]["minDelay"] - + current = ZTimelapse(post_roll=postRoll, retraction_zhop=retractionZHop, min_delay=minDelay, fps=fps) - + elif "timed" == type: interval = 10 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) notify_callbacks(current) @@ -630,10 +630,10 @@ class Timelapse(object): class ZTimelapse(Timelapse): def __init__(self, retraction_zhop=0, min_delay=5.0, post_roll=0, fps=25): Timelapse.__init__(self, post_roll=post_roll, fps=fps) - + if min_delay < 0: min_delay = 0 - + self._retraction_zhop = retraction_zhop self._min_delay = min_delay self._last_snapshot = None @@ -642,7 +642,7 @@ class ZTimelapse(Timelapse): @property def retraction_zhop(self): return self._retraction_zhop - + @property def min_delay(self): return self._min_delay