mirror of https://github.com/Chocobozzz/PeerTube
Cleanup subtitle edition PR
parent
57d74ec83d
commit
70a8e50a5d
|
@ -17,7 +17,7 @@
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
||||||
<div *ngIf="formErrors.captionFileContent" class="form-error">
|
<div *ngIf="formErrors.captionFileContent" class="form-error">
|
||||||
{{ formErrors.description }}
|
{{ formErrors.captionFileContent }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
|
||||||
|
|
||||||
import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
|
import { VIDEO_CAPTION_FILE_CONTENT_VALIDATOR } from '@app/shared/form-validators/video-captions-validators'
|
||||||
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main'
|
import { VideoCaptionEdit, VideoCaptionService, VideoCaptionWithPathEdit } from '@app/shared/shared-main'
|
||||||
|
@ -23,7 +22,6 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
|
||||||
|
|
||||||
videoCaptionLanguages: VideoConstant<string>[] = []
|
videoCaptionLanguages: VideoConstant<string>[] = []
|
||||||
private openedModal: NgbModalRef
|
private openedModal: NgbModalRef
|
||||||
private closingModal = false
|
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
protected formValidatorService: FormValidatorService,
|
protected formValidatorService: FormValidatorService,
|
||||||
|
@ -44,25 +42,21 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
|
||||||
|
|
||||||
loadCaptionContent () {
|
loadCaptionContent () {
|
||||||
const { captionPath } = this.videoCaption
|
const { captionPath } = this.videoCaption
|
||||||
if (captionPath) {
|
if (!captionPath) return
|
||||||
this.videoCaptionService.getCaptionContent({
|
|
||||||
captionPath
|
this.videoCaptionService.getCaptionContent({ captionPath })
|
||||||
}).subscribe((res) => {
|
.subscribe(res => {
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
captionFileContent: res
|
captionFileContent: res
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
show () {
|
show () {
|
||||||
this.closingModal = false
|
|
||||||
|
|
||||||
this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false })
|
this.openedModal = this.modalService.open(this.modal, { centered: true, keyboard: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
hide () {
|
hide () {
|
||||||
this.closingModal = true
|
|
||||||
this.openedModal.close()
|
this.openedModal.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,14 +64,11 @@ export class VideoCaptionEditModalComponent extends FormReactive implements OnIn
|
||||||
this.hide()
|
this.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
isReplacingExistingCaption () {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCaption () {
|
updateCaption () {
|
||||||
const format = 'vtt'
|
const format = 'vtt'
|
||||||
const languageId = this.videoCaption.language.id
|
const languageId = this.videoCaption.language.id
|
||||||
const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
|
const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
|
||||||
|
|
||||||
this.captionEdited.emit({
|
this.captionEdited.emit({
|
||||||
language: languageObject,
|
language: languageObject,
|
||||||
captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, {
|
captionfile: new File([ this.form.value['captionFileContent'] ], `${languageId}.${format}`, {
|
||||||
|
|
|
@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
||||||
@Input() userVideoChannels: SelectChannelItem[] = []
|
@Input() userVideoChannels: SelectChannelItem[] = []
|
||||||
@Input() forbidScheduledPublication = true
|
@Input() forbidScheduledPublication = true
|
||||||
|
|
||||||
@Input() videoCaptions: (VideoCaptionWithPathEdit)[] = []
|
@Input() videoCaptions: VideoCaptionWithPathEdit[] = []
|
||||||
|
|
||||||
@Input() waitTranscodingEnabled = true
|
@Input() waitTranscodingEnabled = true
|
||||||
@Input() type: VideoEditType
|
@Input() type: VideoEditType
|
||||||
|
|
|
@ -7,8 +7,8 @@ import { objectToFormData, sortBy } from '@app/helpers'
|
||||||
import { VideoService } from '@app/shared/shared-main/video'
|
import { VideoService } from '@app/shared/shared-main/video'
|
||||||
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
import { peertubeTranslate } from '@shared/core-utils/i18n'
|
||||||
import { ResultList, VideoCaption } from '@shared/models'
|
import { ResultList, VideoCaption } from '@shared/models'
|
||||||
import { VideoCaptionEdit } from './video-caption-edit.model'
|
|
||||||
import { environment } from '../../../../environments/environment'
|
import { environment } from '../../../../environments/environment'
|
||||||
|
import { VideoCaptionEdit } from './video-caption-edit.model'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class VideoCaptionService {
|
export class VideoCaptionService {
|
||||||
|
@ -69,6 +69,6 @@ export class VideoCaptionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
getCaptionContent ({ captionPath }: Pick<VideoCaption, 'captionPath'>) {
|
getCaptionContent ({ captionPath }: Pick<VideoCaption, 'captionPath'>) {
|
||||||
return this.authHttp.get(`${environment.originServerUrl}${captionPath}`, { responseType: 'text' })
|
return this.authHttp.get(environment.originServerUrl + captionPath, { responseType: 'text' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue