diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-08 11:07:19 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-08 11:07:19 +0100 |
commit | 9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 (patch) | |
tree | 3419e23d551937f716612f93747f58f2d381d310 /server/controllers/api/videos | |
parent | a23f6c94edee1cb11875585a64dc61f1004c1792 (diff) | |
download | PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.gz PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.zst PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.zip |
Update torrent metadata on video update
Diffstat (limited to 'server/controllers/api/videos')
-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 | } | ||