feat: Add levels to pack

master
ogomez-at-wiris 2022-02-25 05:07:15 +01:00
parent 4451979a47
commit ddbd9e8303
2 changed files with 6 additions and 0 deletions

View File

@ -4,5 +4,6 @@ interface Pack {
name: string;
bpm: string;
files: File[];
levels: number;
}
export default Pack;

View File

@ -25,6 +25,7 @@ export default class PackService {
let files: File[] = [];
const name = packName;
let bpm: string = "";
let levels = 0;
// Setup walk
const noDots = (entry: fsWalk.Entry) => !entry.name.startsWith(".");
@ -44,6 +45,9 @@ export default class PackService {
if (file.name === "bpm.txt") {
bpm = await fs.readFileSync(file.path).toString();
}
if (file.name.includes('music')) {
levels++;
}
})
);
@ -55,6 +59,7 @@ export default class PackService {
name: name,
bpm: bpm,
files: files,
levels: levels,
};
return currentPack;