From bf76b30670f656d177f152f1ba1c6c7056fab30d Mon Sep 17 00:00:00 2001 From: Aina Sitraka <35221835+aynsix@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:35:00 +0300 Subject: [PATCH] PHRAS-3934 fix videotools subtitle timeline (#4398) * fix videotools subtitle timeline digit issue * fix videotools when text of subtitle clip is empty * bump front version --- Phraseanet-production-client/config/config.js | 2 +- Phraseanet-production-client/dist/authenticate.js | 2 +- .../dist/authenticate.min.js | 2 +- Phraseanet-production-client/dist/commons.js | 2 +- Phraseanet-production-client/dist/commons.min.js | 2 +- Phraseanet-production-client/dist/production.js | 11 ++++++----- Phraseanet-production-client/dist/production.min.js | 11 ++++++----- .../record/videoEditor/videoSubtitleCapture.js | 13 +++++++------ lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php | 2 +- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/Phraseanet-production-client/config/config.js b/Phraseanet-production-client/config/config.js index 4d14f1e9e7..c3d24a407b 100644 --- a/Phraseanet-production-client/config/config.js +++ b/Phraseanet-production-client/config/config.js @@ -13,5 +13,5 @@ module.exports = { setupDir: _root + 'tests/setup/node.js', karmaConf: _root + 'config/karma.conf.js', // change this version when you change JS file for lazy loading - assetFileVersion: 96 + assetFileVersion: 97 }; diff --git a/Phraseanet-production-client/dist/authenticate.js b/Phraseanet-production-client/dist/authenticate.js index d0cca781fb..d084afdad9 100644 --- a/Phraseanet-production-client/dist/authenticate.js +++ b/Phraseanet-production-client/dist/authenticate.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=96"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=97"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/authenticate.min.js b/Phraseanet-production-client/dist/authenticate.min.js index 52711bcba4..7c597982c8 100644 --- a/Phraseanet-production-client/dist/authenticate.min.js +++ b/Phraseanet-production-client/dist/authenticate.min.js @@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=96"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=97"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.js b/Phraseanet-production-client/dist/commons.js index 4cc1a64f11..d55e728c02 100644 --- a/Phraseanet-production-client/dist/commons.js +++ b/Phraseanet-production-client/dist/commons.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=96"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".js?v=97"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/commons.min.js b/Phraseanet-production-client/dist/commons.min.js index 75d2c8e4f3..6f271a5ec8 100644 --- a/Phraseanet-production-client/dist/commons.min.js +++ b/Phraseanet-production-client/dist/commons.min.js @@ -91,7 +91,7 @@ /******/ if (__webpack_require__.nc) { /******/ script.setAttribute("nonce", __webpack_require__.nc); /******/ } -/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=96"; +/******/ script.src = __webpack_require__.p + "lazy-" + ({}[chunkId]||chunkId) + ".min.js?v=97"; /******/ var timeout = setTimeout(onScriptComplete, 120000); /******/ script.onerror = script.onload = onScriptComplete; /******/ function onScriptComplete() { diff --git a/Phraseanet-production-client/dist/production.js b/Phraseanet-production-client/dist/production.js index f1d762def3..f4f94a4b83 100644 --- a/Phraseanet-production-client/dist/production.js +++ b/Phraseanet-production-client/dist/production.js @@ -64615,7 +64615,7 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; // if(isNaN(hours) && isNaN(minutes) && isNaN(seconds) && isNaN(milliseconds) ) { - return hours + ":" + minutes + ":" + seconds + "." + milliseconds; + return hours + ":" + minutes + ":" + seconds + "." + ('000' + milliseconds).slice(-3); //} } @@ -64652,11 +64652,14 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { var captionText = "WEBVTT - with cue identifier\n\n"; while (i <= countSubtitle * 3) { j = j + 1; - captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + // save only wich with value not empty + if (allData[i + 2].value.length != 0) { + captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + } + i = i + 3; if (i == countSubtitle * 3 - 3) { (0, _jquery2.default)('#record-vtt').val(captionText); - console.log(captionText); if (btn == 'save') { //send data _jquery2.default.ajax({ @@ -64761,7 +64764,6 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { ResValue = fieldvalue.split("WEBVTT - with cue identifier\n\n"); captionValue = ResValue[1].split("\n\n"); captionLength = captionValue.length; - console.log(captionValue); for (var i = 0; i <= captionLength - 1; i++) { // Regex blank line @@ -64863,7 +64865,6 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { try { var requestData = (0, _jquery2.default)('#video-subtitle-request').serializeArray(); requestData = JSON.parse(JSON.stringify(requestData)); - console.log(requestData); } catch (err) { return; } diff --git a/Phraseanet-production-client/dist/production.min.js b/Phraseanet-production-client/dist/production.min.js index f1d762def3..f4f94a4b83 100644 --- a/Phraseanet-production-client/dist/production.min.js +++ b/Phraseanet-production-client/dist/production.min.js @@ -64615,7 +64615,7 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; // if(isNaN(hours) && isNaN(minutes) && isNaN(seconds) && isNaN(milliseconds) ) { - return hours + ":" + minutes + ":" + seconds + "." + milliseconds; + return hours + ":" + minutes + ":" + seconds + "." + ('000' + milliseconds).slice(-3); //} } @@ -64652,11 +64652,14 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { var captionText = "WEBVTT - with cue identifier\n\n"; while (i <= countSubtitle * 3) { j = j + 1; - captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + // save only wich with value not empty + if (allData[i + 2].value.length != 0) { + captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + } + i = i + 3; if (i == countSubtitle * 3 - 3) { (0, _jquery2.default)('#record-vtt').val(captionText); - console.log(captionText); if (btn == 'save') { //send data _jquery2.default.ajax({ @@ -64761,7 +64764,6 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { ResValue = fieldvalue.split("WEBVTT - with cue identifier\n\n"); captionValue = ResValue[1].split("\n\n"); captionLength = captionValue.length; - console.log(captionValue); for (var i = 0; i <= captionLength - 1; i++) { // Regex blank line @@ -64863,7 +64865,6 @@ var videoSubtitleCapture = function videoSubtitleCapture(services, datas) { try { var requestData = (0, _jquery2.default)('#video-subtitle-request').serializeArray(); requestData = JSON.parse(JSON.stringify(requestData)); - console.log(requestData); } catch (err) { return; } diff --git a/Phraseanet-production-client/src/components/record/videoEditor/videoSubtitleCapture.js b/Phraseanet-production-client/src/components/record/videoEditor/videoSubtitleCapture.js index 1e5c1d0a00..28d0b25364 100644 --- a/Phraseanet-production-client/src/components/record/videoEditor/videoSubtitleCapture.js +++ b/Phraseanet-production-client/src/components/record/videoEditor/videoSubtitleCapture.js @@ -134,7 +134,7 @@ const videoSubtitleCapture = (services, datas, activeTab = false) => { minutes = (minutes < 10) ? "0" + minutes : minutes; seconds = (seconds < 10) ? "0" + seconds : seconds; // if(isNaN(hours) && isNaN(minutes) && isNaN(seconds) && isNaN(milliseconds) ) { - return hours + ":" + minutes + ":" + seconds + "." + milliseconds; + return hours + ":" + minutes + ":" + seconds + "." + ('000' + milliseconds).slice(-3); //} } @@ -172,11 +172,14 @@ const videoSubtitleCapture = (services, datas, activeTab = false) => { var captionText = "WEBVTT - with cue identifier\n\n"; while (i <= countSubtitle * 3) { j= j +1; - captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + // save only wich with value not empty + if (allData[i + 2].value.length != 0) { + captionText += j + "\n" + allData[i].value + " --> " + allData[i + 1].value + "\n" + allData[i + 2].value + "\n\n"; + } + i = i + 3; if (i == (countSubtitle * 3) - 3) { $('#record-vtt').val(captionText); - console.log(captionText); if (btn == 'save') { //send data $.ajax({ @@ -286,7 +289,6 @@ const videoSubtitleCapture = (services, datas, activeTab = false) => { ResValue = fieldvalue.split("WEBVTT - with cue identifier\n\n"); captionValue = ResValue[1].split("\n\n"); captionLength = captionValue.length; - console.log(captionValue); for (var i = 0; i <= captionLength - 1; i++) { // Regex blank line @@ -317,7 +319,7 @@ const videoSubtitleCapture = (services, datas, activeTab = false) => { startVal = stringToseconde(timeValue[0]); //Re-Build EndTime - timeValue = timeValue [1].split("\n") + timeValue = timeValue[1].split("\n") $('.item_' + i + ' .video-subtitle-item ').closest('.editing').find('.end-label').text(timeValue[0]); $('.item_' + i + ' .video-subtitle-item ').find('.endTime').val(timeValue[0]); endVal = stringToseconde(timeValue[0]); @@ -393,7 +395,6 @@ const videoSubtitleCapture = (services, datas, activeTab = false) => { try { var requestData = $('#video-subtitle-request').serializeArray(); requestData = JSON.parse(JSON.stringify(requestData)); - console.log(requestData) } catch (err) { return; diff --git a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php index a2a2391d84..1f84f0c4ec 100644 --- a/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php +++ b/lib/Alchemy/Phrasea/Twig/PhraseanetExtension.php @@ -62,7 +62,7 @@ public function getGlobals() { return [ // change this version when you change JS file to force the navigation to reload js file - 'assetFileVersion' => 96 + 'assetFileVersion' => 97 ]; }