aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-08 11:07:19 +0100
committerChocobozzz <me@florianbigard.com>2021-12-08 11:07:19 +0100
commit9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 (patch)
tree3419e23d551937f716612f93747f58f2d381d310 /server/controllers
parenta23f6c94edee1cb11875585a64dc61f1004c1792 (diff)
downloadPeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.gz
PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.tar.zst
PeerTube-9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231.zip
Update torrent metadata on video update
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/update.ts12
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 @@
1import express from 'express' 1import express from 'express'
2import { Transaction } from 'sequelize/types' 2import { Transaction } from 'sequelize/types'
3import { updateTorrentMetadata } from '@server/helpers/webtorrent'
3import { changeVideoChannelShare } from '@server/lib/activitypub/share' 4import { changeVideoChannelShare } from '@server/lib/activitypub/share'
4import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' 5import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
5import { openapiOperationDoc } from '@server/middlewares/doc' 6import { 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
203async function updateTorrentsMetadata (video: MVideoFullLight) {
204 for (const file of video.getAllFiles()) {
205 await updateTorrentMetadata(video, file)
206 }
207}