Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Display appropriate message on bad req

Chocobozzzad9eb48bab89
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index 9f3032443e..896f3e0e12 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -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.`)
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index c287b921bf..1920bc46d2 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -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
})
})
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 342331be3c..bed2538b6b 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -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)