27 lines
801 B
JavaScript
27 lines
801 B
JavaScript
import * as dotenv from 'dotenv'
|
|
dotenv.config()
|
|
|
|
import fs from 'fs'
|
|
import { setupInputs, setupThumbnail, setupThumbnailVideo } from './src/utils.js'
|
|
|
|
const hostnames = process.env.IPLOL_HOSTNAMES?.split(',')??[]
|
|
|
|
async function build() {
|
|
if (hostnames.length == 0) {
|
|
throw new Error('Specify hostnames for build with the IPLOL_HOSTNAMES environment variable')
|
|
}
|
|
await setupInputs()
|
|
await fs.promises.mkdir('build', { recursive: true, })
|
|
for (let hostname of hostnames) {
|
|
if (!fs.existsSync(`build/thumb-${hostname}.png`)) {
|
|
console.log(`Generating thumbnail for ${hostname}`)
|
|
await setupThumbnail(hostname)
|
|
}
|
|
if (!fs.existsSync(`build/thumb-${hostname}.mp4`)) {
|
|
console.log(`Generating thumbnail video for ${hostname}`)
|
|
await setupThumbnailVideo(hostname)
|
|
}
|
|
}
|
|
}
|
|
|
|
build() |