mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
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
This commit is contained in:
parent
edb868655e
commit
8319d6ae72
23 changed files with 553 additions and 52 deletions
|
@ -23,6 +23,7 @@ import {
|
|||
import { MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file'
|
||||
import { VideoFile } from '@shared/models/videos/video-file.model'
|
||||
import { generateMagnetUri } from '@server/helpers/webtorrent'
|
||||
import { extractVideo } from '@server/lib/videos'
|
||||
|
||||
export type VideoFormattingJSONOptions = {
|
||||
completeDescription?: boolean
|
||||
|
@ -193,7 +194,8 @@ function videoFilesModelToFormattedJSON (
|
|||
torrentUrl: model.getTorrentUrl(videoFile, baseUrlHttp),
|
||||
torrentDownloadUrl: model.getTorrentDownloadUrl(videoFile, baseUrlHttp),
|
||||
fileUrl: model.getVideoFileUrl(videoFile, baseUrlHttp),
|
||||
fileDownloadUrl: model.getVideoFileDownloadUrl(videoFile, baseUrlHttp)
|
||||
fileDownloadUrl: model.getVideoFileDownloadUrl(videoFile, baseUrlHttp),
|
||||
metadataUrl: videoFile.metadataUrl // only send the metadataUrl and not the metadata over the wire
|
||||
} as VideoFile
|
||||
})
|
||||
.sort((a, b) => {
|
||||
|
@ -220,6 +222,15 @@ function addVideoFilesInAPAcc (
|
|||
fps: file.fps
|
||||
})
|
||||
|
||||
acc.push({
|
||||
type: 'Link',
|
||||
rel: [ 'metadata', MIMETYPES.VIDEO.EXT_MIMETYPE[file.extname] ],
|
||||
mediaType: 'application/json' as 'application/json',
|
||||
href: extractVideo(model).getVideoFileMetadataUrl(file, baseUrlHttp),
|
||||
height: file.resolution,
|
||||
fps: file.fps
|
||||
})
|
||||
|
||||
acc.push({
|
||||
type: 'Link',
|
||||
mediaType: 'application/x-bittorrent' as 'application/x-bittorrent',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue