From ad5db1044c8599eaaaa2a578b350777ae996b068 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Nov 2021 14:35:08 +0100 Subject: Add ability to run transcoding jobs --- client/src/app/shared/shared-main/video/video.model.ts | 12 ++++++++++++ client/src/app/shared/shared-main/video/video.service.ts | 12 ++++++++++++ 2 files changed, 24 insertions(+) (limited to 'client/src/app/shared/shared-main/video') diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 4203ff1c0..eefa90489 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -220,6 +220,18 @@ export class Video implements VideoServerModel { return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) } + canRemoveFiles (user: AuthUser) { + return user.hasRight(UserRight.MANAGE_VIDEO_FILES) && + this.state.id !== VideoState.TO_TRANSCODE && + this.hasHLS() && + this.hasWebTorrent() + } + + canRunTranscoding (user: AuthUser) { + return user.hasRight(UserRight.RUN_VIDEO_TRANSCODING) && + this.state.id !== VideoState.TO_TRANSCODE + } + hasHLS () { return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS) } 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 d135a27dc..9bfa397f8 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -21,6 +21,7 @@ import { VideoInclude, VideoPrivacy, VideoSortField, + VideoTranscodingCreate, VideoUpdate } from '@shared/models' import { environment } from '../../../../environments/environment' @@ -308,6 +309,17 @@ export class VideoService { ) } + runTranscoding (videoIds: (number | string)[], type: 'hls' | 'webtorrent') { + const body: VideoTranscodingCreate = { transcodingType: type } + + return from(videoIds) + .pipe( + concatMap(id => this.authHttp.post(VideoService.BASE_VIDEO_URL + '/' + id + '/transcoding', body)), + toArray(), + catchError(err => this.restExtractor.handleError(err)) + ) + } + loadCompleteDescription (descriptionPath: string) { return this.authHttp .get<{ description: string }>(environment.apiUrl + descriptionPath) -- cgit v1.2.3