feat: update compare achievement response

This commit is contained in:
Zamitto
2024-10-20 14:37:30 -03:00
parent 1d7858438d
commit 33e91e2007
6 changed files with 43 additions and 29 deletions

View File

@@ -11,11 +11,12 @@ import {
import type { AchievementFile } from "@types";
import { achievementsLogger } from "../logger";
import { Cracker } from "@shared";
import { IsNull, Not } from "typeorm";
const fileStats: Map<string, number> = new Map();
const fltFiles: Map<string, Set<string>> = new Map();
export const watchAchievements = async () => {
const watchAchiievementsWindows = async () => {
const games = await gameRepository.find({
where: {
isDeleted: false,
@@ -23,7 +24,6 @@ export const watchAchievements = async () => {
});
if (games.length === 0) return;
const achievementFiles = findAllAchievementFiles();
for (const game of games) {
@@ -36,12 +36,6 @@ export const watchAchievements = async () => {
if (!gameAchievementFiles.length) continue;
// console.log(
// "Achievements files to observe for:",
// game.title,
// gameAchievementFiles
// );
for (const file of gameAchievementFiles) {
compareFile(game, file);
}
@@ -49,6 +43,27 @@ export const watchAchievements = async () => {
}
};
const watchAchievementsWithWine = async () => {
const games = await gameRepository.find({
where: {
isDeleted: false,
winePrefixPath: Not(IsNull()),
},
});
if (games.length === 0) return;
// TODO: watch achievements with wine
};
export const watchAchievements = async () => {
if (process.platform === "win32") {
return watchAchiievementsWindows();
}
watchAchievementsWithWine();
};
const processAchievementFileDiff = async (
game: Game,
file: AchievementFile