mirror of
https://gitlab.com/vyla-entertainment/sdk.git
synced 2026-11-16 15:17:28 -05:00
organized/fixed streams
This commit is contained in:
@@ -18,7 +18,7 @@ const CONFIG = {
|
||||
TEST_SUBTITLE: false,
|
||||
TEST_DOWNLOAD: false,
|
||||
TEST_MOVIE: true,
|
||||
TEST_TV: true,
|
||||
TEST_TV: false,
|
||||
TEST_MANGA: false,
|
||||
MANGA_QUERY: "Steel Ball Run",
|
||||
|
||||
@@ -32,7 +32,7 @@ dotenv.config({
|
||||
});
|
||||
|
||||
// debug
|
||||
if (CONFIG.DEBUG) {
|
||||
if (CONFIG.DEBUG && !process.argv.includes("all")) {
|
||||
const originalFetch = globalThis.fetch;
|
||||
|
||||
const debugFile = path.resolve("test/debug-output.json");
|
||||
@@ -118,6 +118,45 @@ const sdk = new VylaSDK({
|
||||
...CONFIG.EXTRA_SDK_PARAMS
|
||||
});
|
||||
|
||||
if (process.argv.includes("all")) {
|
||||
const sources = sdk.getSources(true);
|
||||
console.log(`Testing ${sources.length} sources in parallel...\n`);
|
||||
|
||||
const results = {};
|
||||
const failed = [];
|
||||
|
||||
await Promise.all(
|
||||
sources.map(async (cfg) => {
|
||||
try {
|
||||
const res = await sdk.probeSource(cfg.key);
|
||||
results[cfg.key] = res;
|
||||
if (res?.ok) {
|
||||
console.log(`[PASS] ${cfg.key} (${res.ms}ms)`);
|
||||
} else {
|
||||
failed.push(cfg.key);
|
||||
console.log(`[FAIL] ${cfg.key} (${res?.ms ?? 0}ms)`);
|
||||
}
|
||||
} catch (err) {
|
||||
results[cfg.key] = { ok: false, ms: null, error: err.message };
|
||||
failed.push(cfg.key);
|
||||
console.log(`[FAIL] ${cfg.key} (${err.message})`);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
console.log(`\nFinished testing. Total: ${sources.length}, Passed: ${sources.length - failed.length}, Failed: ${failed.length}`);
|
||||
console.log("Sources that returned nothing:", failed);
|
||||
|
||||
const debugFile = path.resolve("test/debug-output.json");
|
||||
fs.mkdirSync(path.dirname(debugFile), { recursive: true });
|
||||
fs.writeFileSync(debugFile, JSON.stringify({
|
||||
sourcesThatReturnedNothing: failed,
|
||||
results
|
||||
}, null, 2));
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log("Starting...");
|
||||
|
||||
if (CONFIG.TEST_SUBTITLE && CONFIG.TEST_TV) {
|
||||
|
||||
Reference in New Issue
Block a user