Discovery scores AniList seeds with slot mix and isAdult filter (BL-0051)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MaashkinoozheandClaude Opus 5.5 committed 2026-10-25 09:07:53 +01:00
1 parent 552a599475
commit 5de5eb6a08
4 files changed
+515 -48

No files matched your search

+5 -1
View File
@@ -5,6 +5,7 @@ const fs = require('node:fs');
const path = require('node:path');
const { loadCatalog } = require('../greatest');
const { generate } = require('./engine');
const { DiscoveryCache } = require('./cache');
if (!process.argv.includes('--dry-run')) {
console.error('Usage: node discovery/cli.js run --dry-run [--data DIR] [--catalog FILE] [--show]');
@@ -17,7 +18,10 @@ let library = [];
try { library = JSON.parse(fs.readFileSync(path.join(data, 'library-index.json'), 'utf8')).mangas || []; }
catch (error) { if (error.code !== 'ENOENT') throw error; }
const greatest = loadCatalog(arg('--catalog', path.join(__dirname, '..', 'greatest', 'catalog.json')));
const result = generate({ db, library, greatest, cacheDir: path.join(data, 'scraper', 'metadata', 'anilist') });
// The harvest cache is only read here (get/list, never put); note get/list still drop a corrupt entry file.
const harvestDir = path.join(data, 'discovery-cache');
const harvestCache = fs.existsSync(harvestDir) ? new DiscoveryCache(harvestDir) : null;
const result = generate({ db, library, greatest, cacheDir: path.join(data, 'scraper', 'metadata', 'anilist'), harvestCache });
const summary = { examined: result.examined, candidates: Object.keys(result.candidates).length,
optedInUsers: Object.values(db.users || {}).filter(u => u.settings?.discoveryEnabled).length,
feedSizes: Object.values(result.feeds).filter(f => !f.disabled).map(f => f.items.length) };