From c9f2e8e0a5f48670e65aa602149485d79bb8b3ba Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Fri, 8 Nov 2019 21:30:13 -0800 Subject: [PATCH] thrimbletrimmer: Preserve trim timings when re-loading playlist Useful if you've already cut the start but want to extend the range of times before cutting the end. --- thrimbletrimmer/scripts/IO.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/thrimbletrimmer/scripts/IO.js b/thrimbletrimmer/scripts/IO.js index 6f74413..aa42e57 100644 --- a/thrimbletrimmer/scripts/IO.js +++ b/thrimbletrimmer/scripts/IO.js @@ -198,6 +198,17 @@ loadPlaylist = function(isEditor, startTrim, endTrim, defaultQuality) { var range = getTimeRangeAsTimestamp(); var queryString = buildQuery(range); + // Preserve existing edit times + if (player) { + var discontinuities = mapDiscontinuities(); + if (!startTrim) { + startTrim = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.startTrim).replace('Z',''); + } + if (!endTrim) { + endTrim = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.endTrim).replace('Z',''); + } + } + setupPlayer(isEditor, playlist + '?' + queryString, startTrim, endTrim); //Get quality levels for advanced properties / download