feat: adding icon parser to download notification

This commit is contained in:
Chubby Granny Chaser 2024-06-05 20:15:59 +01:00
parent 6b8ab895e3
commit 4a4a800b07
No known key found for this signature in database
17 changed files with 343 additions and 146 deletions

View file

@ -1,12 +1,14 @@
import { DownloadManager, RepacksManager, startMainLoop } from "./services";
import {
downloadQueueRepository,
repackRepository,
userPreferencesRepository,
} from "./repository";
import { UserPreferences } from "./entity";
import { RealDebridClient } from "./services/real-debrid";
import { fetchDownloadSourcesAndUpdate } from "./helpers";
import { publishNewRepacksNotifications } from "./services/notifications";
import { MoreThan } from "typeorm";
startMainLoop();
@ -30,8 +32,16 @@ const loadState = async (userPreferences: UserPreferences | null) => {
if (nextQueueItem?.game.status === "active")
DownloadManager.startDownload(nextQueueItem.game);
fetchDownloadSourcesAndUpdate().then(() => {
publishNewRepacksNotifications(300);
const now = new Date();
fetchDownloadSourcesAndUpdate().then(async () => {
const newRepacksCount = await repackRepository.count({
where: {
createdAt: MoreThan(now),
},
});
if (newRepacksCount > 0) publishNewRepacksNotifications(newRepacksCount);
});
};