aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-18 11:28:00 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-18 13:38:09 +0100
commit8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769 (patch)
tree863daf231cf4a66d9e5abf1cfe4fbe2b742cd856 /server/models/video
parentf66db4d5c851fe87bb71cccee96926000f59a15b (diff)
downloadPeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.tar.gz
PeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.tar.zst
PeerTube-8efc27bf14f1fe3ed23cd8a6d2de1f0918a7f769.zip
Cleanup
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-file.ts4
-rw-r--r--server/models/video/video-format-utils.ts6
4 files changed, 9 insertions, 9 deletions
diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts
index 319e1175a..f1187c8d6 100644
--- a/server/models/video/thumbnail.ts
+++ b/server/models/video/thumbnail.ts
@@ -16,7 +16,7 @@ import {
16 UpdatedAt 16 UpdatedAt
17} from 'sequelize-typescript' 17} from 'sequelize-typescript'
18import { afterCommitIfTransaction } from '@server/helpers/database-utils' 18import { afterCommitIfTransaction } from '@server/helpers/database-utils'
19import { MThumbnail, MThumbnailVideo, MVideoWithHost } from '@server/types/models' 19import { MThumbnail, MThumbnailVideo, MVideo } from '@server/types/models'
20import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type' 20import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
21import { logger } from '../../helpers/logger' 21import { logger } from '../../helpers/logger'
22import { CONFIG } from '../../initializers/config' 22import { CONFIG } from '../../initializers/config'
@@ -163,7 +163,7 @@ export class ThumbnailModel extends Model {
163 return join(directory, filename) 163 return join(directory, filename)
164 } 164 }
165 165
166 getFileUrl (video: MVideoWithHost) { 166 getFileUrl (video: MVideo) {
167 const staticPath = ThumbnailModel.types[this.type].staticPath + this.filename 167 const staticPath = ThumbnailModel.types[this.type].staticPath + this.filename
168 168
169 if (video.isOwned()) return WEBSERVER.URL + staticPath 169 if (video.isOwned()) return WEBSERVER.URL + staticPath
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index 0bbe9b752..bfdec73e9 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -16,7 +16,7 @@ import {
16 UpdatedAt 16 UpdatedAt
17} from 'sequelize-typescript' 17} from 'sequelize-typescript'
18import { v4 as uuidv4 } from 'uuid' 18import { v4 as uuidv4 } from 'uuid'
19import { MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo, MVideoWithHost } from '@server/types/models' 19import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
20import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' 20import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
21import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' 21import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
22import { logger } from '../../helpers/logger' 22import { logger } from '../../helpers/logger'
@@ -203,7 +203,7 @@ export class VideoCaptionModel extends Model {
203 return remove(CONFIG.STORAGE.CAPTIONS_DIR + this.filename) 203 return remove(CONFIG.STORAGE.CAPTIONS_DIR + this.filename)
204 } 204 }
205 205
206 getFileUrl (video: MVideoWithHost) { 206 getFileUrl (video: MVideo) {
207 if (!this.Video) this.Video = video as VideoModel 207 if (!this.Video) this.Video = video as VideoModel
208 208
209 if (video.isOwned()) return WEBSERVER.URL + this.getCaptionStaticPath() 209 if (video.isOwned()) return WEBSERVER.URL + this.getCaptionStaticPath()
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 5a3706259..4df2c20bc 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -423,7 +423,7 @@ export class VideoFileModel extends Model {
423 return !!this.videoStreamingPlaylistId 423 return !!this.videoStreamingPlaylistId
424 } 424 }
425 425
426 getFileUrl (video: MVideoWithHost) { 426 getFileUrl (video: MVideo) {
427 if (!this.Video) this.Video = video as VideoModel 427 if (!this.Video) this.Video = video as VideoModel
428 428
429 if (video.isOwned()) return WEBSERVER.URL + this.getFileStaticPath(video) 429 if (video.isOwned()) return WEBSERVER.URL + this.getFileStaticPath(video)
@@ -449,7 +449,7 @@ export class VideoFileModel extends Model {
449 return buildRemoteVideoBaseUrl(video, path) 449 return buildRemoteVideoBaseUrl(video, path)
450 } 450 }
451 451
452 getRemoteTorrentUrl (video: MVideoWithHost) { 452 getRemoteTorrentUrl (video: MVideo) {
453 if (video.isOwned()) throw new Error(`Video ${video.url} is not a remote video`) 453 if (video.isOwned()) throw new Error(`Video ${video.url} is not a remote video`)
454 454
455 return this.torrentUrl 455 return this.torrentUrl
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts
index 455597d22..a6a1a4f0d 100644
--- a/server/models/video/video-format-utils.ts
+++ b/server/models/video/video-format-utils.ts
@@ -14,11 +14,11 @@ import {
14} from '../../lib/activitypub/url' 14} from '../../lib/activitypub/url'
15import { 15import {
16 MStreamingPlaylistRedundanciesOpt, 16 MStreamingPlaylistRedundanciesOpt,
17 MVideo,
17 MVideoAP, 18 MVideoAP,
18 MVideoFile, 19 MVideoFile,
19 MVideoFormattable, 20 MVideoFormattable,
20 MVideoFormattableDetails, 21 MVideoFormattableDetails
21 MVideoWithHost
22} from '../../types/models' 22} from '../../types/models'
23import { MVideoFileRedundanciesOpt } from '../../types/models/video/video-file' 23import { MVideoFileRedundanciesOpt } from '../../types/models/video/video-file'
24import { VideoModel } from './video' 24import { VideoModel } from './video'
@@ -225,7 +225,7 @@ function videoFilesModelToFormattedJSON (
225 225
226function addVideoFilesInAPAcc ( 226function addVideoFilesInAPAcc (
227 acc: ActivityUrlObject[] | ActivityTagObject[], 227 acc: ActivityUrlObject[] | ActivityTagObject[],
228 video: MVideoWithHost, 228 video: MVideo,
229 files: MVideoFile[] 229 files: MVideoFile[]
230) { 230) {
231 const trackerUrls = video.getTrackerUrls() 231 const trackerUrls = video.getTrackerUrls()