+ for (const videoShare of videoShares) {
+ if (videoShare.Video.isOwned() === false) continue
+
+ console.log('Updating video share ' + videoShare.url)
+
+ videoShare.url = getVideoAnnounceActivityPubUrl(videoShare.Actor, videoShare.Video)
+ await videoShare.save()
+ }
+
+ console.log('Updating video comments.')
+ const videoComments: VideoCommentModel[] = await VideoCommentModel.findAll({
+ include: [
+ {
+ model: VideoModel.unscoped()
+ },
+ {
+ model: AccountModel.unscoped(),
+ include: [
+ {
+ model: ActorModel.unscoped()
+ }
+ ]
+ }
+ ]
+ })
+ for (const comment of videoComments) {
+ if (comment.isOwned() === false) continue
+
+ console.log('Updating comment ' + comment.url)
+
+ comment.url = getVideoCommentActivityPubUrl(comment.Video, comment)
+ await comment.save()
+ }
+
+ console.log('Updating video and torrent files.')
+
+ const videos = await VideoModel.listLocal()
+ for (const video of videos) {
+ console.log('Updating video ' + video.uuid)
+
+ video.url = getVideoActivityPubUrl(video)
+ await video.save()
+
+ for (const file of video.VideoFiles) {
+ console.log('Updating torrent file %s of video %s.', file.resolution, video.uuid)
+ await createTorrentAndSetInfoHash(video, file)
+ }
+
+ for (const playlist of video.VideoStreamingPlaylists) {
+ playlist.playlistUrl = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsMasterPlaylistStaticPath(video.uuid)
+ playlist.segmentsSha256Url = WEBSERVER.URL + VideoStreamingPlaylistModel.getHlsSha256SegmentsStaticPath(video.uuid)
+
+ await playlist.save()
+ }
+ }
+}