ActivityPub-federated video streaming platform using P2P directly in your web browser
Don't replace caption on transcription
Chocobozzz300676f62bb4
diff --git a/packages/tests/src/api/videos/video-transcription.ts b/packages/tests/src/api/videos/video-transcription.tsindex 96d3ab1dc4..f48f2ce32d 100644--- a/packages/tests/src/api/videos/video-transcription.ts+++ b/packages/tests/src/api/videos/video-transcription.ts@@ -146,6 +146,22 @@ describe('Test video transcription', function () {await checkLanguage(servers, uuid, null)})+ it('Should not replace an existing caption', async function () {+ const uuid = await uploadForTranscription(servers[0])++ await servers[0].captions.add({+ language: 'en',+ videoId: uuid,+ fixture: 'subtitle-good1.vtt'+ })++ const contentBefore = await getCaptionContent(servers[0], uuid, 'en')+ await waitJobs(servers)+ const contentAter = await getCaptionContent(servers[0], uuid, 'en')++ expect(contentBefore).to.equal(contentAter)+ })+it('Should run transcription after a video edition', async function () {this.timeout(120000)diff --git a/server/core/lib/video-captions.ts b/server/core/lib/video-captions.tsindex 0741600e3b..724a2da4ff 100644--- a/server/core/lib/video-captions.ts+++ b/server/core/lib/video-captions.ts@@ -154,6 +154,16 @@ export async function onTranscriptionEnded (options: {await video.save()}+ const existing = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language)+ if (existing && !existing.automaticallyGenerated) {+ logger.info(+ // eslint-disable-next-line max-len+ `Do not replace existing caption for video ${video.uuid} after transcription (subtitle may have been added while during the transcription process)`,+ lTags(video.uuid)+ )+ return+ }+const caption = await createLocalCaption({video,language,