@BeforeDestroy
static async removeFile (instance: VideoRedundancyModel) {
- // Not us
- if (!instance.strategy) return
+ if (!instance.isOwned()) return
const videoFile = await VideoFileModel.loadWithVideo(instance.videoFileId)
}
return VideoFileModel.sum('size', options as any) // FIXME: typings
+ .then(v => {
+ if (!v || isNaN(v)) return 0
+
+ return v
+ })
}
static async listLocalExpired () {
}))
}
+ isOwned () {
+ return !!this.strategy
+ }
+
toActivityPubObject (): CacheFileObject {
return {
id: this.url,
url: {
type: 'Link',
mimeType: VIDEO_EXT_MIMETYPE[ this.VideoFile.extname ] as any,
+ mediaType: VIDEO_EXT_MIMETYPE[ this.VideoFile.extname ] as any,
href: this.fileUrl,
height: this.VideoFile.resolution,
size: this.VideoFile.size,