1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

First implem global search

This commit is contained in:
Chocobozzz 2020-05-29 16:16:24 +02:00 committed by Chocobozzz
parent 62e7be634b
commit 5fb2e2888c
54 changed files with 1052 additions and 331 deletions

View file

@ -272,11 +272,22 @@ async function getOrCreateVideoAndAccountAndChannel (
const actor = await getOrCreateVideoChannelFromVideoObject(fetchedVideo)
const videoChannel = actor.VideoChannel
const { autoBlacklisted, videoCreated } = await retryTransactionWrapper(createVideo, fetchedVideo, videoChannel, syncParam.thumbnail)
await syncVideoExternalAttributes(videoCreated, fetchedVideo, syncParam)
try {
const { autoBlacklisted, videoCreated } = await retryTransactionWrapper(createVideo, fetchedVideo, videoChannel, syncParam.thumbnail)
return { video: videoCreated, created: true, autoBlacklisted }
await syncVideoExternalAttributes(videoCreated, fetchedVideo, syncParam)
return { video: videoCreated, created: true, autoBlacklisted }
} catch (err) {
// Maybe a concurrent getOrCreateVideoAndAccountAndChannel call created this video
if (err.name === 'SequelizeUniqueConstraintError') {
const fallbackVideo = await fetchVideoByUrl(videoUrl, fetchType)
if (fallbackVideo) return { video: fallbackVideo, created: false }
}
throw err
}
}
async function updateVideoFromAP (options: {