Fixed type definition of SongCursorInfos fixed 'race conditions' in asset generation service removed hard coded cursor infos fixed tsc looking to build folders
This commit is contained in:
@@ -157,12 +157,6 @@ export async function generateSongAssets(
|
||||
eval(`import("cross-blob")`).then((module) => {
|
||||
Blob = module.default;
|
||||
});
|
||||
try {
|
||||
let e = require("canvas")
|
||||
console.log(e, "pass");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
debug("" + sampleDir + " " + imageDir + " " + imageFormat);
|
||||
|
||||
if (!mode) {
|
||||
|
||||
@@ -5,12 +5,24 @@ import { generateSongAssets } from "src/assetsgenerator/generateImages_browserle
|
||||
|
||||
@Injectable()
|
||||
export class SongService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
// number is the song id
|
||||
private readonly assetCreationTasks: Map<number, Promise<void>>;
|
||||
constructor(private prisma: PrismaService) {
|
||||
this.assetCreationTasks = new Map();
|
||||
}
|
||||
|
||||
async createAssets(mxlPath: string, songId: number): Promise<void> {
|
||||
if (this.assetCreationTasks.has(songId)) {
|
||||
await this.assetCreationTasks.get(songId);
|
||||
this.assetCreationTasks.delete(songId);
|
||||
return;
|
||||
}
|
||||
// mxlPath can the path to an archive to an xml file or the path to the xml file directly
|
||||
// const generateSongAssets = (await import("src/assetsgenerator/generateImages_browserless.mjs")).default;
|
||||
return generateSongAssets(songId, mxlPath, "/data/cache/songs", "svg");
|
||||
this.assetCreationTasks.set(
|
||||
songId,
|
||||
generateSongAssets(songId, mxlPath, "/data/cache/songs", "svg"),
|
||||
);
|
||||
return await this.assetCreationTasks.get(songId);
|
||||
}
|
||||
|
||||
async songByArtist(data: number): Promise<Song[]> {
|
||||
|
||||
Reference in New Issue
Block a user