From 5d62c3c1cbec67fb7aab4365fa869339b811d16d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Jul 2024 12:31:34 +0200 Subject: [PATCH] Add "auto-generated" caption info --- .../+video-edit/shared/video-edit.component.html | 8 ++++---- .../+videos/+video-edit/shared/video-edit.component.ts | 8 ++++++++ .../app/+videos/+video-watch/video-watch.component.ts | 1 + .../video-caption/video-caption-edit.model.ts | 2 ++ .../video-download.component.html | 10 +++++++--- .../assets/player/shared/peertube/peertube-plugin.ts | 6 +++++- .../assets/player/types/peertube-videojs-typings.ts | 1 + .../standalone/videos/shared/player-options-builder.ts | 1 + scripts/i18n/create-custom-files.ts | 1 + 9 files changed, 30 insertions(+), 8 deletions(-) diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 57dcd2b2e..33a6c041a 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html @@ -184,7 +184,7 @@ {{ videoCaption.language.label }} + >{{ getCaptionLabel(videoCaption) }}
Already uploaded on {{ videoCaption.updatedAt | date }} ✔
@@ -193,7 +193,7 @@ - +
Will be created on update
@@ -201,7 +201,7 @@
- +
Will be edited on update
@@ -209,7 +209,7 @@
- +
Will be deleted on update
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index 5469b7fa8..711111a6b 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts @@ -348,6 +348,14 @@ export class VideoEditComponent implements OnInit, OnDestroy { // --------------------------------------------------------------------------- + getCaptionLabel (caption: VideoCaptionWithPathEdit) { + if (caption.automaticallyGenerated) { + return $localize`${caption.language.label} (auto-generated)` + } + + return caption.language.label + } + getExistingCaptions () { return this.videoCaptions .filter(c => c.action !== 'REMOVE') diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 0bc0ac728..40547bc15 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -768,6 +768,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { const playerCaptions = videoCaptions.map(c => ({ label: c.language.label, language: c.language.id, + automaticallyGenerated: c.automaticallyGenerated, src: environment.apiUrl + c.captionPath })) diff --git a/client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts b/client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts index 8d578cae6..08a9587d7 100644 --- a/client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts +++ b/client/src/app/shared/shared-main/video-caption/video-caption-edit.model.ts @@ -4,6 +4,8 @@ export interface VideoCaptionEdit { label?: string } + automaticallyGenerated?: boolean + action?: 'CREATE' | 'REMOVE' | 'UPDATE' captionfile?: any updatedAt?: string diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.html b/client/src/app/shared/shared-video-miniature/video-download.component.html index ced76fbe8..618d22178 100644 --- a/client/src/app/shared/shared-video-miniature/video-download.component.html +++ b/client/src/app/shared/shared-video-miniature/video-download.component.html @@ -26,7 +26,11 @@