aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-28 13:42:48 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-02-28 14:29:01 +0100
commit70a8e50a5d3df90cba615559b5aaba1536356f5a (patch)
tree66289e1d18baf2165e862584539a57c7e89eda41 /client/src/app/+videos
parent57d74ec83d64daaf2efc6a3dad8adbcfe1f59415 (diff)
downloadPeerTube-70a8e50a5d3df90cba615559b5aaba1536356f5a.tar.gz
PeerTube-70a8e50a5d3df90cba615559b5aaba1536356f5a.tar.zst
PeerTube-70a8e50a5d3df90cba615559b5aaba1536356f5a.zip
Cleanup subtitle edition PR
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts19
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts2
3 files changed, 7 insertions, 16 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
index 4543b93d8..be6f676c2 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html
@@ -17,7 +17,7 @@
17 </textarea> 17 </textarea>
18 18
19 <div *ngIf="formErrors.captionFileContent" class="form-error"> 19 <div *ngIf="formErrors.captionFileContent" class="form-error">
20 {{ formErrors.description }} 20 {{ formErrors.captionFileContent }}
21 </div> 21 </div>
22 </div> 22 </div>
23 23
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
index d2232a38e..f74f3c5ea 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts
@@ -1,5 +1,4 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2
3import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators' 2import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 3import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main' 4import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main'
@@ -23,7 +22,6 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
23 22
24 videoCaptionLanguages: VideoConstant<string>[] = [] 23 videoCaptionLanguages: VideoConstant<string>[] = []
25 private openedModal: NgbModalRef 24 private openedModal: NgbModalRef
26 private closingModal = false
27 25
28 constructor ( 26 constructor (
29 protected formValidatorService: FormValidatorService, 27 protected formValidatorService: FormValidatorService,
@@ -44,25 +42,21 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
44 42
45 loadCaptionContent () { 43 loadCaptionContent () {
46 const { captionPath } = this.videoCaption 44 const { captionPath } = this.videoCaption
47 if (captionPath) { 45 if (!captionPath) return
48 this.videoCaptionService.getCaptionContent({ 46
49 captionPath 47 this.videoCaptionService.getCaptionContent({ captionPath })
50 }).subscribe((res) => { 48 .subscribe(res => {
51 this.form.patchValue({ 49 this.form.patchValue({
52 captionFileContent: res 50 captionFileContent: res
53 }) 51 })
54 }) 52 })
55 }
56 } 53 }
57 54
58 show () { 55 show () {
59 this.closingModal = false
60
61 this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false }) 56 this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false })
62 } 57 }
63 58
64 hide () { 59 hide () {
65 this.closingModal = true
66 this.openedModal.close() 60 this.openedModal.close()
67 } 61 }
68 62
@@ -70,14 +64,11 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
70 this.hide() 64 this.hide()
71 } 65 }
72 66
73 isReplacingExistingCaption () {
74 return true
75 }
76
77 updateCaption () { 67 updateCaption () {
78 const format = 'vtt' 68 const format = 'vtt'
79 const languageId = this.videoCaption.language.id 69 const languageId = this.videoCaption.language.id
80 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) 70 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
71
81 this.captionEdited.emit({ 72 this.captionEdited.emit({
82 language: languageObject, 73 language: languageObject,
83 captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, { 74 captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, {
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 0f4d0619b..2801fc519 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
@@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
59 @Input() userVideoChannels: SelectChannelItem[] = [] 59 @Input() userVideoChannels: SelectChannelItem[] = []
60 @Input() forbidScheduledPublication = true 60 @Input() forbidScheduledPublication = true
61 61
62 @Input() videoCaptions: (VideoCaptionWithPathEdit)[] = [] 62 @Input() videoCaptions: VideoCaptionWithPathEdit[] = []
63 63
64 @Input() waitTranscodingEnabled = true 64 @Input() waitTranscodingEnabled = true
65 @Input() type: VideoEditType 65 @Input() type: VideoEditType