Added nowplaying alias, update lava-xm-plugin, only require natives when processing images locally, reimplement cache limit
This commit is contained in:
parent
3d97811f20
commit
1cafef76d7
6 changed files with 15 additions and 13 deletions
|
@ -16,7 +16,7 @@ class TimedMap extends Map {
|
|||
|
||||
export const runningCommands = new TimedMap();
|
||||
|
||||
/*class Cache extends Map {
|
||||
class Cache extends Map {
|
||||
constructor(values) {
|
||||
super(values);
|
||||
this.maxValues = 2048;
|
||||
|
@ -26,8 +26,8 @@ export const runningCommands = new TimedMap();
|
|||
super.set(key, value);
|
||||
if (this.size > this.maxValues) this.delete(this.keys().next().value);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
export const prefixCache = new Map();
|
||||
export const disabledCache = new Map();
|
||||
export const disabledCmdCache = new Map();
|
||||
export const prefixCache = new Cache();
|
||||
export const disabledCache = new Cache();
|
||||
export const disabledCmdCache = new Cache();
|
|
@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
|
|||
const nodeRequire = createRequire(import.meta.url);
|
||||
|
||||
const relPath = `../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`;
|
||||
const magick = nodeRequire(relPath);
|
||||
const img = nodeRequire(relPath);
|
||||
|
||||
const enumMap = {
|
||||
"forget": 0,
|
||||
|
@ -33,7 +33,7 @@ export default function run(object) {
|
|||
});
|
||||
promise = request(object.path).then(res => res.body.arrayBuffer()).then(buf => Buffer.from(buf));
|
||||
}
|
||||
// Convert from a MIME type (e.g. "image/png") to something ImageMagick understands (e.g. "png").
|
||||
// Convert from a MIME type (e.g. "image/png") to something the image processor understands (e.g. "png").
|
||||
// Don't set `type` directly on the object we are passed as it will be read afterwards.
|
||||
// If no image type is given (say, the command generates its own image), make it a PNG.
|
||||
const fileExtension = object.params.type ? object.params.type.split("/")[1] : "png";
|
||||
|
@ -47,7 +47,7 @@ export default function run(object) {
|
|||
}
|
||||
objectWithFixedType.basePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "../");
|
||||
try {
|
||||
const result = magick[object.cmd](objectWithFixedType);
|
||||
const result = img[object.cmd](objectWithFixedType);
|
||||
const returnObject = {
|
||||
buffer: result.data,
|
||||
fileExtension: result.type
|
||||
|
|
|
@ -11,7 +11,9 @@ import EventEmitter from "events";
|
|||
|
||||
// only requiring this to work around an issue regarding worker threads
|
||||
const nodeRequire = createRequire(import.meta.url);
|
||||
nodeRequire(`../../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
|
||||
if (process.env.API_TYPE === "none") {
|
||||
nodeRequire(`../../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
|
||||
}
|
||||
|
||||
import ImageConnection from "../imageConnection.js";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue