ActivityPub-federated video streaming platform using P2P directly in your web browser
Add "auto-generated" caption info
Chocobozzz5d62c3c1cbec
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.htmlindex 57dcd2b2e7..33a6c041a8 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 @@<ai18n-title title="See the subtitle file" class="caption-entry-label" target="_blank" rel="noopener noreferrer"[href]="videoCaption.captionPath"- >{{ videoCaption.language.label }}</a>+ >{{ getCaptionLabel(videoCaption) }}</a><div i18n class="caption-entry-state">Already uploaded on {{ videoCaption.updatedAt | date }} ✔</div>@@ -193,7 +193,7 @@</ng-container><ng-container *ngIf="videoCaption.action === 'CREATE'">- <span class="caption-entry-label">{{ videoCaption.language.label }}</span>+ <span class="caption-entry-label">{{ getCaptionLabel(videoCaption) }}</span><div i18n class="caption-entry-state caption-entry-state-create">Will be created on update</div>@@ -201,7 +201,7 @@</ng-container><ng-container *ngIf="videoCaption.action === 'UPDATE'">- <span class="caption-entry-label">{{ videoCaption.language.label }}</span>+ <span class="caption-entry-label">{{ getCaptionLabel(videoCaption) }}</span><div i18n class="caption-entry-state caption-entry-state-create">Will be edited on update</div>@@ -209,7 +209,7 @@</ng-container><ng-container *ngIf="videoCaption.action === 'REMOVE'">- <span class="caption-entry-label">{{ videoCaption.language.label }}</span>+ <span class="caption-entry-label">{{ getCaptionLabel(videoCaption) }}</span><div i18n class="caption-entry-state caption-entry-state-delete">Will be deleted on update</div>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.tsindex 5469b7fa86..711111a6b8 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.tsindex 0bc0ac728f..40547bc15b 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.tsindex 8d578cae62..08a9587d7f 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?: anyupdatedAt?: stringdiff --git a/client/src/app/shared/shared-video-miniature/video-download.component.html b/client/src/app/shared/shared-video-miniature/video-download.component.htmlindex ced76fbe86..618d221788 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 @@<div ngbNav #subtitleNav="ngbNav" class="nav-tabs" [activeId]="subtitleLanguageId" (activeIdChange)="onSubtitleIdChange($event)"><ng-container *ngFor="let caption of getCaptions()" [ngbNavItem]="caption.language.id">- <a ngbNavLink i18n>{{ caption.language.label }}</a>+ <a ngbNavLink>+ {{ caption.language.label }}++ <ng-container *ngIf="caption.automaticallyGenerated" i18n>(auto-generated)</ng-container>+ </a><ng-template ngbNavContent><div class="nav-content">@@ -53,8 +57,8 @@</ng-template><ng-container *ngIf="originalVideoFile" ngbNavItem="original">- <a ngbNavLink i18n>- <ng-container>Original file</ng-container>+ <a ngbNavLink>+ <ng-container i18n>Original file</ng-container><my-global-icon ngbTooltip="Other users cannot download the original file" iconName="shield"></my-global-icon></a>diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.tsindex 85174a6522..30ee039701 100644--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts@@ -506,7 +506,11 @@ class PeerTubePlugin extends Plugin {for (const caption of this.options.videoCaptions()) {this.player.addRemoteTextTrack({kind: 'captions',- label: caption.label,++ label: caption.automaticallyGenerated+ ? this.player.localize('{1} (auto-generated)', [ caption.label ])+ : caption.label,+language: caption.language,id: caption.language,src: caption.src,diff --git a/client/src/assets/player/types/peertube-videojs-typings.ts b/client/src/assets/player/types/peertube-videojs-typings.tsindex 72b3f23242..cf34e7abaa 100644--- a/client/src/assets/player/types/peertube-videojs-typings.ts+++ b/client/src/assets/player/types/peertube-videojs-typings.ts@@ -98,6 +98,7 @@ type VideoJSCaption = {label: stringlanguage: stringsrc: string+ automaticallyGenerated: boolean}type VideoJSStoryboard = {diff --git a/client/src/standalone/videos/shared/player-options-builder.ts b/client/src/standalone/videos/shared/player-options-builder.tsindex ef493eae8c..a7672beb00 100644--- a/client/src/standalone/videos/shared/player-options-builder.ts+++ b/client/src/standalone/videos/shared/player-options-builder.ts@@ -425,6 +425,7 @@ export class PlayerOptionsBuilder {return data.map((c: VideoCaption) => ({label: peertubeTranslate(c.language.label, translations),language: c.language.id,+ automaticallyGenerated: c.automaticallyGenerated,src: window.location.origin + c.captionPath}))}diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.tsindex 7655cac8a5..4def10a8e4 100755--- a/scripts/i18n/create-custom-files.ts+++ b/scripts/i18n/create-custom-files.ts@@ -81,6 +81,7 @@ const playerKeys = {'{1} (from edge: {2})': '{1} (from edge: {2})','Disable subtitles': 'Disable subtitles','Enable {1} subtitle': 'Enable {1} subtitle',+ '{1} (auto-generated)': '{1} (auto-generated)','Go back': 'Go back'}Object.assign(playerKeys, videojs)