From 29d4e1375fdac88595347184c3d1b214804794b0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 1 Aug 2019 14:19:18 +0200 Subject: Fix HLS transcoding --- server/models/video/video.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/models/video/video.ts') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 05d625fc1..ae29cf286 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -36,7 +36,7 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { UserRight, VideoPrivacy, VideoState } from '../../../shared' +import { UserRight, VideoPrivacy, VideoResolution, VideoState } from '../../../shared' import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' import { Video, VideoDetails, VideoFile } from '../../../shared/models/videos' import { VideoFilter } from '../../../shared/models/videos/video-query.type' @@ -1753,6 +1753,12 @@ export class VideoModel extends Model { return maxBy(this.VideoFiles, file => file.resolution) } + getFile (resolution: VideoResolution) { + if (Array.isArray(this.VideoFiles) === false) return undefined + + return this.VideoFiles.find(f => f.resolution === resolution) + } + async addAndSaveThumbnail (thumbnail: ThumbnailModel, transaction: Transaction) { thumbnail.videoId = this.id -- cgit v1.2.3