1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Generate random uuid for video files

This commit is contained in:
Chocobozzz 2021-07-22 14:28:03 +02:00 committed by Chocobozzz
parent c4fa01f7c4
commit 83903cb65d
27 changed files with 366 additions and 268 deletions

View file

@ -14,7 +14,7 @@ import { HLS_STREAMING_PLAYLIST_DIRECTORY, P2P_MEDIA_LOADER_PEER_VERSION, WEBSER
import { VideoFileModel } from '../../models/video/video-file'
import { VideoStreamingPlaylistModel } from '../../models/video/video-streaming-playlist'
import { updateMasterHLSPlaylist, updateSha256VODSegments } from '../hls'
import { generateVideoFilename, generateVideoStreamingPlaylistName, getVideoFilePath } from '../video-paths'
import { generateHLSVideoFilename, generateWebTorrentVideoFilename, getVideoFilePath } from '../video-paths'
import { VideoTranscodingProfilesManager } from './video-transcoding-profiles'
/**
@ -60,7 +60,7 @@ async function optimizeOriginalVideofile (video: MVideoFullLight, inputVideoFile
// Important to do this before getVideoFilename() to take in account the new filename
inputVideoFile.extname = newExtname
inputVideoFile.filename = generateVideoFilename(video, false, resolution, newExtname)
inputVideoFile.filename = generateWebTorrentVideoFilename(resolution, newExtname)
const videoOutputPath = getVideoFilePath(video, inputVideoFile)
@ -86,7 +86,7 @@ async function transcodeNewWebTorrentResolution (video: MVideoFullLight, resolut
const newVideoFile = new VideoFileModel({
resolution,
extname,
filename: generateVideoFilename(video, false, resolution, extname),
filename: generateWebTorrentVideoFilename(resolution, extname),
size: 0,
videoId: video.id
})
@ -169,7 +169,7 @@ async function mergeAudioVideofile (video: MVideoFullLight, resolution: VideoRes
// Important to do this before getVideoFilename() to take in account the new file extension
inputVideoFile.extname = newExtname
inputVideoFile.filename = generateVideoFilename(video, false, inputVideoFile.resolution, newExtname)
inputVideoFile.filename = generateWebTorrentVideoFilename(inputVideoFile.resolution, newExtname)
const videoOutputPath = getVideoFilePath(video, inputVideoFile)
// ffmpeg generated a new video file, so update the video duration
@ -271,7 +271,7 @@ async function generateHlsPlaylistCommon (options: {
const videoTranscodedBasePath = join(transcodeDirectory, type)
await ensureDir(videoTranscodedBasePath)
const videoFilename = generateVideoStreamingPlaylistName(video.uuid, resolution)
const videoFilename = generateHLSVideoFilename(resolution)
const playlistFilename = VideoStreamingPlaylistModel.getHlsPlaylistFilename(resolution)
const playlistFileTranscodePath = join(videoTranscodedBasePath, playlistFilename)
@ -319,7 +319,7 @@ async function generateHlsPlaylistCommon (options: {
resolution,
extname,
size: 0,
filename: generateVideoFilename(video, true, resolution, extname),
filename: videoFilename,
fps: -1,
videoStreamingPlaylistId: videoStreamingPlaylist.id
})