Run the title catch-up in its own YouTube lane
This commit is contained in:
@@ -538,6 +538,10 @@ export class ScrapeStore {
|
||||
failed: number;
|
||||
/** YouTube-like rows still missing a title. */
|
||||
titlePending: number;
|
||||
/** Rows with a stored title. */
|
||||
titled: number;
|
||||
/** Rows closed out without a title. */
|
||||
titleFailed: number;
|
||||
byKind: Record<MediaKind, { total: number; pending: number; cached: number; failed: number }>;
|
||||
} {
|
||||
const empty = () => ({ total: 0, pending: 0, cached: 0, failed: 0 });
|
||||
@@ -583,15 +587,24 @@ export class ScrapeStore {
|
||||
|
||||
const titles = this.db
|
||||
.prepare(
|
||||
`SELECT COUNT(*) AS count FROM media
|
||||
WHERE title IS NULL AND title_error IS NULL
|
||||
AND (lower(COALESCE(provider, '')) LIKE '%youtube%'
|
||||
OR lower(url) LIKE '%youtube.com/%'
|
||||
OR lower(url) LIKE '%youtu.be/%')`
|
||||
`SELECT
|
||||
SUM(title IS NULL AND title_error IS NULL
|
||||
AND (lower(COALESCE(provider, '')) LIKE '%youtube%'
|
||||
OR lower(url) LIKE '%youtube.com/%'
|
||||
OR lower(url) LIKE '%youtu.be/%')) AS pending,
|
||||
SUM(title IS NOT NULL) AS titled,
|
||||
SUM(title IS NULL AND title_error IS NOT NULL) AS failed
|
||||
FROM media`
|
||||
)
|
||||
.get() as { count: number | null } | undefined;
|
||||
.get() as { pending: number | null; titled: number | null; failed: number | null } | undefined;
|
||||
|
||||
return { ...totals, titlePending: titles?.count ?? 0, byKind };
|
||||
return {
|
||||
...totals,
|
||||
titlePending: titles?.pending ?? 0,
|
||||
titled: titles?.titled ?? 0,
|
||||
titleFailed: titles?.failed ?? 0,
|
||||
byKind
|
||||
};
|
||||
}
|
||||
|
||||
/** Count one transient preview failure and return the new total. */
|
||||
|
||||
Reference in New Issue
Block a user