From 210ae6f92ac85d9c2139c45535f082fd7f0f2c43 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Thu, 18 Nov 2021 02:45:15 -0600 Subject: [PATCH] Support linking to specific times in restreamer --- thrimbletrimmer/index.html | 3 +++ thrimbletrimmer/scripts/stream.js | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/thrimbletrimmer/index.html b/thrimbletrimmer/index.html index 47b7592..92f65a0 100644 --- a/thrimbletrimmer/index.html +++ b/thrimbletrimmer/index.html @@ -56,6 +56,9 @@
+
+ Link to this time range +
diff --git a/thrimbletrimmer/scripts/stream.js b/thrimbletrimmer/scripts/stream.js index 70a4b46..afac4b6 100644 --- a/thrimbletrimmer/scripts/stream.js +++ b/thrimbletrimmer/scripts/stream.js @@ -7,6 +7,16 @@ var globalVideoTimeReference = TIME_FRAME_AGO; window.addEventListener("DOMContentLoaded", async (event) => { commonPageSetup(); + + const queryParams = new URLSearchParams(window.location.search); + if (queryParams.has("start")) { + document.getElementById("stream-time-frame-of-reference-utc").checked = true; + document.getElementById("stream-time-setting-start").value = queryParams.get("start"); + if (queryParams.has("end")) { + document.getElementById("stream-time-setting-end").value = queryParams.get("end"); + } + } + await loadDefaults(); const timeSettingsForm = document.getElementById("stream-time-settings"); @@ -90,6 +100,15 @@ function updateTimeSettings() { } updateDownloadLink(); + + const startTime = getStartTime(); + const endTime = getEndTime(); + const queryParts = []; + queryParts.push(`start=${wubloaderTimeFromDateTime(startTime)}`); + if (endTime) { + queryParts.push(`end=${wubloaderTimeFromDateTime(endTime)}`); + } + document.getElementById("stream-time-link").href = `?${queryParts.join("&")}`; } function generateDownloadURL(startTime, endTime, downloadType, allowHoles, quality) {