From d2e34fedef4f2211ae315a879cd09ed361e35599 Mon Sep 17 00:00:00 2001 From: Pavol Beskid Date: Sun, 15 Oct 2023 18:37:48 +0200 Subject: [PATCH 1/3] SubtitleEditor: download button for subtitle; updated some locales for button title and tooltip --- src/i18n/locales/cs-CZ.json | 6 +++++ src/i18n/locales/de-DE.json | 10 ++++---- src/i18n/locales/el-GR.json | 6 +++++ src/i18n/locales/en-US.json | 2 ++ src/i18n/locales/es-ES.json | 6 +++++ src/i18n/locales/fr-FR.json | 6 +++++ src/i18n/locales/nl-NL.json | 6 +++++ src/i18n/locales/zh-CN.json | 6 +++++ src/i18n/locales/zh-TW.json | 6 +++++ src/main/SubtitleEditor.tsx | 47 ++++++++++++++++++++++++++++++++++--- 10 files changed, 94 insertions(+), 7 deletions(-) diff --git a/src/i18n/locales/cs-CZ.json b/src/i18n/locales/cs-CZ.json index 650c68e89..d7fe518b8 100644 --- a/src/i18n/locales/cs-CZ.json +++ b/src/i18n/locales/cs-CZ.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Video duration", "duration-aria": "Duration", "time-aria": "Current time", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "A problem occurred during communication with Opencast.", "loadError-text": "An error has occurred loading this video.", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/i18n/locales/de-DE.json b/src/i18n/locales/de-DE.json index 4f8d3a6e6..84b72029e 100644 --- a/src/i18n/locales/de-DE.json +++ b/src/i18n/locales/de-DE.json @@ -37,10 +37,10 @@ "time-duration-tooltip": "Videodauer", "duration-aria": "Dauer", "time-aria": "Aktuelle Zeit", - "mutebutton-tooltip": "Video stummschalten", - "unmutebutton-tooltip": "Stummschaltung aufheben", - "volume-tooltip": "Lautstärke: {{current}}%", - "volumeSlider-aria": "Anpassen der Videolautstärke.", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "Bei der Kommunikation mit Opencast ist ein Problem aufgetreten.", "loadError-text": "Beim Laden des Videos ist ein Fehler aufgetreten.", "durationError-text": "Opencast konnte die Video-Dauer nicht angeben.", @@ -232,6 +232,8 @@ "createSubtitleDropdown-label": "Wähle eine Sprache", "backButton": "Zurück", "backButton-tooltip": "Zurück zur Untertitelauswahl", + "downloadButton-title": "Herunterladen", + "downloadButton-tooltip": "Untertitel als VTT-Datei herunterladen", "editTitle": "Untertitel-Editor - {{title}}", "editTitle-loading": "Lädt", "generic": "Unspezifiziert", diff --git a/src/i18n/locales/el-GR.json b/src/i18n/locales/el-GR.json index 4f82b4521..473026734 100644 --- a/src/i18n/locales/el-GR.json +++ b/src/i18n/locales/el-GR.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Διάρκεια βίντεο", "duration-aria": "Διάρκεια", "time-aria": "Τρέχουσα ώρα", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "Προέκυψε πρόβλημα κατά την επικοινωνία με το Opencast.", "loadError-text": "Παρουσιάστηκε σφάλμα κατά τηn φόρτωση του βίντεο.", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Επιλέξτε μια γλώσσα", "backButton": "Επιστροφή", "backButton-tooltip": "Επιστροφή στην επιλογή υποτίτλων", + "downloadButton-title": "Κατεβάστε", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Επεξεργαστής υποτίτλων - {{title}}", "editTitle-loading": "Φόρτωση", "generic": "Γενικά", diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 3e97194fa..b77a3d038 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -249,6 +249,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/i18n/locales/es-ES.json b/src/i18n/locales/es-ES.json index 861087f15..ff7eceb65 100644 --- a/src/i18n/locales/es-ES.json +++ b/src/i18n/locales/es-ES.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Duración del vídeo", "duration-aria": "Duración", "time-aria": "Tiempo actual", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "Se ha producido un error al establecer comunicación con Opencast.", "loadError-text": "Ocurrió un error al cargar el video.", "durationError-text": "Opencast falló al proporcionar la duracion del vídeo.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Seleccione un idioma", "backButton": "Atras", "backButton-tooltip": "Volver a la selección de subtítulos", + "downloadButton-title": "Descargar", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Editor de subtítulos - {{title}}", "editTitle-loading": "Cargando", "generic": "Generico", diff --git a/src/i18n/locales/fr-FR.json b/src/i18n/locales/fr-FR.json index 2ad8199c7..fbb34ed35 100644 --- a/src/i18n/locales/fr-FR.json +++ b/src/i18n/locales/fr-FR.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Video duration", "duration-aria": "Durée", "time-aria": "Temps actuel", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "Un problème est survenu lors de la communication avec Opencast.", "loadError-text": "Une erreur s'est produite lors du chargement de cette vidéo.", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/i18n/locales/nl-NL.json b/src/i18n/locales/nl-NL.json index d8c442d61..fe2d17eb1 100644 --- a/src/i18n/locales/nl-NL.json +++ b/src/i18n/locales/nl-NL.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Video duration", "duration-aria": "Duur", "time-aria": "Actuele tijd", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "Er is een probleem opgetreden tijdens de communicatie met Opencast.", "loadError-text": "Er is een fout opgetreden tijdens het laden van deze video.", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 084532152..f8e63508b 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Video duration", "duration-aria": "Duration", "time-aria": "Current time", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "A problem occurred during communication with Opencast.", "loadError-text": "An error has occurred loading this video.", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index 807779ab7..54076927c 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -37,6 +37,10 @@ "time-duration-tooltip": "Video duration", "duration-aria": "持續時間", "time-aria": "目前時間", + "mutebutton-tooltip": "Mute video", + "unmutebutton-tooltip": "Unmute video", + "volume-tooltip": "Adjust volume: {{current}}%", + "volumeSlider-aria": "Adjust the volume level of the video.", "comError-text": "與 Opencast 通訊時出現問題。", "loadError-text": "載入此影片時出現錯誤。", "durationError-text": "Opencast failed to provide the video duration.", @@ -228,6 +232,8 @@ "createSubtitleDropdown-label": "Pick a language", "backButton": "Back", "backButton-tooltip": "Return to subtitle selection", + "downloadButton-title": "Download", + "downloadButton-tooltip": "Download subtitle as vtt file", "editTitle": "Subtitle Editor - {{title}}", "editTitle-loading": "Loading", "generic": "Generic", diff --git a/src/main/SubtitleEditor.tsx b/src/main/SubtitleEditor.tsx index c064e313b..8f5f08b74 100644 --- a/src/main/SubtitleEditor.tsx +++ b/src/main/SubtitleEditor.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { css } from "@emotion/react"; import { basicButtonStyle, flexGapReplacementStyle } from "../cssStyles"; -import { LuChevronLeft} from "react-icons/lu"; +import { LuChevronLeft, LuDownload} from "react-icons/lu"; import { selectSubtitlesFromOpencastById, } from '../redux/videoSlice' @@ -17,7 +17,7 @@ import SubtitleVideoArea from "./SubtitleVideoArea"; import SubtitleTimeline from "./SubtitleTimeline"; import { useTranslation } from "react-i18next"; import { useTheme } from "../themes"; -import { parseSubtitle } from "../util/utilityFunctions"; +import { parseSubtitle, serializeSubtitle } from "../util/utilityFunctions"; import { ThemedTooltip } from "./Tooltip"; import { titleStyle, titleStyleBold } from "../cssStyles"; import { generateButtonTitle } from "./SubtitleSelect"; @@ -109,7 +109,7 @@ const SubtitleEditor : React.FC = () => {
{t("subtitles.editTitle", {title: getTitle()})}
-
+
@@ -128,6 +128,47 @@ const SubtitleEditor : React.FC = () => { ); } +const DownloadButton: React.FC = () => { + + const subtitle = useSelector(selectSelectedSubtitleById); + + const downloadSubtitles = () => { + + const vttFile = new Blob([serializeSubtitle(subtitle.cues)], {type: 'text/vtt'}); + + const vttFileLink = window.URL.createObjectURL(vttFile); + const vttHyperLink = document.createElement('a'); + vttHyperLink.setAttribute('href', vttFileLink); + + const vttFileName = generateButtonTitle(subtitle.tags, t).trimEnd(); + vttHyperLink.setAttribute('download', `${vttFileName}.vtt`); + vttHyperLink.click(); + } + + const { t } = useTranslation(); + const theme = useTheme(); + const style = css({ + fontSize: '16px', + height: '10px', + padding: '16px', + justifyContent: 'space-around', + boxShadow: `${theme.boxShadow}`, + background: `${theme.element_bg}`, + }); + + return ( + +
downloadSubtitles()} + > + + {t("subtitles.downloadButton-title")} +
+
+ ); +} + /** * Takes you to a different page From 723ece8f2b3e713d16e73cc4c06bd01b906ed713 Mon Sep 17 00:00:00 2001 From: Arnei Date: Fri, 20 Oct 2023 13:41:05 +0200 Subject: [PATCH 2/3] Fix subtitles not being saved to Opencast Fixes #1161. Turns out the post request for starting processing in Opencast simply did not include the (changes to) subtitles. Now it does. --- src/redux/workflowPostAndProcessSlice.ts | 7 ++++++- src/redux/workflowPostSlice.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/redux/workflowPostAndProcessSlice.ts b/src/redux/workflowPostAndProcessSlice.ts index 68524b09b..1149096c6 100644 --- a/src/redux/workflowPostAndProcessSlice.ts +++ b/src/redux/workflowPostAndProcessSlice.ts @@ -17,7 +17,12 @@ export const postVideoInformationWithWorkflow = createAsyncThunk('video/postVide } const response = await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`, - { segments: convertSegments(argument.segments), tracks: argument.tracks, workflows: argument.workflow } + { + segments: convertSegments(argument.segments), + tracks: argument.tracks, + subtitles: argument.subtitles, + workflows: argument.workflow + } ) return response }) diff --git a/src/redux/workflowPostSlice.ts b/src/redux/workflowPostSlice.ts index 70c86f5b4..9dea8ba04 100644 --- a/src/redux/workflowPostSlice.ts +++ b/src/redux/workflowPostSlice.ts @@ -15,7 +15,11 @@ export const postVideoInformation = createAsyncThunk('video/postVideoInformation } const response = await client.post(`${settings.opencast.url}/editor/${settings.id}/edit.json`, - { segments: convertSegments(argument.segments), tracks: argument.tracks, subtitles: argument.subtitles } + { + segments: convertSegments(argument.segments), + tracks: argument.tracks, + subtitles: argument.subtitles + } ) return response }) From 6b1ee555445251a90bb5459d2734681fd8c8ebb8 Mon Sep 17 00:00:00 2001 From: Mahesh Chandra <148360659+maheshchandra10@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:11:26 +0000 Subject: [PATCH 3/3] fix(button): incorrect color of btn icons on hover --- src/cssStyles.tsx | 5 ++--- src/main/CuttingActions.tsx | 2 +- src/main/TrackSelection.tsx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cssStyles.tsx b/src/cssStyles.tsx index e0c0e0782..427b301f4 100644 --- a/src/cssStyles.tsx +++ b/src/cssStyles.tsx @@ -436,10 +436,9 @@ export const spinningStyle = css({ })}`, }) -export const customIconStyle = (theme: Theme) => css(({ +export const customIconStyle = css(({ maxWidth: '16px', - height: 'auto', - color: theme.text, + height: 'auto' })) export const videosStyle = (theme: Theme) => css(({ diff --git a/src/main/CuttingActions.tsx b/src/main/CuttingActions.tsx index 2a6f92ad8..101d1475e 100644 --- a/src/main/CuttingActions.tsx +++ b/src/main/CuttingActions.tsx @@ -174,7 +174,7 @@ const MarkAsDeletedButton : React.FC = ({actionHand actionHandler(action) } }} > - {isCurrentSegmentAlive ? : } + {isCurrentSegmentAlive ? : }
{isCurrentSegmentAlive ? t('cuttingActions.delete-button') : t("cuttingActions.restore-button")}
diff --git a/src/main/TrackSelection.tsx b/src/main/TrackSelection.tsx index 61d90b144..878c8fa7e 100644 --- a/src/main/TrackSelection.tsx +++ b/src/main/TrackSelection.tsx @@ -188,7 +188,7 @@ const SelectButton : React.FC = ({handler, text, Icon, to aria-label={tooltip} onClick={clickHandler} onKeyDown={keyHandler} > - +
{ text }