aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-16 14:22:16 +0200
committerChocobozzz <me@florianbigard.com>2018-07-16 14:31:40 +0200
commitf4001cf408a99049d01a356bfb20a62342de06ea (patch)
tree421776dfe64335dca2725ac3ac5f3b3e6b7564c6 /client/src/app
parent16f7022b06fb76c0b00c23c970bc8df605b0ec63 (diff)
downloadPeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.gz
PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.zst
PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.zip
Handle .srt subtitles
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts13
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.html4
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts18
3 files changed, 27 insertions, 8 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
index 45b8c71f8..5498dac22 100644
--- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -49,10 +49,14 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
49 } 49 }
50 50
51 show () { 51 show () {
52 this.closingModal = false
53
52 this.modal.show() 54 this.modal.show()
53 } 55 }
54 56
55 hide () { 57 hide () {
58 this.closingModal = true
59
56 this.modal.hide() 60 this.modal.hide()
57 } 61 }
58 62
@@ -65,7 +69,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
65 } 69 }
66 70
67 async addCaption () { 71 async addCaption () {
68 this.closingModal = true 72 this.hide()
69 73
70 const languageId = this.form.value[ 'language' ] 74 const languageId = this.form.value[ 'language' ]
71 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId) 75 const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
@@ -74,7 +78,12 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
74 language: languageObject, 78 language: languageObject,
75 captionfile: this.form.value['captionfile'] 79 captionfile: this.form.value['captionfile']
76 }) 80 })
81 //
82 // this.form.patchValue({
83 // language: null,
84 // captionfile: null
85 // })
77 86
78 this.hide() 87 this.form.reset()
79 } 88 }
80} 89}
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 14d5f3614..4675cb827 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
@@ -151,7 +151,7 @@
151 151
152 <div class="form-group" *ngFor="let videoCaption of videoCaptions"> 152 <div class="form-group" *ngFor="let videoCaption of videoCaptions">
153 153
154 <div class="caption-entry"> 154 <div *ngIf="videoCaption.action !== 'REMOVE'" class="caption-entry">
155 <div class="caption-entry-label">{{ videoCaption.language.label }}</div> 155 <div class="caption-entry-label">{{ videoCaption.language.label }}</div>
156 156
157 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span> 157 <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span>
@@ -200,5 +200,5 @@
200</div> 200</div>
201 201
202<my-video-caption-add-modal 202<my-video-caption-add-modal
203 #videoCaptionAddModal [existingCaptions]="getExistingCaptions()" (captionAdded)="onCaptionAdded($event)" 203 #videoCaptionAddModal [existingCaptions]="existingCaptions" (captionAdded)="onCaptionAdded($event)"
204></my-video-caption-add-modal> \ No newline at end of file 204></my-video-caption-add-modal> \ No newline at end of file
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 9394d7dab..c7beccb30 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
@@ -68,6 +68,12 @@ export class VideoEditComponent implements OnInit, OnDestroy {
68 this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() 68 this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat()
69 } 69 }
70 70
71 get existingCaptions () {
72 return this.videoCaptions
73 .filter(c => c.action !== 'REMOVE')
74 .map(c => c.language.id)
75 }
76
71 updateForm () { 77 updateForm () {
72 const defaultValues = { 78 const defaultValues = {
73 nsfw: 'false', 79 nsfw: 'false',
@@ -126,11 +132,15 @@ export class VideoEditComponent implements OnInit, OnDestroy {
126 if (this.schedulerInterval) clearInterval(this.schedulerInterval) 132 if (this.schedulerInterval) clearInterval(this.schedulerInterval)
127 } 133 }
128 134
129 getExistingCaptions () {
130 return this.videoCaptions.map(c => c.language.id)
131 }
132
133 onCaptionAdded (caption: VideoCaptionEdit) { 135 onCaptionAdded (caption: VideoCaptionEdit) {
136 const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id)
137
138 // Replace existing caption?
139 if (existingCaption) {
140 Object.assign(existingCaption, caption, { action: 'CREATE' as 'CREATE' })
141 return
142 }
143
134 this.videoCaptions.push( 144 this.videoCaptions.push(
135 Object.assign(caption, { action: 'CREATE' as 'CREATE' }) 145 Object.assign(caption, { action: 'CREATE' as 'CREATE' })
136 ) 146 )