aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-29 08:57:19 +0200
committerChocobozzz <me@florianbigard.com>2023-06-29 09:08:13 +0200
commitae22c59f14d0d553f60b281948b6c232c2aca178 (patch)
tree4d3b38ebcf7ff27966233b381e980a34112e943e /shared/server-commands/videos
parentba278fa51dc578835c7fcb3a6eca4cd8cd86c755 (diff)
downloadPeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.tar.gz
PeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.tar.zst
PeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.zip
Fix broken replay with long live video name
Diffstat (limited to 'shared/server-commands/videos')
-rw-r--r--shared/server-commands/videos/live.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts
index 48464fb61..cebadb1db 100644
--- a/shared/server-commands/videos/live.ts
+++ b/shared/server-commands/videos/live.ts
@@ -1,4 +1,5 @@
1import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' 1import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
2import { truncate } from 'lodash'
2import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' 3import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
3import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' 4import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models'
4import { PeerTubeServer } from '../server/server' 5import { PeerTubeServer } from '../server/server'
@@ -104,7 +105,13 @@ async function findExternalSavedVideo (server: PeerTubeServer, liveDetails: Vide
104 105
105 const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include, privacyOneOf }) 106 const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include, privacyOneOf })
106 107
107 return data.find(v => v.name === liveDetails.name + ' - ' + new Date(liveDetails.publishedAt).toLocaleString()) 108 const videoNameSuffix = ` - ${new Date(liveDetails.publishedAt).toLocaleString()}`
109 const truncatedVideoName = truncate(liveDetails.name, {
110 length: 120 - videoNameSuffix.length
111 })
112 const toFind = truncatedVideoName + videoNameSuffix
113
114 return data.find(v => v.name === toFind)
108} 115}
109 116
110export { 117export {