Creates and modifies Project Arrhythmia metadata.lsb files.
🏠 Homepage
npm install pa-meta
import { Metadata, Artist, ... } from "pa-meta";
const { Metadata, Artist, ... } = require("pa-meta");
With default values:
const metadata = new Metadata();
With specified values:
const metadata = new Metadata({
artist: new Artist({
/* ... */
}),
/* ... */
});
With default values:
const artist = new Artist();
With specified values:
const artist = new Artist({
name: "Artist name",
link: "artistLink",
linkType: LinkType.SoundCloud,
});
With default values:
const creator = new Creator();
With specified values:
const creator = new Creator({
steamName: "Name",
steamId: 471736531,
});
With default values:
const song = new Song();
With specified values:
const song = new Song({
title: "Song title",
difficulty: Difficulty.Easy,
description: "Song description",
bpm: 120,
/* ... */
});
With default values:
const beatmap = new Beatmap();
With specified values:
const beatmap = new Beatmap({
dateEdited: new Date() /* OR */ Date.now();
gameVersion: "20.4.4",
workshopID: -1,
/* ... */
});
NOTE: toJson()
and toString()
return serialized values that PA accepts (e.g. steam_name
instead of steamName
).
Setting values:
metadata.artist = new Artist({ ... });
Getting values:
- As class instances
metadata.artist; // [Artist]
- As JSON objects
metadata.artist.toJson(); // { name: "Artist name", ... }
- As JSON strings
metadata.artist.toString(); // "{ name: "Artist name", ... }"
Setting values:
artist.name = "Artist name";
artist.link = "artistLink";
artist.linkType = LinkType.SoundCloud;
Getting:
- Normal values
artist.name; // "Artist name"
artist.link; // "artistLink"
artist.linkType; // 1
- JSON object
artist.toJson(); // { name: "Artist name", ... }
- JSON string
artist.toString(); // "{ name: "Artist name", ... }"
Setting values:
creator.steamName = "Name";
creator.steamId = 0;
Getting:
- Normal values
creator.steamName; // "Name"
creator.steamId; // 0
- JSON object
creator.toJson(); // { steam_name: "Name", ... }
- JSON string
creator.toString(); // "{ steam_name: "Name", ... }"
Setting values:
song.title = "Song title";
song.difficulty = Difficulty.Easy;
song.bpm = 120;
Getting:
- Normal values
song.title; // "Song title"
song.difficulty; // 0
song.description; // "Song description"
song.bpm; // 120
song.previewStart; // 140
song.previewLength; // 60
- JSON object
song.toJson(); // { title: "Song title", ... }
- JSON string
song.toString(); // "{ title: "Song title", ... }"
Setting values:
beatmap.dateEdited = new Date() /* OR */ Date.now();
beatmap.versionNumber = 0;
beatmap.gameVersion = "20.4.4";
Getting:
- Normal values
beatmap.dateEdited; // 2022-01-01T00:00:00.000Z
beatmap.versionNumber; // 0
beatmap.gameVersion; // "20.4.4"
beatmap.workshopID; // -1
beatmap.getDateString(); // "2022-01-01_00.00.00"
- JSON object
beatmap.toJson(); // { date_edited: "2022-01-01_00.00.00", ... }
- JSON string
beatmap.toString(); // "{ date_edited: "2022-01-01_00.00.00", ... }"
You can convert the metadata to a JSON string/object, then write it to a file.
const fs = require("fs");
fs.writeFileSync("metadata.lsb", metadata.toString());
You can read an existing metadata from the string/object.
const { Metadata } = require("pa-meta");
const fs = require("fs");
const jsonString = fs.readFileSync("metadata.lsb", "utf8");
const json = JSON.parse(jsonString);
const metadata = new Metadata();
metadata.fromJson(json);
- Github: @PA-Toolkit
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2023 PA Toolkit.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator