diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:22:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 14:31:40 +0200 |
commit | f4001cf408a99049d01a356bfb20a62342de06ea (patch) | |
tree | 421776dfe64335dca2725ac3ac5f3b3e6b7564c6 /server/models/video/video-caption.ts | |
parent | 16f7022b06fb76c0b00c23c970bc8df605b0ec63 (diff) | |
download | PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.gz PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.tar.zst PeerTube-f4001cf408a99049d01a356bfb20a62342de06ea.zip |
Handle .srt subtitles
Diffstat (limited to 'server/models/video/video-caption.ts')
-rw-r--r-- | server/models/video/video-caption.ts | 14 |
1 files changed, 9 insertions, 5 deletions
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<VideoCaptionModel> { | |||
75 | 75 | ||
76 | @BeforeDestroy | 76 | @BeforeDestroy |
77 | static async removeFiles (instance: VideoCaptionModel) { | 77 | static async removeFiles (instance: VideoCaptionModel) { |
78 | if (!instance.Video) { | ||
79 | instance.Video = await instance.$get('Video') as VideoModel | ||
80 | } | ||
78 | 81 | ||
79 | if (instance.isOwned()) { | 82 | if (instance.isOwned()) { |
80 | if (!instance.Video) { | ||
81 | instance.Video = await instance.$get('Video') as VideoModel | ||
82 | } | ||
83 | |||
84 | logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) | 83 | logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) |
85 | return instance.removeCaptionFile() | 84 | |
85 | try { | ||
86 | await instance.removeCaptionFile() | ||
87 | } catch (err) { | ||
88 | logger.error('Cannot remove caption file of video %s.', instance.Video.uuid) | ||
89 | } | ||
86 | } | 90 | } |
87 | 91 | ||
88 | return undefined | 92 | return undefined |