Init commit

This commit is contained in:
ShreejitPanchal
2026-05-19 19:56:02 +08:00
commit 6601501eff
4047 changed files with 2185372 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { VideoImportPayload, VideoImportState, VideoImportYoutubeDLPayload } from '@peertube/peertube-models'
import { CONFIG } from '@server/initializers/config.js'
import { MVideoImport } from '@server/types/models/video/video-import.js'
export async function buildRetryImportJob (videoImport: MVideoImport) {
let type: VideoImportPayload['type']
if (videoImport.magnetUri) type = 'magnet-uri'
else if (videoImport.torrentName) type = 'torrent-file'
else type = 'youtube-dl'
const payload: VideoImportPayload = {
type: videoImport.payload?.type ?? type,
videoImportId: videoImport.id,
// If part of a sync process, there is a parent job that will aggregate children results
preventException: videoImport.payload?.preventException ?? !!videoImport.videoChannelSyncId,
generateTranscription: videoImport.payload?.generateTranscription ?? CONFIG.VIDEO_TRANSCRIPTION.ENABLED,
fileExt: (videoImport.payload as VideoImportYoutubeDLPayload)?.fileExt
}
videoImport.state = VideoImportState.PENDING
await videoImport.save()
return { type: 'video-import' as const, payload }
}