mirror of https://github.com/Chocobozzz/PeerTube
Display appropriate message on bad req
parent
bd87b4271b
commit
ad9eb48bab
|
@ -404,7 +404,7 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
|
|||
}
|
||||
|
||||
private runTranscoding (videos: Video[], type: 'hls' | 'web-video') {
|
||||
this.videoService.runTranscoding({ videos, type, askForForceTranscodingIfNeeded: true })
|
||||
this.videoService.runTranscoding({ videos, type })
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.notifier.success($localize`Transcoding jobs created.`)
|
||||
|
|
|
@ -334,10 +334,9 @@ export class VideoService {
|
|||
runTranscoding (options: {
|
||||
videos: Video[]
|
||||
type: 'hls' | 'web-video'
|
||||
askForForceTranscodingIfNeeded: boolean
|
||||
forceTranscoding?: boolean
|
||||
}): Observable<any> {
|
||||
const { videos, type, askForForceTranscodingIfNeeded, forceTranscoding } = options
|
||||
const { videos, type, forceTranscoding } = options
|
||||
|
||||
const body: VideoTranscodingCreate = { transcodingType: type, forceTranscoding }
|
||||
|
||||
|
@ -347,7 +346,7 @@ export class VideoService {
|
|||
return this.authHttp.post(VideoService.BASE_VIDEO_URL + '/' + video.uuid + '/transcoding', body)
|
||||
.pipe(
|
||||
catchError(err => {
|
||||
if (askForForceTranscodingIfNeeded && err.error?.code === ServerErrorCode.VIDEO_ALREADY_BEING_TRANSCODED) {
|
||||
if (err.error?.code === ServerErrorCode.VIDEO_ALREADY_BEING_TRANSCODED && !forceTranscoding) {
|
||||
const message = $localize`PeerTube considers video "${video.name}" is already being transcoded.` +
|
||||
// eslint-disable-next-line max-len
|
||||
$localize` If you think PeerTube is wrong (video in broken state after a crash etc.), you can force transcoding on this video.` +
|
||||
|
@ -361,7 +360,6 @@ export class VideoService {
|
|||
return this.runTranscoding({
|
||||
videos: [ video ],
|
||||
type,
|
||||
askForForceTranscodingIfNeeded: false,
|
||||
forceTranscoding: true
|
||||
})
|
||||
})
|
||||
|
|
|
@ -342,7 +342,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
}
|
||||
|
||||
runTranscoding (video: Video, type: 'hls' | 'web-video') {
|
||||
this.videoService.runTranscoding({ videos: [ video ], type, askForForceTranscodingIfNeeded: true })
|
||||
this.videoService.runTranscoding({ videos: [ video ], type })
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.notifier.success($localize`Transcoding job created for "${video.name}".`)
|
||||
|
@ -356,8 +356,10 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
|||
generateCaption (video: Video) {
|
||||
this.videoCaptionService.generateCaption([ video.id ])
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.notifier.success($localize`Transcription job created for "${video.name}".`)
|
||||
next: result => {
|
||||
if (result.success) this.notifier.success($localize`Transcription job created for "${video.name}".`)
|
||||
else if (result.alreadyBeingTranscribed) this.notifier.info($localize`This video is already being transcribed.`)
|
||||
else if (result.alreadyHasCaptions) this.notifier.info($localize`This video already has captions.`)
|
||||
},
|
||||
|
||||
error: err => this.notifier.error(err.message)
|
||||
|
|
Loading…
Reference in New Issue