]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.service.ts
Auto update publishedAt in live restream
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.service.ts
index 6edcc3fe05cd2afb649975b8a05c6bbd415e6031..9bfa397f8979e0d547af7753ba275eac9fcdb4ca 100644 (file)
@@ -21,6 +21,7 @@ import {
   VideoInclude,
   VideoPrivacy,
   VideoSortField,
+  VideoTranscodingCreate,
   VideoUpdate
 } from '@shared/models'
 import { environment } from '../../../../environments/environment'
@@ -38,6 +39,7 @@ export type CommonVideoParams = {
   isLocal?: boolean
   categoryOneOf?: number[]
   languageOneOf?: string[]
+  privacyOneOf?: VideoPrivacy[]
   isLive?: boolean
   skipCount?: boolean
 
@@ -298,6 +300,26 @@ export class VideoService {
       )
   }
 
+  removeVideoFiles (videoIds: (number | string)[], type: 'hls' | 'webtorrent') {
+    return from(videoIds)
+      .pipe(
+        concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + id + '/' + type)),
+        toArray(),
+        catchError(err => this.restExtractor.handleError(err))
+      )
+  }
+
+  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)
@@ -392,6 +414,7 @@ export class VideoService {
       include,
       categoryOneOf,
       languageOneOf,
+      privacyOneOf,
       skipCount,
       nsfwPolicy,
       isLive,
@@ -413,6 +436,7 @@ export class VideoService {
     if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
     if (languageOneOf) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf)
     if (categoryOneOf) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf)
+    if (privacyOneOf) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf)
 
     return newParams
   }