diff options
Diffstat (limited to 'shared/server-commands/videos')
-rw-r--r-- | shared/server-commands/videos/live.ts | 9 |
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 @@ | |||
1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' | 1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' |
2 | import { truncate } from 'lodash' | ||
2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' | 3 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' |
3 | import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' | 4 | import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' |
4 | import { PeerTubeServer } from '../server/server' | 5 | import { 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 | ||
110 | export { | 117 | export { |