diff options
Diffstat (limited to 'server/models/redundancy')
-rw-r--r-- | server/models/redundancy/video-redundancy.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index c23a9cc17..da1c6f4a7 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { | 1 | import { |
2 | AfterDestroy, | ||
3 | AllowNull, | 2 | AllowNull, |
3 | BeforeDestroy, | ||
4 | BelongsTo, | 4 | BelongsTo, |
5 | Column, | 5 | Column, |
6 | CreatedAt, | 6 | CreatedAt, |
@@ -115,14 +115,16 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> { | |||
115 | }) | 115 | }) |
116 | Actor: ActorModel | 116 | Actor: ActorModel |
117 | 117 | ||
118 | @AfterDestroy | 118 | @BeforeDestroy |
119 | static removeFile (instance: VideoRedundancyModel) { | 119 | static async removeFile (instance: VideoRedundancyModel) { |
120 | // Not us | 120 | // Not us |
121 | if (!instance.strategy) return | 121 | if (!instance.strategy) return |
122 | 122 | ||
123 | logger.info('Removing duplicated video file %s-%s.', instance.VideoFile.Video.uuid, instance.VideoFile.resolution) | 123 | const videoFile = await VideoFileModel.loadWithVideo(instance.videoFileId) |
124 | 124 | ||
125 | return instance.VideoFile.Video.removeFile(instance.VideoFile) | 125 | logger.info('Removing duplicated video file %s-%s.', videoFile.Video.uuid, videoFile.resolution) |
126 | |||
127 | return videoFile.Video.removeFile(videoFile) | ||
126 | } | 128 | } |
127 | 129 | ||
128 | static async loadLocalByFileId (videoFileId: number) { | 130 | static async loadLocalByFileId (videoFileId: number) { |