From 8319d6ae72d4da6de51bd3d4b5c68040fc8dc3b4 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 10 Mar 2020 14:39:40 +0100 Subject: Add video file metadata to download modal, via ffprobe (#2411) * Add video file metadata via ffprobe * Federate video file metadata * Add tests for file metadata generation * Complete tests for videoFile metadata federation * Lint migration and video-file for metadata * Objectify metadata from getter in ffmpeg-utils * Add metadataUrl to all videoFiles * Simplify metadata API middleware * Load playlist in videoFile when requesting metadata --- shared/models/videos/video-file-metadata.ts | 18 ++++++++++++++++++ shared/models/videos/video-file.model.ts | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 shared/models/videos/video-file-metadata.ts (limited to 'shared/models/videos') diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.ts new file mode 100644 index 000000000..15683cacf --- /dev/null +++ b/shared/models/videos/video-file-metadata.ts @@ -0,0 +1,18 @@ +import { FfprobeData } from "fluent-ffmpeg" +import { DeepOmit } from "@server/models/utils" + +export type VideoFileMetadataModel = DeepOmit + +export class VideoFileMetadata implements VideoFileMetadataModel { + streams: { [x: string]: any, [x: number]: any }[] + format: { [x: string]: any, [x: number]: any } + chapters: any[] + + constructor (hash: Partial) { + this.chapters = hash.chapters + this.format = hash.format + this.streams = hash.streams + + delete this.format.filename + } +} diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts index 04da0627e..6cc2d5aee 100644 --- a/shared/models/videos/video-file.model.ts +++ b/shared/models/videos/video-file.model.ts @@ -1,4 +1,5 @@ import { VideoConstant, VideoResolution } from '@shared/models' +import { FfprobeData } from 'fluent-ffmpeg' export interface VideoFile { magnetUri: string @@ -9,4 +10,6 @@ export interface VideoFile { fileUrl: string fileDownloadUrl: string fps: number + metadata?: FfprobeData + metadataUrl?: string } -- cgit v1.2.3