From ae22c59f14d0d553f60b281948b6c232c2aca178 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Jun 2023 08:57:19 +0200 Subject: Fix broken replay with long live video name --- server/lib/job-queue/handlers/video-live-ending.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/lib') diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 814f313a3..49feb53f2 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts @@ -20,6 +20,8 @@ import { MVideo, MVideoLive, MVideoLiveSession, MVideoWithAllFiles } from '@serv import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@shared/ffmpeg' import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' import { logger, loggerTagsFactory } from '../../../helpers/logger' +import { peertubeTruncate } from '@server/helpers/core-utils' +import { CONSTRAINTS_FIELDS } from '@server/initializers/constants' const lTags = loggerTagsFactory('live', 'job') @@ -88,8 +90,13 @@ async function saveReplayToExternalVideo (options: { const replaySettings = await VideoLiveReplaySettingModel.load(liveSession.replaySettingId) + const videoNameSuffix = ` - ${new Date(publishedAt).toLocaleString()}` + const truncatedVideoName = peertubeTruncate(liveVideo.name, { + length: CONSTRAINTS_FIELDS.VIDEOS.NAME.max - videoNameSuffix.length + }) + const replayVideo = new VideoModel({ - name: `${liveVideo.name} - ${new Date(publishedAt).toLocaleString()}`, + name: truncatedVideoName + videoNameSuffix, isLive: false, state: VideoState.TO_TRANSCODE, duration: 0, -- cgit v1.2.3