import { VideoTranscodingPayload } from '../../../lib/job-queue/handlers/video-transcoding'
import { Hooks } from '../../../lib/plugins/hooks'
import { MVideoDetails, MVideoFullLight } from '@server/typings/models'
+import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
+import { getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
const auditLogger = auditLoggerFactory('videos')
const videosRouter = express.Router()
category: videoInfo.category,
licence: videoInfo.licence,
language: videoInfo.language,
- commentsEnabled: videoInfo.commentsEnabled || false,
- downloadEnabled: videoInfo.downloadEnabled !== false, // If the value is not "false", the default is "true"
+ commentsEnabled: videoInfo.commentsEnabled !== false, // If the value is not "false", the default is "true"
+ downloadEnabled: videoInfo.downloadEnabled !== false,
waitTranscoding: videoInfo.waitTranscoding || false,
state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED,
nsfw: videoInfo.nsfw || false,
const videoFile = new VideoFileModel({
extname: extname(videoPhysicalFile.filename),
- size: videoPhysicalFile.size
+ size: videoPhysicalFile.size,
+ videoStreamingPlaylistId: null
})
if (videoFile.isAudio()) {
}
// Move physical file
- const videoDir = CONFIG.STORAGE.VIDEOS_DIR
- const destination = join(videoDir, video.getVideoFilename(videoFile))
+ const destination = getVideoFilePath(video, videoFile)
await move(videoPhysicalFile.path, destination)
// This is important in case if there is another attempt in the retry process
- videoPhysicalFile.filename = video.getVideoFilename(videoFile)
+ videoPhysicalFile.filename = getVideoFilePath(video, videoFile)
videoPhysicalFile.path = destination
// Process thumbnail or create it from the video
: await generateVideoMiniature(video, videoFile, ThumbnailType.PREVIEW)
// Create the torrent file
- await video.createTorrentAndSetInfoHash(videoFile)
+ await createTorrentAndSetInfoHash(video, videoFile)
const { videoCreated } = await sequelizeTypescript.transaction(async t => {
const sequelizeOptions = { transaction: t }