feat(ddownload): resolve metadata before queueing
Inspect public ddownload.com and ddl.to links before download startup to resolve canonical filenames, exact sizes and availability without consuming a debrid account. Keep removed files offline, protected pages retryable, restored queues recheckable and previously resolved names safe from later download.bin responses. Reuse the metadata path in the link collector, queue import and direct DDownload login flow.
This commit is contained in:
@@ -62,11 +62,11 @@ describe("collector inspection", () => {
|
||||
"https://example.com/a",
|
||||
"https://example.com/a",
|
||||
"# Package: Staffel B",
|
||||
"https://example.com/b"
|
||||
"https://example.com/abcdef1234567890abcdef12"
|
||||
].join("\n");
|
||||
|
||||
const result = await inspectCollectorText({ rawText, addedAt: 2000 }, defaultSettings(), {
|
||||
resolveFilenames: async () => new Map([["https://example.com/b", "episode.part02.rar"]])
|
||||
resolveFilenames: async () => new Map([["https://example.com/abcdef1234567890abcdef12", "episode.part02.rar"]])
|
||||
});
|
||||
|
||||
expect(result.packages.map((pkg) => pkg.name)).toEqual(["Staffel A", "Staffel B"]);
|
||||
@@ -100,6 +100,34 @@ describe("collector inspection", () => {
|
||||
}));
|
||||
});
|
||||
|
||||
it("resolves DDownload metadata before grouping without using a debrid account", async () => {
|
||||
const link = "https://ddownload.com/ntwscdw62gyb";
|
||||
let genericResolverCalls = 0;
|
||||
const result = await inspectCollectorText({ rawText: link, addedAt: 3500 }, defaultSettings(), {
|
||||
checkDdownload: async () => ({
|
||||
online: true,
|
||||
fileName: "SBS14HD.part02.rar",
|
||||
fileSizeBytes: 526_385_152
|
||||
}),
|
||||
resolveFilenames: async () => {
|
||||
genericResolverCalls += 1;
|
||||
return new Map();
|
||||
}
|
||||
});
|
||||
|
||||
expect(genericResolverCalls).toBe(0);
|
||||
expect(result.packages).toHaveLength(1);
|
||||
expect(result.packages[0].name).toBe("SBS14HD");
|
||||
expect(result.packages[0].links).toEqual([expect.objectContaining({
|
||||
url: link,
|
||||
fileName: "SBS14HD.part02.rar",
|
||||
fileSizeBytes: 526_385_152,
|
||||
hoster: "ddownload",
|
||||
availability: "online",
|
||||
status: "ready"
|
||||
})]);
|
||||
});
|
||||
|
||||
it("infers archive package names and serializes inspected metadata for the existing queue parser", () => {
|
||||
expect(inferCollectorPackageName("SBS14HD.part01.rar", "1fichier")).toBe("SBS14HD");
|
||||
expect(inferCollectorPackageName("Archive.7z.001", "1fichier")).toBe("Archive");
|
||||
|
||||
Reference in New Issue
Block a user