diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:22:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:31:40 +0200 |
commit | f4001cf408a99049d01a356bfb20a62342de06ea (patch) | |
tree | 421776dfe64335dca2725ac3ac5f3b3e6b7564c6 /client/src/app/videos/+video-edit/shared/video-edit.component.ts | |
parent | 16f7022b06fb76c0b00c23c970bc8df605b0ec63 (diff) | |
download | PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.gz PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.zst PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.zip |
Handle .srt subtitles
Diffstat (limited to 'client/src/app/videos/+video-edit/shared/video-edit.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/shared/video-edit.component.ts | 18 |
1 files changed, 14 insertions, 4 deletions
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 | ) |