forked from Supositware/Haha-Yes
remove the variable "files" and use "mp4" instead
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
6da1ba9cfb
commit
4891189daf
1 changed files with 5 additions and 5 deletions
|
@ -186,18 +186,18 @@ class ytpCommand extends Command {
|
||||||
// Read userVid folder and select random vid and only take .mp4
|
// Read userVid folder and select random vid and only take .mp4
|
||||||
let mp4 = [];
|
let mp4 = [];
|
||||||
let asset = [];
|
let asset = [];
|
||||||
let files = fs.readdirSync('./asset/ytp/userVid/');
|
|
||||||
// Count number of total vid
|
// Count number of total vid
|
||||||
files.forEach(file => {
|
fs.readdirSync('./asset/ytp/userVid/').forEach(file => {
|
||||||
if (file.endsWith('mp4')) {
|
if (file.endsWith('mp4')) {
|
||||||
mp4.push(file);
|
mp4.push(file);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Select random vid depending on the amount of MAX_CLIPS
|
// Select random vid depending on the amount of MAX_CLIPS
|
||||||
for (let i = 0; i < MAX_CLIPS; i++) {
|
for (let i = 0; i < MAX_CLIPS; i++) {
|
||||||
let random = Math.floor(Math.random() * files.length);
|
let random = Math.floor(Math.random() * mp4.length);
|
||||||
let vid = `./asset/ytp/userVid/${files[random]}`;
|
let vid = `./asset/ytp/userVid/${mp4[random]}`;
|
||||||
if (files[random].endsWith('mp4')) {
|
if (mp4[random].endsWith('mp4')) {
|
||||||
if (!asset.includes(vid)) {
|
if (!asset.includes(vid)) {
|
||||||
asset.push(vid);
|
asset.push(vid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue