]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-file.ts
Stronger model typings
[github/Chocobozzz/PeerTube.git] / server / models / video / video-file.ts
index 2203a7abaf547ec3da32cba5f7a95e79aa75e93a..6304f741ce0aa272d2ad0bb2b1c76961ec5a2e35 100644 (file)
@@ -24,6 +24,8 @@ import { VideoModel } from './video'
 import { VideoRedundancyModel } from '../redundancy/video-redundancy'
 import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
 import { FindOptions, QueryTypes, Transaction } from 'sequelize'
+import { MIMETYPES } from '../../initializers/constants'
+import { MVideoFile } from '@server/typings/models'
 
 @Table({
   tableName: 'videoFile',
@@ -161,7 +163,11 @@ export class VideoFileModel extends Model<VideoFileModel> {
       }))
   }
 
-  hasSameUniqueKeysThan (other: VideoFileModel) {
+  isAudio () {
+    return !!MIMETYPES.AUDIO.EXT_MIMETYPE[this.extname]
+  }
+
+  hasSameUniqueKeysThan (other: MVideoFile) {
     return this.fps === other.fps &&
       this.resolution === other.resolution &&
       this.videoId === other.videoId