add rating system
This commit is contained in:
@@ -153,6 +153,10 @@ export async function scanComicsLibrary(
|
||||
coverUrl,
|
||||
filePath: c.relPath,
|
||||
isStandalone: c.isStandalone,
|
||||
userRating: null,
|
||||
aiDescription: null,
|
||||
extractedText: null,
|
||||
extractedTextTranslated: null,
|
||||
}
|
||||
|
||||
if (c.isStandalone) {
|
||||
@@ -166,6 +170,10 @@ export async function scanComicsLibrary(
|
||||
coverUrl, // first issue (sorted) becomes the series cover
|
||||
issueCount: 0,
|
||||
issues: [],
|
||||
userRating: null,
|
||||
aiDescription: null,
|
||||
extractedText: null,
|
||||
extractedTextTranslated: null,
|
||||
})
|
||||
}
|
||||
const series = seriesMap.get(key)!
|
||||
@@ -201,6 +209,10 @@ export function comicsFromDb(
|
||||
title: string | null
|
||||
metadata: string | null
|
||||
file_path: string | null
|
||||
user_rating: number | null
|
||||
ai_description: string | null
|
||||
extracted_text: string | null
|
||||
extracted_text_translated: string | null
|
||||
}
|
||||
|
||||
const baseWhere = `
|
||||
@@ -216,17 +228,20 @@ export function comicsFromDb(
|
||||
.prepare(`SELECT COUNT(*) as cnt FROM media_items ${baseWhere}`)
|
||||
.get(libraryId) as { cnt: number }).cnt
|
||||
|
||||
const cols = `item_key, item_type, parent_key, title, metadata, file_path,
|
||||
user_rating, ai_description, extracted_text, extracted_text_translated`
|
||||
|
||||
const rows: DbRow[] = opts.search
|
||||
? db
|
||||
.prepare(
|
||||
`SELECT item_key, item_type, parent_key, title, metadata, file_path
|
||||
`SELECT ${cols}
|
||||
FROM media_items ${baseWhere} AND title LIKE ? ESCAPE '\\'
|
||||
ORDER BY title LIMIT ? OFFSET ?`
|
||||
)
|
||||
.all(libraryId, escapeLike(opts.search), opts.pageSize, offset) as DbRow[]
|
||||
: db
|
||||
.prepare(
|
||||
`SELECT item_key, item_type, parent_key, title, metadata, file_path
|
||||
`SELECT ${cols}
|
||||
FROM media_items ${baseWhere}
|
||||
ORDER BY title LIMIT ? OFFSET ?`
|
||||
)
|
||||
@@ -243,6 +258,10 @@ export function comicsFromDb(
|
||||
title: row.title ?? decodeURIComponent(idPart),
|
||||
coverUrl: meta.coverUrl ?? null,
|
||||
issueCount: meta.issueCount ?? 0,
|
||||
userRating: row.user_rating ?? null,
|
||||
aiDescription: row.ai_description ?? null,
|
||||
extractedText: row.extracted_text ?? null,
|
||||
extractedTextTranslated: row.extracted_text_translated ?? null,
|
||||
} as ComicSeries)
|
||||
} else {
|
||||
const idPart = row.item_key.split(':comic_issue:')[1] ?? row.item_key
|
||||
@@ -255,6 +274,10 @@ export function comicsFromDb(
|
||||
coverUrl: meta.coverUrl ?? null,
|
||||
filePath: row.file_path ?? '',
|
||||
isStandalone: meta.isStandalone ?? true,
|
||||
userRating: row.user_rating ?? null,
|
||||
aiDescription: row.ai_description ?? null,
|
||||
extractedText: row.extracted_text ?? null,
|
||||
extractedTextTranslated: row.extracted_text_translated ?? null,
|
||||
} as ComicIssue)
|
||||
}
|
||||
}
|
||||
@@ -271,11 +294,16 @@ export function comicIssuesFromDb(libraryId: string, seriesId: string): ComicIss
|
||||
title: string | null
|
||||
metadata: string | null
|
||||
file_path: string | null
|
||||
user_rating: number | null
|
||||
ai_description: string | null
|
||||
extracted_text: string | null
|
||||
extracted_text_translated: string | null
|
||||
}
|
||||
|
||||
const rows = db
|
||||
.prepare(
|
||||
`SELECT item_key, title, metadata, file_path
|
||||
`SELECT item_key, title, metadata, file_path,
|
||||
user_rating, ai_description, extracted_text, extracted_text_translated
|
||||
FROM media_items
|
||||
WHERE parent_key = ? AND item_type = 'comic_issue'`
|
||||
)
|
||||
@@ -293,6 +321,10 @@ export function comicIssuesFromDb(libraryId: string, seriesId: string): ComicIss
|
||||
coverUrl: meta.coverUrl ?? null,
|
||||
filePath: row.file_path ?? '',
|
||||
isStandalone: false,
|
||||
userRating: row.user_rating ?? null,
|
||||
aiDescription: row.ai_description ?? null,
|
||||
extractedText: row.extracted_text ?? null,
|
||||
extractedTextTranslated: row.extracted_text_translated ?? null,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user