diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/videos/update.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 3fcff3e86..6f14a6788 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { Transaction } from 'sequelize/types' | 2 | import { Transaction } from 'sequelize/types' |
3 | import { updateTorrentMetadata } from '@server/helpers/webtorrent' | ||
3 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' | 4 | import { changeVideoChannelShare } from '@server/lib/activitypub/share' |
4 | import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' | 5 | import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' |
5 | import { openapiOperationDoc } from '@server/middlewares/doc' | 6 | import { openapiOperationDoc } from '@server/middlewares/doc' |
@@ -149,9 +150,8 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
149 | return videoInstanceUpdated | 150 | return videoInstanceUpdated |
150 | }) | 151 | }) |
151 | 152 | ||
152 | if (wasConfidentialVideo) { | 153 | if (videoInfoToUpdate.name) await updateTorrentsMetadata(videoInstanceUpdated) |
153 | Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated) | 154 | if (wasConfidentialVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated) |
154 | } | ||
155 | 155 | ||
156 | Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res }) | 156 | Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res }) |
157 | } catch (err) { | 157 | } catch (err) { |
@@ -199,3 +199,9 @@ function updateSchedule (videoInstance: MVideoFullLight, videoInfoToUpdate: Vide | |||
199 | return ScheduleVideoUpdateModel.deleteByVideoId(videoInstance.id, transaction) | 199 | return ScheduleVideoUpdateModel.deleteByVideoId(videoInstance.id, transaction) |
200 | } | 200 | } |
201 | } | 201 | } |
202 | |||
203 | async function updateTorrentsMetadata (video: MVideoFullLight) { | ||
204 | for (const file of video.getAllFiles()) { | ||
205 | await updateTorrentMetadata(video, file) | ||
206 | } | ||
207 | } | ||