From f4001cf408a99049d01a356bfb20a62342de06ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Jul 2018 14:22:16 +0200 Subject: Handle .srt subtitles --- server/models/video/video-caption.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/models') diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 9920dfc7c..5a1becc47 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -75,14 +75,18 @@ export class VideoCaptionModel extends Model { @BeforeDestroy static async removeFiles (instance: VideoCaptionModel) { + if (!instance.Video) { + instance.Video = await instance.$get('Video') as VideoModel + } if (instance.isOwned()) { - if (!instance.Video) { - instance.Video = await instance.$get('Video') as VideoModel - } - logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) - return instance.removeCaptionFile() + + try { + await instance.removeCaptionFile() + } catch (err) { + logger.error('Cannot remove caption file of video %s.', instance.Video.uuid) + } } return undefined -- cgit v1.2.3