aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorkimsible <kimsible@users.noreply.github.com>2020-04-11 04:24:42 +0200
committerkimsible <kimsible@users.noreply.github.com>2020-04-14 14:39:30 +0200
commit50ad0a1c1699fb1799c9ba2a99bf888894f88df4 (patch)
tree52279eaa419c94b96b1bf9169d396270e6146aff /client/src/app/videos
parent5def04e17f1df09a708622afe634ccac256eab86 (diff)
downloadPeerTube-50ad0a1c1699fb1799c9ba2a99bf888894f88df4.tar.gz
PeerTube-50ad0a1c1699fb1799c9ba2a99bf888894f88df4.tar.zst
PeerTube-50ad0a1c1699fb1799c9ba2a99bf888894f88df4.zip
Add getSubs to YoutubeDL video import
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts64
1 files changed, 39 insertions, 25 deletions
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
index a5578bebd..a17d73683 100644
--- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
+++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
@@ -12,6 +12,7 @@ import { FormValidatorService } from '@app/shared'
12import { VideoCaptionService } from '@app/shared/video-caption' 12import { VideoCaptionService } from '@app/shared/video-caption'
13import { VideoImportService } from '@app/shared/video-import' 13import { VideoImportService } from '@app/shared/video-import'
14import { scrollToTop } from '@app/shared/misc/utils' 14import { scrollToTop } from '@app/shared/misc/utils'
15import { switchMap, map } from 'rxjs/operators'
15 16
16@Component({ 17@Component({
17 selector: 'my-video-import-url', 18 selector: 'my-video-import-url',
@@ -76,31 +77,44 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
76 77
77 this.loadingBar.start() 78 this.loadingBar.start()
78 79
79 this.videoImportService.importVideoUrl(this.targetUrl, videoUpdate).subscribe( 80 this.videoImportService
80 res => { 81 .importVideoUrl(this.targetUrl, videoUpdate)
81 this.loadingBar.complete() 82 .pipe(
82 this.firstStepDone.emit(res.video.name) 83 switchMap(res => {
83 this.isImportingVideo = false 84 return this.videoCaptionService
84 this.hasImportedVideo = true 85 .listCaptions(res.video.id)
85 86 .pipe(
86 this.video = new VideoEdit(Object.assign(res.video, { 87 map(result => ({ video: res.video, videoCaptions: result.data }))
87 commentsEnabled: videoUpdate.commentsEnabled, 88 )
88 downloadEnabled: videoUpdate.downloadEnabled, 89 })
89 support: null, 90 )
90 thumbnailUrl: null, 91 .subscribe(
91 previewUrl: null 92 ({ video, videoCaptions }) => {
92 })) 93 this.loadingBar.complete()
93 94 this.firstStepDone.emit(video.name)
94 this.hydrateFormFromVideo() 95 this.isImportingVideo = false
95 }, 96 this.hasImportedVideo = true
96 97
97 err => { 98 this.video = new VideoEdit(Object.assign(video, {
98 this.loadingBar.complete() 99 commentsEnabled: videoUpdate.commentsEnabled,
99 this.isImportingVideo = false 100 downloadEnabled: videoUpdate.downloadEnabled,
100 this.firstStepError.emit() 101 support: null,
101 this.notifier.error(err.message) 102 thumbnailUrl: null,
102 } 103 previewUrl: null
103 ) 104 }))
105
106 this.videoCaptions = videoCaptions
107
108 this.hydrateFormFromVideo()
109 },
110
111 err => {
112 this.loadingBar.complete()
113 this.isImportingVideo = false
114 this.firstStepError.emit()
115 this.notifier.error(err.message)
116 }
117 )
104 } 118 }
105 119
106 updateSecondStep () { 120 updateSecondStep () {