diff options
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index e62bde344..9c24d1ba8 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -132,8 +132,9 @@ import { | |||
132 | MVideoFullLight, | 132 | MVideoFullLight, |
133 | MVideoIdThumbnail, | 133 | MVideoIdThumbnail, |
134 | MVideoThumbnail, | 134 | MVideoThumbnail, |
135 | MVideoWithAllFiles, | 135 | MVideoWithAllFiles, MVideoWithFile, |
136 | MVideoWithRights | 136 | MVideoWithRights, |
137 | MVideoFormattable | ||
137 | } from '../../typings/models' | 138 | } from '../../typings/models' |
138 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' | 139 | import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' |
139 | import { MThumbnail } from '../../typings/models/video/thumbnail' | 140 | import { MThumbnail } from '../../typings/models/video/thumbnail' |
@@ -1765,14 +1766,14 @@ export class VideoModel extends Model<VideoModel> { | |||
1765 | this.VideoChannel.Account.isBlocked() | 1766 | this.VideoChannel.Account.isBlocked() |
1766 | } | 1767 | } |
1767 | 1768 | ||
1768 | getOriginalFile () { | 1769 | getOriginalFile <T extends MVideoWithFile> (this: T) { |
1769 | if (Array.isArray(this.VideoFiles) === false) return undefined | 1770 | if (Array.isArray(this.VideoFiles) === false) return undefined |
1770 | 1771 | ||
1771 | // The original file is the file that have the higher resolution | 1772 | // The original file is the file that have the higher resolution |
1772 | return maxBy(this.VideoFiles, file => file.resolution) | 1773 | return maxBy(this.VideoFiles, file => file.resolution) |
1773 | } | 1774 | } |
1774 | 1775 | ||
1775 | getFile (resolution: number) { | 1776 | getFile <T extends MVideoWithFile> (this: T, resolution: number) { |
1776 | if (Array.isArray(this.VideoFiles) === false) return undefined | 1777 | if (Array.isArray(this.VideoFiles) === false) return undefined |
1777 | 1778 | ||
1778 | return this.VideoFiles.find(f => f.resolution === resolution) | 1779 | return this.VideoFiles.find(f => f.resolution === resolution) |
@@ -1878,7 +1879,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1878 | return join(LAZY_STATIC_PATHS.PREVIEWS, preview.filename) | 1879 | return join(LAZY_STATIC_PATHS.PREVIEWS, preview.filename) |
1879 | } | 1880 | } |
1880 | 1881 | ||
1881 | toFormattedJSON (options?: VideoFormattingJSONOptions): Video { | 1882 | toFormattedJSON <T extends MVideoFormattable> (this: T, options?: VideoFormattingJSONOptions): Video { |
1882 | return videoModelToFormattedJSON(this, options) | 1883 | return videoModelToFormattedJSON(this, options) |
1883 | } | 1884 | } |
1884 | 1885 | ||