aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts12
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts12
2 files changed, 24 insertions, 0 deletions
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 {
220 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) 220 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
221 } 221 }
222 222
223 canRemoveFiles (user: AuthUser) {
224 return user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&
225 this.state.id !== VideoState.TO_TRANSCODE &&
226 this.hasHLS() &&
227 this.hasWebTorrent()
228 }
229
230 canRunTranscoding (user: AuthUser) {
231 return user.hasRight(UserRight.RUN_VIDEO_TRANSCODING) &&
232 this.state.id !== VideoState.TO_TRANSCODE
233 }
234
223 hasHLS () { 235 hasHLS () {
224 return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS) 236 return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
225 } 237 }
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 {
21 VideoInclude, 21 VideoInclude,
22 VideoPrivacy, 22 VideoPrivacy,
23 VideoSortField, 23 VideoSortField,
24 VideoTranscodingCreate,
24 VideoUpdate 25 VideoUpdate
25} from '@shared/models' 26} from '@shared/models'
26import { environment } from '../../../../environments/environment' 27import { environment } from '../../../../environments/environment'
@@ -308,6 +309,17 @@ export class VideoService {
308 ) 309 )
309 } 310 }
310 311
312 runTranscoding (videoIds: (number | string)[], type: 'hls' | 'webtorrent') {
313 const body: VideoTranscodingCreate = { transcodingType: type }
314
315 return from(videoIds)
316 .pipe(
317 concatMap(id => this.authHttp.post(VideoService.BASE_VIDEO_URL + '/' + id + '/transcoding', body)),
318 toArray(),
319 catchError(err => this.restExtractor.handleError(err))
320 )
321 }
322
311 loadCompleteDescription (descriptionPath: string) { 323 loadCompleteDescription (descriptionPath: string) {
312 return this.authHttp 324 return this.authHttp
313 .get<{ description: string }>(environment.apiUrl + descriptionPath) 325 .get<{ description: string }>(environment.apiUrl + descriptionPath)