aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-09 11:32:40 +0200
committerChocobozzz <me@florianbigard.com>2019-08-09 11:32:40 +0200
commit557b13ae24019d9ab214bbea7eaa0f892c8f4b05 (patch)
treeaa32396531acf93e3dfdb29880177813039ed77f /server/models/video
parentc5407d7046168abb4098df1408e7aa84519cb61a (diff)
downloadPeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.tar.gz
PeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.tar.zst
PeerTube-557b13ae24019d9ab214bbea7eaa0f892c8f4b05.zip
Lazy load avatars
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/thumbnail.ts4
-rw-r--r--server/models/video/video-caption.ts4
-rw-r--r--server/models/video/video.ts3
3 files changed, 6 insertions, 5 deletions
diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts
index b767a6874..cf2040cbf 100644
--- a/server/models/video/thumbnail.ts
+++ b/server/models/video/thumbnail.ts
@@ -1,6 +1,6 @@
1import { join } from 'path' 1import { join } from 'path'
2import { AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' 2import { AfterDestroy, AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
3import { STATIC_PATHS, WEBSERVER } from '../../initializers/constants' 3import { LAZY_STATIC_PATHS, STATIC_PATHS, WEBSERVER } from '../../initializers/constants'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
5import { remove } from 'fs-extra' 5import { remove } from 'fs-extra'
6import { CONFIG } from '../../initializers/config' 6import { CONFIG } from '../../initializers/config'
@@ -87,7 +87,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
87 [ThumbnailType.PREVIEW]: { 87 [ThumbnailType.PREVIEW]: {
88 label: 'preview', 88 label: 'preview',
89 directory: CONFIG.STORAGE.PREVIEWS_DIR, 89 directory: CONFIG.STORAGE.PREVIEWS_DIR,
90 staticPath: STATIC_PATHS.PREVIEWS 90 staticPath: LAZY_STATIC_PATHS.PREVIEWS
91 } 91 }
92 } 92 }
93 93
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index 76243bf48..a01565851 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -16,7 +16,7 @@ import { buildWhereIdOrUUID, throwIfNotValid } from '../utils'
16import { VideoModel } from './video' 16import { VideoModel } from './video'
17import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' 17import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
18import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' 18import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
19import { STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers/constants' 19import { LAZY_STATIC_PATHS, VIDEO_LANGUAGES } from '../../initializers/constants'
20import { join } from 'path' 20import { join } from 'path'
21import { logger } from '../../helpers/logger' 21import { logger } from '../../helpers/logger'
22import { remove } from 'fs-extra' 22import { remove } from 'fs-extra'
@@ -163,7 +163,7 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
163 } 163 }
164 164
165 getCaptionStaticPath () { 165 getCaptionStaticPath () {
166 return join(STATIC_PATHS.VIDEO_CAPTIONS, this.getCaptionName()) 166 return join(LAZY_STATIC_PATHS.VIDEO_CAPTIONS, this.getCaptionName())
167 } 167 }
168 168
169 getCaptionName () { 169 getCaptionName () {
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index ae29cf286..1321337ff 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -63,6 +63,7 @@ import {
63 CONSTRAINTS_FIELDS, 63 CONSTRAINTS_FIELDS,
64 HLS_REDUNDANCY_DIRECTORY, 64 HLS_REDUNDANCY_DIRECTORY,
65 HLS_STREAMING_PLAYLIST_DIRECTORY, 65 HLS_STREAMING_PLAYLIST_DIRECTORY,
66 LAZY_STATIC_PATHS,
66 REMOTE_SCHEME, 67 REMOTE_SCHEME,
67 STATIC_DOWNLOAD_PATHS, 68 STATIC_DOWNLOAD_PATHS,
68 STATIC_PATHS, 69 STATIC_PATHS,
@@ -1856,7 +1857,7 @@ export class VideoModel extends Model<VideoModel> {
1856 if (!preview) return null 1857 if (!preview) return null
1857 1858
1858 // We use a local cache, so specify our cache endpoint instead of potential remote URL 1859 // We use a local cache, so specify our cache endpoint instead of potential remote URL
1859 return join(STATIC_PATHS.PREVIEWS, preview.filename) 1860 return join(LAZY_STATIC_PATHS.PREVIEWS, preview.filename)
1860 } 1861 }
1861 1862
1862 toFormattedJSON (options?: VideoFormattingJSONOptions): Video { 1863 toFormattedJSON (options?: VideoFormattingJSONOptions): Video {