Ajout de la fenetre permettant de selectionner les lightshow voulus

This commit is contained in:
Quentin Millardet
2024-01-28 01:31:10 +01:00
parent 854cb672df
commit 62820d9181
9 changed files with 79 additions and 84 deletions

View File

@@ -1,17 +1,11 @@
const { PrismaClient } = require('@prisma/client')
const fs = require('fs')
require('dotenv').config();
const prisma = new PrismaClient()
const usbLightshow = process.env.LIGHTSHOW_DIR || '';
class LigthshowService{
async getAllLigthshow() {
const posts = await prisma.Lightshow.findMany({
})
return posts;
}
//
// createLigthshow(ligthshow) {
@@ -60,7 +54,20 @@ class LigthshowService{
}
return filename;
}
getAllLigthshow() {
let lightshows = [];
let files = fs.readdirSync(usbLightshow);
files.forEach(function (file) {
// Do whatever you want to do with the file
let lightshowName = file.split('.')[0];
if (!lightshows.includes(lightshowName) && lightshowName){
lightshows.push(lightshowName)
}
});
return lightshows;
}
}
module.exports = LigthshowService
module.exports = LigthshowService