adding playlist id when playlist downloading

This commit is contained in:
unknown 2023-03-10 15:20:56 +01:00
parent ce7ce93c9c
commit 2949b33286
3 changed files with 5 additions and 4 deletions

View File

@ -160,7 +160,7 @@ exports.playlist = async (ws, req) => {
ws.send(`DATA - Uploaded ${video.title}`) ws.send(`DATA - Uploaded ${video.title}`)
fs.unlinkSync(`./videos/${id}.webm`) fs.unlinkSync(`./videos/${id}.webm`)
await websocket.createDatabaseVideo(id, videoUrl) await websocket.createDatabaseVideo(id, videoUrl, playlistId)
ws.send(`DATA - Created video page for ${video.title}`) ws.send(`DATA - Created video page for ${video.title}`)
} else { } else {
ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`) ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`)

View File

@ -12,7 +12,7 @@ datasource db {
model videos { model videos {
uuid String @id @default(uuid()) uuid String @id @default(uuid())
id String id String @unique
title String title String
description String description String
thumbnail String thumbnail String

View File

@ -4,7 +4,7 @@ const prisma = new PrismaClient()
const metadata = require('./metadata.js') const metadata = require('./metadata.js')
const upload = require('./upload.js') const upload = require('./upload.js')
async function createDatabaseVideo(id, videoUrl) { async function createDatabaseVideo(id, videoUrl, playlistId) {
const instance = await metadata.getInstance() const instance = await metadata.getInstance()
const data = await metadata.getVideoMetadata(instance, id) const data = await metadata.getVideoMetadata(instance, id)
const uploaderAvatar = await upload.uploadImage((data.uploaderUrl).replace('/channel/', ''), data.uploaderAvatar) const uploaderAvatar = await upload.uploadImage((data.uploaderUrl).replace('/channel/', ''), data.uploaderAvatar)
@ -22,7 +22,8 @@ async function createDatabaseVideo(id, videoUrl) {
channel: data.uploader, channel: data.uploader,
channelId: (data.uploaderUrl).replace('/channel/', ''), channelId: (data.uploaderUrl).replace('/channel/', ''),
channelAvatar: uploaderAvatar, channelAvatar: uploaderAvatar,
channelVerified: data.uploaderVerified channelVerified: data.uploaderVerified,
playlist: playlistId
} }
}) })