aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-18 14:35:08 +0100
committerChocobozzz <me@florianbigard.com>2021-11-18 15:20:57 +0100
commitad5db1044c8599eaaaa2a578b350777ae996b068 (patch)
tree3e003cccf021152405d49b21c6c91b703c8ae96c /client/src/app/+admin
parentb46cf4b920984492df598c1b61179acfc7f6f22e (diff)
downloadPeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.gz
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.tar.zst
PeerTube-ad5db1044c8599eaaaa2a578b350777ae996b068.zip
Add ability to run transcoding jobs
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html4
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts32
2 files changed, 31 insertions, 5 deletions
diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html
index 6e4fb4c6f..738bcedee 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -56,8 +56,8 @@
56 56
57 <td class="action-cell"> 57 <td class="action-cell">
58 <my-video-actions-dropdown 58 <my-video-actions-dropdown
59 placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" 59 placement="bottom auto" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" [displayOptions]="videoActionsOptions"
60 [displayOptions]="videoActionsOptions" (videoRemoved)="reloadData()" (videoFilesRemoved)="reloadData()" 60 (videoRemoved)="reloadData()" (videoFilesRemoved)="reloadData()" (transcodingCreated)="reloadData()"
61 ></my-video-actions-dropdown> 61 ></my-video-actions-dropdown>
62 </td> 62 </td>
63 63
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index 3c21adb44..4aed5221b 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -40,7 +40,8 @@ export class VideoListComponent extends RestTable implements OnInit {
40 duplicate: true, 40 duplicate: true,
41 mute: true, 41 mute: true,
42 liveInfo: false, 42 liveInfo: false,
43 removeFiles: true 43 removeFiles: true,
44 transcoding: true
44 } 45 }
45 46
46 loading = true 47 loading = true
@@ -90,15 +91,27 @@ export class VideoListComponent extends RestTable implements OnInit {
90 ], 91 ],
91 [ 92 [
92 { 93 {
94 label: $localize`Run HLS transcoding`,
95 handler: videos => this.runTranscoding(videos, 'hls'),
96 isDisplayed: videos => videos.every(v => v.canRunTranscoding(this.authUser)),
97 iconName: 'cog'
98 },
99 {
100 label: $localize`Run WebTorrent transcoding`,
101 handler: videos => this.runTranscoding(videos, 'webtorrent'),
102 isDisplayed: videos => videos.every(v => v.canRunTranscoding(this.authUser)),
103 iconName: 'cog'
104 },
105 {
93 label: $localize`Delete HLS files`, 106 label: $localize`Delete HLS files`,
94 handler: videos => this.removeVideoFiles(videos, 'hls'), 107 handler: videos => this.removeVideoFiles(videos, 'hls'),
95 isDisplayed: videos => this.authUser.hasRight(UserRight.MANAGE_VIDEO_FILES) && videos.every(v => v.hasHLS() && v.hasWebTorrent()), 108 isDisplayed: videos => videos.every(v => v.canRemoveFiles(this.authUser)),
96 iconName: 'delete' 109 iconName: 'delete'
97 }, 110 },
98 { 111 {
99 label: $localize`Delete WebTorrent files`, 112 label: $localize`Delete WebTorrent files`,
100 handler: videos => this.removeVideoFiles(videos, 'webtorrent'), 113 handler: videos => this.removeVideoFiles(videos, 'webtorrent'),
101 isDisplayed: videos => this.authUser.hasRight(UserRight.MANAGE_VIDEO_FILES) && videos.every(v => v.hasHLS() && v.hasWebTorrent()), 114 isDisplayed: videos => videos.every(v => v.canRemoveFiles(this.authUser)),
102 iconName: 'delete' 115 iconName: 'delete'
103 } 116 }
104 ] 117 ]
@@ -226,4 +239,17 @@ export class VideoListComponent extends RestTable implements OnInit {
226 error: err => this.notifier.error(err.message) 239 error: err => this.notifier.error(err.message)
227 }) 240 })
228 } 241 }
242
243 private runTranscoding (videos: Video[], type: 'hls' | 'webtorrent') {
244 this.videoService.runTranscoding(videos.map(v => v.id), type)
245 .subscribe({
246 next: () => {
247 this.notifier.success($localize`Transcoding jobs created.`)
248
249 this.reloadData()
250 },
251
252 error: err => this.notifier.error(err.message)
253 })
254 }
229} 255}