From 3c10840fa90fc88fc98e8169faf4745ff6c80893 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Oct 2021 10:54:27 +0200 Subject: Add video file size info in admin videos list --- .../overview/videos/video-list.component.html | 38 +++++++++++++++++++--- .../overview/videos/video-list.component.scss | 5 +++ .../+admin/overview/videos/video-list.component.ts | 20 +++++++++++- 3 files changed, 58 insertions(+), 5 deletions(-) (limited to 'client/src/app/+admin') 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 @@ Video Info + Files Published @@ -63,8 +64,8 @@ - - {{ video.privacy.label }} + + {{ video.privacy.label }} NSFW @@ -76,6 +77,13 @@ Blocked + + HLS + WebTorrent + + {{ getFilesSize(video) | bytes: 1 }} + + {{ video.publishedAt | date: 'short' }} @@ -85,8 +93,30 @@ - - + +
+
+ WebTorrent: + +
    +
  • + {{ file.resolution.label }}: {{ file.size | bytes: 1 }} +
  • +
+
+ +
+ HLS: + +
    +
  • + {{ file.resolution.label }}: {{ file.size | bytes: 1 }} +
  • +
+
+ + +
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 @@ my-embed { display: block; max-width: 500px; + width: 50%; } .badge { @@ -10,3 +11,7 @@ my-embed { margin-right: 5px; } + +.video-info > div { + display: flex; +} 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' import { ActivatedRoute, Router } from '@angular/router' import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' -import { UserRight, VideoPrivacy, VideoState } from '@shared/models' +import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' import { AdvancedInputFilter } from '@app/shared/shared-forms' import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' @@ -114,6 +114,24 @@ export class VideoListComponent extends RestTable implements OnInit { return video.blacklisted } + isHLS (video: Video) { + return video.streamingPlaylists.some(p => p.type === VideoStreamingPlaylistType.HLS) + } + + isWebTorrent (video: Video) { + return video.files.length !== 0 + } + + getFilesSize (video: Video) { + let files = video.files + + if (this.isHLS(video)) { + files = files.concat(video.streamingPlaylists[0].files) + } + + return files.reduce((p, f) => p += f.size, 0) + } + protected reloadData () { this.selectedVideos = [] -- cgit v1.2.3