aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-29 10:54:27 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-10-29 11:48:21 +0200
commit3c10840fa90fc88fc98e8169faf4745ff6c80893 (patch)
tree9a60c4de766700fbc33804b06ec46279b20c855e /client/src
parent2760b454a761f6af3138b2fb5f34340772ab0d1e (diff)
downloadPeerTube-3c10840fa90fc88fc98e8169faf4745ff6c80893.tar.gz
PeerTube-3c10840fa90fc88fc98e8169faf4745ff6c80893.tar.zst
PeerTube-3c10840fa90fc88fc98e8169faf4745ff6c80893.zip
Add video file size info in admin videos list
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html38
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.scss5
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts20
-rw-r--r--client/src/app/shared/shared-main/video/video-details.model.ts4
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts10
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts6
6 files changed, 73 insertions, 10 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 6250c00fb..eedf6f3dc 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -37,6 +37,7 @@
37 <th style="width: 60px;"></th> 37 <th style="width: 60px;"></th>
38 <th i18n>Video</th> 38 <th i18n>Video</th>
39 <th i18n>Info</th> 39 <th i18n>Info</th>
40 <th i18n>Files</th>
40 <th style="width: 150px;" i18n pSortableColumn="publishedAt">Published <p-sortIcon field="publishedAt"></p-sortIcon></th> 41 <th style="width: 150px;" i18n pSortableColumn="publishedAt">Published <p-sortIcon field="publishedAt"></p-sortIcon></th>
41 </tr> 42 </tr>
42 </ng-template> 43 </ng-template>
@@ -63,8 +64,8 @@
63 <my-video-cell [video]="video"></my-video-cell> 64 <my-video-cell [video]="video"></my-video-cell>
64 </td> 65 </td>
65 66
66 <td class="badges"> 67 <td>
67 <span [ngClass]="getPrivacyBadgeClass(video.privacy.id)" class="badge" i18n>{{ video.privacy.label }}</span> 68 <span [ngClass]="getPrivacyBadgeClass(video.privacy.id)" class="badge">{{ video.privacy.label }}</span>
68 69
69 <span *ngIf="video.nsfw" class="badge badge-red" i18n>NSFW</span> 70 <span *ngIf="video.nsfw" class="badge badge-red" i18n>NSFW</span>
70 71
@@ -77,6 +78,13 @@
77 </td> 78 </td>
78 79
79 <td> 80 <td>
81 <span *ngIf="isHLS(video)" class="badge badge-blue">HLS</span>
82 <span *ngIf="isWebTorrent(video)" class="badge badge-blue">WebTorrent</span>
83
84 <span *ngIf="!video.remote">{{ getFilesSize(video) | bytes: 1 }}</span>
85 </td>
86
87 <td>
80 {{ video.publishedAt | date: 'short' }} 88 {{ video.publishedAt | date: 'short' }}
81 </td> 89 </td>
82 90
@@ -85,8 +93,30 @@
85 93
86 <ng-template pTemplate="rowexpansion" let-video> 94 <ng-template pTemplate="rowexpansion" let-video>
87 <tr> 95 <tr>
88 <td colspan="50"> 96 <td class="video-info expand-cell" colspan="7">
89 <my-embed [video]="video"></my-embed> 97 <div>
98 <div *ngIf="isWebTorrent(video)">
99 WebTorrent:
100
101 <ul>
102 <li *ngFor="let file of video.files">
103 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
104 </li>
105 </ul>
106 </div>
107
108 <div *ngIf="isHLS(video)">
109 HLS:
110
111 <ul>
112 <li *ngFor="let file of video.streamingPlaylists[0].files">
113 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
114 </li>
115 </ul>
116 </div>
117
118 <my-embed class="ml-auto" [video]="video"></my-embed>
119 </div>
90 </td> 120 </td>
91 </tr> 121 </tr>
92 </ng-template> 122 </ng-template>
diff --git a/client/src/app/+admin/overview/videos/video-list.component.scss b/client/src/app/+admin/overview/videos/video-list.component.scss
index 250a917e4..158c161af 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.scss
+++ b/client/src/app/+admin/overview/videos/video-list.component.scss
@@ -3,6 +3,7 @@
3my-embed { 3my-embed {
4 display: block; 4 display: block;
5 max-width: 500px; 5 max-width: 500px;
6 width: 50%;
6} 7}
7 8
8.badge { 9.badge {
@@ -10,3 +11,7 @@ my-embed {
10 11
11 margin-right: 5px; 12 margin-right: 5px;
12} 13}
14
15.video-info > div {
16 display: flex;
17}
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 dd9225e6a..6885abfc7 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
5import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' 5import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
6import { UserRight, VideoPrivacy, VideoState } from '@shared/models' 6import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
7import { AdvancedInputFilter } from '@app/shared/shared-forms' 7import { AdvancedInputFilter } from '@app/shared/shared-forms'
8import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' 8import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
9 9
@@ -114,6 +114,24 @@ export class VideoListComponent extends RestTable implements OnInit {
114 return video.blacklisted 114 return video.blacklisted
115 } 115 }
116 116
117 isHLS (video: Video) {
118 return video.streamingPlaylists.some(p => p.type === VideoStreamingPlaylistType.HLS)
119 }
120
121 isWebTorrent (video: Video) {
122 return video.files.length !== 0
123 }
124
125 getFilesSize (video: Video) {
126 let files = video.files
127
128 if (this.isHLS(video)) {
129 files = files.concat(video.streamingPlaylists[0].files)
130 }
131
132 return files.reduce((p, f) => p += f.size, 0)
133 }
134
117 protected reloadData () { 135 protected reloadData () {
118 this.selectedVideos = [] 136 this.selectedVideos = []
119 137
diff --git a/client/src/app/shared/shared-main/video/video-details.model.ts b/client/src/app/shared/shared-main/video/video-details.model.ts
index f060d1dc9..45c053507 100644
--- a/client/src/app/shared/shared-main/video/video-details.model.ts
+++ b/client/src/app/shared/shared-main/video/video-details.model.ts
@@ -15,7 +15,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
15 support: string 15 support: string
16 channel: VideoChannel 16 channel: VideoChannel
17 tags: string[] 17 tags: string[]
18 files: VideoFile[]
19 account: Account 18 account: Account
20 commentsEnabled: boolean 19 commentsEnabled: boolean
21 downloadEnabled: boolean 20 downloadEnabled: boolean
@@ -28,13 +27,13 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
28 27
29 trackerUrls: string[] 28 trackerUrls: string[]
30 29
30 files: VideoFile[]
31 streamingPlaylists: VideoStreamingPlaylist[] 31 streamingPlaylists: VideoStreamingPlaylist[]
32 32
33 constructor (hash: VideoDetailsServerModel, translations = {}) { 33 constructor (hash: VideoDetailsServerModel, translations = {}) {
34 super(hash, translations) 34 super(hash, translations)
35 35
36 this.descriptionPath = hash.descriptionPath 36 this.descriptionPath = hash.descriptionPath
37 this.files = hash.files
38 this.channel = new VideoChannel(hash.channel) 37 this.channel = new VideoChannel(hash.channel)
39 this.account = new Account(hash.account) 38 this.account = new Account(hash.account)
40 this.tags = hash.tags 39 this.tags = hash.tags
@@ -43,7 +42,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
43 this.downloadEnabled = hash.downloadEnabled 42 this.downloadEnabled = hash.downloadEnabled
44 43
45 this.trackerUrls = hash.trackerUrls 44 this.trackerUrls = hash.trackerUrls
46 this.streamingPlaylists = hash.streamingPlaylists
47 45
48 this.buildLikeAndDislikePercents() 46 this.buildLikeAndDislikePercents()
49 } 47 }
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 699eac7f1..b11316471 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -10,9 +10,11 @@ import {
10 UserRight, 10 UserRight,
11 Video as VideoServerModel, 11 Video as VideoServerModel,
12 VideoConstant, 12 VideoConstant,
13 VideoFile,
13 VideoPrivacy, 14 VideoPrivacy,
14 VideoScheduleUpdate, 15 VideoScheduleUpdate,
15 VideoState 16 VideoState,
17 VideoStreamingPlaylist
16} from '@shared/models' 18} from '@shared/models'
17 19
18export class Video implements VideoServerModel { 20export class Video implements VideoServerModel {
@@ -96,6 +98,9 @@ export class Video implements VideoServerModel {
96 98
97 pluginData?: any 99 pluginData?: any
98 100
101 streamingPlaylists?: VideoStreamingPlaylist[]
102 files?: VideoFile[]
103
99 static buildWatchUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) { 104 static buildWatchUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
100 return buildVideoWatchPath({ shortUUID: video.shortUUID || video.uuid }) 105 return buildVideoWatchPath({ shortUUID: video.shortUUID || video.uuid })
101 } 106 }
@@ -172,6 +177,9 @@ export class Video implements VideoServerModel {
172 this.blockedOwner = hash.blockedOwner 177 this.blockedOwner = hash.blockedOwner
173 this.blockedServer = hash.blockedServer 178 this.blockedServer = hash.blockedServer
174 179
180 this.streamingPlaylists = hash.streamingPlaylists
181 this.files = hash.files
182
175 this.userHistory = hash.userHistory 183 this.userHistory = hash.userHistory
176 184
177 this.originInstanceHost = this.account.host 185 this.originInstanceHost = this.account.host
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 0a3a51b0c..5db9a8704 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -208,7 +208,11 @@ export class VideoService {
208 ): Observable<ResultList<Video>> { 208 ): Observable<ResultList<Video>> {
209 const { pagination, search } = parameters 209 const { pagination, search } = parameters
210 210
211 const include = VideoInclude.BLACKLISTED | VideoInclude.BLOCKED_OWNER | VideoInclude.HIDDEN_PRIVACY | VideoInclude.NOT_PUBLISHED_STATE 211 const include = VideoInclude.BLACKLISTED |
212 VideoInclude.BLOCKED_OWNER |
213 VideoInclude.HIDDEN_PRIVACY |
214 VideoInclude.NOT_PUBLISHED_STATE |
215 VideoInclude.FILES
212 216
213 let params = new HttpParams() 217 let params = new HttpParams()
214 params = this.buildCommonVideosParams({ params, include, ...parameters }) 218 params = this.buildCommonVideosParams({ params, include, ...parameters })