they're actually mp4s

This commit is contained in:
localhost 2024-03-30 14:55:10 +01:00
parent 7bacd174f6
commit 11c7a7b47f
4 changed files with 10 additions and 10 deletions

View File

@ -80,8 +80,8 @@ exports.save = async (ws, req) => {
const file = fs.readdirSync("videos").find(f => f.includes(id)) const file = fs.readdirSync("videos").find(f => f.includes(id))
if (file) { if (file) {
ws.send('DATA - Uploading file...') ws.send('DATA - Uploading file...')
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`) const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
fs.unlinkSync(`./videos/${id}.webm`) fs.unlinkSync(`./videos/${id}.mp4`)
await websocket.createDatabaseVideo(id, videoUrl) await websocket.createDatabaseVideo(id, videoUrl)
@ -178,9 +178,9 @@ exports.playlist = async (ws, req) => {
ws.send(`DATA - Downloaded ${video.title}`) ws.send(`DATA - Downloaded ${video.title}`)
ws.send(`DATA - Uploading ${video.title}`) ws.send(`DATA - Uploading ${video.title}`)
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`) const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
ws.send(`DATA - Uploaded ${video.title}`) ws.send(`DATA - Uploaded ${video.title}`)
fs.unlinkSync(`./videos/${id}.webm`) fs.unlinkSync(`./videos/${id}.mp4`)
await websocket.createDatabaseVideo(id, videoUrl, playlistId) await websocket.createDatabaseVideo(id, videoUrl, playlistId)
ws.send(`DATA - Created video page for ${video.title}`) ws.send(`DATA - Created video page for ${video.title}`)
@ -276,9 +276,9 @@ exports.channel = async (ws, req) => {
ws.send(`DATA - Downloaded ${video.title}`) ws.send(`DATA - Downloaded ${video.title}`)
ws.send(`DATA - Uploading ${video.title}`) ws.send(`DATA - Uploading ${video.title}`)
const videoUrl = await upload.uploadVideo(`./videos/${id}.webm`) const videoUrl = await upload.uploadVideo(`./videos/${id}.mp4`)
ws.send(`DATA - Uploaded ${video.title}`) ws.send(`DATA - Uploaded ${video.title}`)
fs.unlinkSync(`./videos/${id}.webm`) fs.unlinkSync(`./videos/${id}.mp4`)
await websocket.createDatabaseVideo(id, videoUrl) await websocket.createDatabaseVideo(id, videoUrl)
ws.send(`DATA - Created video page for ${video.title}`) ws.send(`DATA - Created video page for ${video.title}`)

View File

@ -18,9 +18,9 @@ redis.on('ready', async function () {
setInterval(async () => { setInterval(async () => {
const files = fs.readdirSync('videos') const files = fs.readdirSync('videos')
const webmFiles = files.filter((file) => file.endsWith('.webm')) const webmFiles = files.filter((file) => file.endsWith('.mp4'))
webmFiles.forEach(async (f) => { webmFiles.forEach(async (f) => {
const videoId = f.replace('.webm', '') const videoId = f.replace('.mp4', '')
const isActive = await redis.get(videoId) const isActive = await redis.get(videoId)
if (!isActive) { if (!isActive) {
fs.unlinkSync(`./videos/${f}`) fs.unlinkSync(`./videos/${f}`)

View File

@ -18,7 +18,7 @@ async function uploadVideo(video) {
Bucket: key.bucket, Bucket: key.bucket,
Key: video.split('/')[2], Key: video.split('/')[2],
Body: videoFile, Body: videoFile,
ContentType: 'video/webm', ContentType: 'video/mp4',
}).promise() }).promise()
return uploaded.Location return uploaded.Location

View File

@ -28,7 +28,7 @@ async function downloadVideo(url, ws, id) {
let prevBytes = 0 let prevBytes = 0
let speed = 0 let speed = 0
const alreadyPrecentages = [] const alreadyPrecentages = []
const download = wget.download(downloadJson.url, `./videos/${id}.webm`) const download = wget.download(downloadJson.url, `./videos/${id}.mp4`)
download.on('start', fileSize => { download.on('start', fileSize => {
size = fileSize size = fileSize