1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Fix broken replay with long live video name

This commit is contained in:
Chocobozzz 2023-06-29 08:57:19 +02:00
parent ba278fa51d
commit ae22c59f14
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 17 additions and 3 deletions

View file

@ -1,4 +1,5 @@
import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
import { truncate } from 'lodash'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'
import { PeerTubeServer } from '../server/server'
@ -104,7 +105,13 @@ async function findExternalSavedVideo (server: PeerTubeServer, liveDetails: Vide
const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include, privacyOneOf })
return data.find(v => v.name === liveDetails.name + ' - ' + new Date(liveDetails.publishedAt).toLocaleString())
const videoNameSuffix = ` - ${new Date(liveDetails.publishedAt).toLocaleString()}`
const truncatedVideoName = truncate(liveDetails.name, {
length: 120 - videoNameSuffix.length
})
const toFind = truncatedVideoName + videoNameSuffix
return data.find(v => v.name === toFind)
}
export {