// Details of one novel on one source, for the request page: chapter counts (free vs // locked 🔒), latest chapter, author, status, genres, summary and cover. // Usage: node scripts/novel-info.js -> one JSON line import { loadPlugin, print } from './load-plugins.js'; const [pluginId, novelPath] = process.argv.slice(2); if (!pluginId || !novelPath) { console.error('Usage: node scripts/novel-info.js '); process.exit(2); } const plugin = await loadPlugin(pluginId); const novel = await plugin.parseNovel(novelPath); const chapters = novel.chapters || []; const firstLocked = chapters.findIndex(c => c.name.includes('🔒')); print( JSON.stringify({ name: novel.name, cover: novel.cover || null, author: novel.author || null, status: novel.status || null, genres: novel.genres || null, summary: (novel.summary || '').slice(0, 1200), chapters: chapters.length, free: firstLocked < 0 ? chapters.length : firstLocked, latest: chapters.length ? chapters[chapters.length - 1].name : null, }), ); process.exit(0);