Last.fm: set default update Interval

This commit is contained in:
amsyarasyiq 2023-02-13 09:05:36 +08:00
parent 021f3f6e16
commit 4abc0c5f59
3 changed files with 7 additions and 7 deletions

View file

@ -55,7 +55,7 @@ for (const plug of plugin ? [plugin] : readdirSync("./plugins")) {
]
};
const watchPlugin = new Promise((resolve, reject) => {
const watchPlugin = new Promise((resolve) => {
const watcher = watch(config);
watcher.on("event", (event) => {
switch (event.code) {
@ -63,22 +63,21 @@ for (const plug of plugin ? [plugin] : readdirSync("./plugins")) {
process.stdout.write(`Building ${plug}... `);
break;
case "BUNDLE_END": {
console.log("\x1b[32m", `Succeed! (${event.duration}ms)`, "\x1b[0m");
const toHash = readFileSync(outPath);
manifest.hash = createHash("sha256").update(toHash).digest("hex");
manifest.main = "index.js";
writeFileSync(`./dist/${plug}/manifest.json`, JSON.stringify(manifest));
process.stdout.write("\x1b[32m" + `Succeed! (${event.duration}ms)` + "\x1b[0m");
console.log();
resolve();
break;
}
case "ERROR":
console.error("\x1b[31m", "Failed! :(", "\x1b[0m");
console.error(event.error);
reject(event.error);
break;
throw event.error;
case "FATAL":
reject(event.error);
process.exit(1);
}
});

View file

@ -1,5 +1,6 @@
const Constants = {
DEFAULT_APP_NAME: "Music",
DEFAULT_TIME_INTERVAL: 5,
/** The application ID of the plugin */
APPLICATION_ID: "1054951789318909972",
/** Last.fm api key */

View file

@ -185,7 +185,7 @@ export async function initialize() {
global.stopped = true;
}
}),
currentSettings.timeInterval
(currentSettings.timeInterval || Constants.DEFAULT_TIME_INTERVAL) * 1000
);
}