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; name: string;
bpm: string; bpm: string;
files: File[]; files: File[];
levels: number;
} }
export default Pack; export default Pack;

View File

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