refactor: Update function names in repack tracker to use 'savePage' instead of 'saveRepacks'

This commit is contained in:
ChristoferMendes 2024-05-12 20:53:58 -03:00
parent 02417dda40
commit 4616f69a29
6 changed files with 11 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import { JSDOM } from "jsdom";
import { formatUploadDate } from "@main/helpers";
import { Repack } from "@main/entity";
import { requestWebPage, saveRepacks } from "./helpers";
import { requestWebPage, savePage } from "./helpers";
export const request1337x = async (path: string) =>
requestWebPage(`https://1337xx.to${path}`);
@ -114,7 +114,7 @@ export const getNewRepacksFromUser = async (
if (!newRepacks.length) return;
await saveRepacks(newRepacks);
await savePage(newRepacks);
return getNewRepacksFromUser(user, existingRepacks, page + 1);
};

View File

@ -2,7 +2,7 @@ import { JSDOM } from "jsdom";
import { Repack } from "@main/entity";
import { requestWebPage, saveRepacks } from "./helpers";
import { requestWebPage, savePage } from "./helpers";
import { logger } from "../logger";
import type { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
@ -58,7 +58,7 @@ export const getNewRepacksFromCPG = async (
if (!newRepacks.length) return;
await saveRepacks(newRepacks);
await savePage(newRepacks);
return getNewRepacksFromCPG(existingRepacks, page + 1);
};

View File

@ -1,5 +1,5 @@
import { JSDOM, VirtualConsole } from "jsdom";
import { requestWebPage, saveRepacks } from "./helpers";
import { requestWebPage, savePage } from "./helpers";
import { Repack } from "@main/entity";
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
@ -66,6 +66,6 @@ export const getNewGOGGames = async (existingRepacks: Repack[] = []) => {
}
}
if (repacks.length) await saveRepacks(repacks);
if (repacks.length) await savePage(repacks);
}
};

View File

@ -5,7 +5,7 @@ import { repackRepository } from "@main/repository";
import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";
export const saveRepacks = async (repacks: QueryDeepPartialEntity<Repack>[]) =>
export const savePage = async (repacks: QueryDeepPartialEntity<Repack>[]) =>
Promise.all(
repacks.map((repack) => repackRepository.insert(repack).catch(() => {}))
);

View File

@ -1,5 +1,5 @@
import { Repack } from "@main/entity";
import { decodeNonUtf8Response, saveRepacks } from "./helpers";
import { decodeNonUtf8Response, savePage } from "./helpers";
import { logger } from "../logger";
import parseTorrent, {
toMagnetURI,
@ -179,7 +179,7 @@ export const getNewRepacksFromOnlineFix = async (
if (!newRepacks.length) return;
if (page === totalPages) return;
await saveRepacks(newRepacks);
await savePage(newRepacks);
return getNewRepacksFromOnlineFix(existingRepacks, page + 1, cookieJar);
};

View File

@ -2,7 +2,7 @@ import { JSDOM } from "jsdom";
import { Repack } from "@main/entity";
import { logger } from "../logger";
import { requestWebPage, saveRepacks } from "./helpers";
import { requestWebPage, savePage } from "./helpers";
import createWorker from "@main/workers/torrent-parser.worker?nodeWorker";
import { toMagnetURI } from "parse-torrent";
@ -91,7 +91,7 @@ export const getNewRepacksFromXatab = async (
if (!newRepacks.length) return;
await saveRepacks(newRepacks);
await savePage(newRepacks);
return getNewRepacksFromXatab(existingRepacks, page + 1);
};