-import { JOB_PRIORITY } from '@server/initializers/constants'
-import { VideoModel } from '@server/models/video/video'
import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'
export abstract class AbstractJobBuilder {
videoFile: MVideoFile
isNewVideo: boolean
user: MUserId
+ videoFileAlreadyLocked: boolean
}): Promise<any>
abstract createTranscodingJobs (options: {
isNewVideo: boolean
user: MUserId | null
}): Promise<any>
-
- protected async getTranscodingJobPriority (options: {
- user: MUserId
- fallback: number
- }) {
- const { user, fallback } = options
-
- if (!user) return fallback
-
- const now = new Date()
- const lastWeek = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7)
-
- const videoUploadedByUser = await VideoModel.countVideosUploadedByUserSince(user.id, lastWeek)
-
- return JOB_PRIORITY.TRANSCODING + videoUploadedByUser
- }
}