mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Update torrent metadata on video update
This commit is contained in:
parent
a23f6c94ed
commit
9b293cd6a2
7 changed files with 42 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
|||
import express from 'express'
|
||||
import { Transaction } from 'sequelize/types'
|
||||
import { updateTorrentMetadata } from '@server/helpers/webtorrent'
|
||||
import { changeVideoChannelShare } from '@server/lib/activitypub/share'
|
||||
import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
|
||||
import { openapiOperationDoc } from '@server/middlewares/doc'
|
||||
|
@ -149,9 +150,8 @@ async function updateVideo (req: express.Request, res: express.Response) {
|
|||
return videoInstanceUpdated
|
||||
})
|
||||
|
||||
if (wasConfidentialVideo) {
|
||||
Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated)
|
||||
}
|
||||
if (videoInfoToUpdate.name) await updateTorrentsMetadata(videoInstanceUpdated)
|
||||
if (wasConfidentialVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoInstanceUpdated)
|
||||
|
||||
Hooks.runAction('action:api.video.updated', { video: videoInstanceUpdated, body: req.body, req, res })
|
||||
} catch (err) {
|
||||
|
@ -199,3 +199,9 @@ function updateSchedule (videoInstance: MVideoFullLight, videoInfoToUpdate: Vide
|
|||
return ScheduleVideoUpdateModel.deleteByVideoId(videoInstance.id, transaction)
|
||||
}
|
||||
}
|
||||
|
||||
async function updateTorrentsMetadata (video: MVideoFullLight) {
|
||||
for (const file of video.getAllFiles()) {
|
||||
await updateTorrentMetadata(video, file)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue