mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(octoprint): timelapse uris
This commit is contained in:
parent
254be3c254
commit
093c4b58df
3 changed files with 38 additions and 1 deletions
|
|
@ -115,7 +115,7 @@ in {
|
||||||
timelapse_done = {
|
timelapse_done = {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
# TODO: movie_basename needs uri encoding if it contains spaces .-.
|
# TODO: movie_basename needs uri encoding if it contains spaces .-.
|
||||||
message = "Timelapse for {gcode}: https://print.${domain}/downloads/timelapse/{movie_basename}";
|
message = "Timelapse for {gcode}: [{movie_basename}](https://print.${domain}/downloads/timelapse/{movie_basename_uri})";
|
||||||
media = media.none;
|
media = media.none;
|
||||||
};
|
};
|
||||||
timelapse_failed.media = media.none;
|
timelapse_failed.media = media.none;
|
||||||
|
|
|
||||||
33
packages/octoprint/octorant-timelapse-uri.patch
Normal file
33
packages/octoprint/octorant-timelapse-uri.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
diff --git a/octoprint_octorant/__init__.py b/octoprint_octorant/__init__.py
|
||||||
|
--- a/octoprint_octorant/__init__.py
|
||||||
|
+++ b/octoprint_octorant/__init__.py
|
||||||
|
@@ -4,6 +4,7 @@ from __future__ import absolute_import
|
||||||
|
import octoprint.plugin
|
||||||
|
import octoprint.settings
|
||||||
|
import octoprint.util
|
||||||
|
+import urllib.parse
|
||||||
|
import subprocess
|
||||||
|
import datetime
|
||||||
|
import time
|
||||||
|
@@ -453,6 +454,8 @@ class OctorantPlugin(
|
||||||
|
# Alter a bit the payload to offer more variables
|
||||||
|
if "time" in data:
|
||||||
|
data["time_formatted"] = str(datetime.timedelta(seconds=int(data["time"])))
|
||||||
|
+ if "movie_basename" in data:
|
||||||
|
+ data["movie_basename_uri"] = urllib.parse.quote(data["movie_basename"])
|
||||||
|
|
||||||
|
self._logger.debug(
|
||||||
|
"Available variables for event " + eventID + ": " + ", ".join(list(data))
|
||||||
|
diff --git a/octoprint_octorant/events.py b/octoprint_octorant/events.py
|
||||||
|
index 0c53f88..9e7b19c 100644
|
||||||
|
--- a/octoprint_octorant/events.py
|
||||||
|
+++ b/octoprint_octorant/events.py
|
||||||
|
@@ -135,7 +135,7 @@ EVENTS = {
|
||||||
|
"enabled": False,
|
||||||
|
"media": "timelapse",
|
||||||
|
"message": "🎥 Timelapse has been created: {movie_basename}",
|
||||||
|
- "variables": ["gcode", "movie", "movie_basename", "movie_prefix"],
|
||||||
|
+ "variables": ["gcode", "movie", "movie_basename", "movie_basename_uri", "movie_prefix"],
|
||||||
|
},
|
||||||
|
"timelapse_failed": {
|
||||||
|
"enabled": False,
|
||||||
|
|
@ -14,6 +14,10 @@ in buildPlugin {
|
||||||
sha256 = "sha256-gP79zlJ8gdtpddXOJIMhouSbwXnrSf+c1bURkN/7jvw=";
|
sha256 = "sha256-gP79zlJ8gdtpddXOJIMhouSbwXnrSf+c1bURkN/7jvw=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./octorant-timelapse-uri.patch
|
||||||
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = with python3Packages; [
|
propagatedBuildInputs = with python3Packages; [
|
||||||
pillow
|
pillow
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue