diff options
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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 { | |||
36 | Table, | 36 | Table, |
37 | UpdatedAt | 37 | UpdatedAt |
38 | } from 'sequelize-typescript' | 38 | } from 'sequelize-typescript' |
39 | import { UserRight, VideoPrivacy, VideoState } from '../../../shared' | 39 | import { UserRight, VideoPrivacy, VideoResolution, VideoState } from '../../../shared' |
40 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' | 40 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' |
41 | import { Video, VideoDetails, VideoFile } from '../../../shared/models/videos' | 41 | import { Video, VideoDetails, VideoFile } from '../../../shared/models/videos' |
42 | import { VideoFilter } from '../../../shared/models/videos/video-query.type' | 42 | import { VideoFilter } from '../../../shared/models/videos/video-query.type' |
@@ -1753,6 +1753,12 @@ export class VideoModel extends Model<VideoModel> { | |||
1753 | return maxBy(this.VideoFiles, file => file.resolution) | 1753 | return maxBy(this.VideoFiles, file => file.resolution) |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | getFile (resolution: VideoResolution) { | ||
1757 | if (Array.isArray(this.VideoFiles) === false) return undefined | ||
1758 | |||
1759 | return this.VideoFiles.find(f => f.resolution === resolution) | ||
1760 | } | ||
1761 | |||
1756 | async addAndSaveThumbnail (thumbnail: ThumbnailModel, transaction: Transaction) { | 1762 | async addAndSaveThumbnail (thumbnail: ThumbnailModel, transaction: Transaction) { |
1757 | thumbnail.videoId = this.id | 1763 | thumbnail.videoId = this.id |
1758 | 1764 | ||