]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video.service.ts
Add ability to schedule video publication
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video.service.ts
index c607b7d6a70ae0d69fb0d38a81718a2351da22d8..3af90e7ad63939fb2d4d333a406ffca4591bea22 100644 (file)
@@ -46,8 +46,8 @@ export class VideoService {
     return this.serverService.localeObservable
                .pipe(
                  switchMap(translations => {
-                  return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid)
-                     .pipe(map(videoHash => ({ videoHash, translations })))
+                   return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + uuid)
+                              .pipe(map(videoHash => ({ videoHash, translations })))
                  }),
                  map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)),
                  catchError(res => this.restExtractor.handleError(res))
@@ -80,9 +80,11 @@ export class VideoService {
       privacy: video.privacy,
       tags: video.tags,
       nsfw: video.nsfw,
+      waitTranscoding: video.waitTranscoding,
       commentsEnabled: video.commentsEnabled,
       thumbnailfile: video.thumbnailfile,
-      previewfile: video.previewfile
+      previewfile: video.previewfile,
+      scheduleUpdate: video.scheduleUpdate || undefined
     }
 
     const data = objectToFormData(body)
@@ -98,11 +100,11 @@ export class VideoService {
     const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true })
 
     return this.authHttp
-               .request<{ video: { id: number, uuid: string} }>(req)
+               .request<{ video: { id: number, uuid: string } }>(req)
                .pipe(catchError(this.restExtractor.handleError))
   }
 
-  getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number}> {
+  getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -120,7 +122,7 @@ export class VideoService {
     account: Account,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -138,7 +140,7 @@ export class VideoService {
     videoChannel: VideoChannel,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -156,7 +158,7 @@ export class VideoService {
     videoPagination: ComponentPagination,
     sort: VideoSortField,
     filter?: VideoFilter
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
 
     let params = new HttpParams()
@@ -225,7 +227,7 @@ export class VideoService {
     search: string,
     videoPagination: ComponentPagination,
     sort: VideoSortField
-  ): Observable<{ videos: Video[], totalVideos: number}> {
+  ): Observable<{ videos: Video[], totalVideos: number }> {
     const url = VideoService.BASE_VIDEO_URL + 'search'
 
     const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
@@ -295,18 +297,18 @@ export class VideoService {
 
   private extractVideos (result: ResultList<VideoServerModel>) {
     return this.serverService.localeObservable
-      .pipe(
-        map(translations => {
-          const videosJson = result.data
-          const totalVideos = result.total
-          const videos: Video[] = []
-
-          for (const videoJson of videosJson) {
-            videos.push(new Video(videoJson, translations))
-          }
-
-          return { videos, totalVideos }
-        })
-      )
+               .pipe(
+                 map(translations => {
+                   const videosJson = result.data
+                   const totalVideos = result.total
+                   const videos: Video[] = []
+
+                   for (const videoJson of videosJson) {
+                     videos.push(new Video(videoJson, translations))
+                   }
+
+                   return { videos, totalVideos }
+                 })
+               )
   }
 }