-async function saveLive (video: MVideo, live: MVideoLive) {
- const hlsDirectory = getHLSDirectory(video, false)
- const replayDirectory = join(hlsDirectory, VIDEO_LIVE.REPLAY_DIRECTORY)
+async function saveReplayToExternalVideo (options: {
+ liveVideo: MVideo
+ liveSession: MVideoLiveSession
+ publishedAt: string
+ replayDirectory: string
+}) {
+ const { liveVideo, liveSession, publishedAt, replayDirectory } = options
+
+ const video = new VideoModel({
+ name: `${liveVideo.name} - ${new Date(publishedAt).toLocaleString()}`,
+ isLive: false,
+ state: VideoState.TO_TRANSCODE,
+ duration: 0,
+
+ remote: liveVideo.remote,
+ category: liveVideo.category,
+ licence: liveVideo.licence,
+ language: liveVideo.language,
+ commentsEnabled: liveVideo.commentsEnabled,
+ downloadEnabled: liveVideo.downloadEnabled,
+ waitTranscoding: true,
+ nsfw: liveVideo.nsfw,
+ description: liveVideo.description,
+ support: liveVideo.support,
+ privacy: liveVideo.privacy,
+ channelId: liveVideo.channelId
+ }) as MVideoWithAllFiles
+
+ video.Thumbnails = []
+ video.VideoFiles = []
+ video.VideoStreamingPlaylists = []
+
+ video.url = getLocalVideoActivityPubUrl(video)