]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-caption.ts
Type toFormattedJSON
[github/Chocobozzz/PeerTube.git] / server / models / video / video-caption.ts
index 9ce350d1280c4799062abd44b87ecfae6b0179ae..ad580176857b3727a0f1a00c0f81fe6a1db89d2c 100644 (file)
@@ -22,7 +22,7 @@ import { logger } from '../../helpers/logger'
 import { remove } from 'fs-extra'
 import { CONFIG } from '../../initializers/config'
 import * as Bluebird from 'bluebird'
-import { MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/typings/models'
 
 export enum ScopeNames {
   WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE'
@@ -154,7 +154,7 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
     return this.Video.remote === false
   }
 
-  toFormattedJSON (): VideoCaption {
+  toFormattedJSON (this: MVideoCaptionFormattable): VideoCaption {
     return {
       language: {
         id: this.language,
@@ -164,15 +164,15 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
     }
   }
 
-  getCaptionStaticPath () {
+  getCaptionStaticPath (this: MVideoCaptionFormattable) {
     return join(LAZY_STATIC_PATHS.VIDEO_CAPTIONS, this.getCaptionName())
   }
 
-  getCaptionName () {
+  getCaptionName (this: MVideoCaptionFormattable) {
     return `${this.Video.uuid}-${this.language}.vtt`
   }
 
-  removeCaptionFile () {
+  removeCaptionFile (this: MVideoCaptionFormattable) {
     return remove(CONFIG.STORAGE.CAPTIONS_DIR + this.getCaptionName())
   }
 }