|
|
|
|
@@ -68,7 +68,7 @@ func New(cfg Config, novel scraper.NovelScraper, store bookstore.BookWriter, log
|
|
|
|
|
// Returns a ScrapeResult with counters. The result's ErrorMessage is non-empty
|
|
|
|
|
// if the run failed at the metadata or chapter-list level.
|
|
|
|
|
func (o *Orchestrator) RunBook(ctx context.Context, task domain.ScrapeTask) domain.ScrapeResult {
|
|
|
|
|
o.log.Info("orchestrator: RunBook starting",
|
|
|
|
|
o.log.Debug("orchestrator: RunBook starting",
|
|
|
|
|
"task_id", task.ID,
|
|
|
|
|
"kind", task.Kind,
|
|
|
|
|
"url", task.TargetURL,
|
|
|
|
|
@@ -103,7 +103,7 @@ func (o *Orchestrator) RunBook(ctx context.Context, task domain.ScrapeTask) doma
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.log.Info("metadata saved", "slug", meta.Slug, "title", meta.Title)
|
|
|
|
|
o.log.Debug("metadata saved", "slug", meta.Slug, "title", meta.Title)
|
|
|
|
|
|
|
|
|
|
// ── Step 2: Chapter list ──────────────────────────────────────────────────
|
|
|
|
|
refs, err := o.novel.ScrapeChapterList(ctx, task.TargetURL, task.ToChapter)
|
|
|
|
|
@@ -114,7 +114,7 @@ func (o *Orchestrator) RunBook(ctx context.Context, task domain.ScrapeTask) doma
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.log.Info("chapter list fetched", "slug", meta.Slug, "chapters", len(refs))
|
|
|
|
|
o.log.Debug("chapter list fetched", "slug", meta.Slug, "chapters", len(refs))
|
|
|
|
|
|
|
|
|
|
// Persist chapter refs (without text) so the index exists early.
|
|
|
|
|
if wErr := o.store.WriteChapterRefs(ctx, meta.Slug, refs); wErr != nil {
|
|
|
|
|
|