Add per-kind stats, GIF hover playback, and static gif previews
This commit is contained in:
@@ -476,34 +476,4 @@ export class ScrapeStore {
|
||||
return rows as unknown as MediaRow[];
|
||||
}
|
||||
|
||||
/** Counts for the status row, under the same filters as queryMedia. */
|
||||
stats(options: MediaFilterOptions = {}): {
|
||||
total: number;
|
||||
downloaded: number;
|
||||
cached: number;
|
||||
notDownloaded: number;
|
||||
} {
|
||||
const { where, values } = this.mediaWhere(options);
|
||||
const row = this.db
|
||||
.prepare(
|
||||
`SELECT COUNT(*) AS total,
|
||||
COALESCE(SUM(downloaded), 0) AS downloaded,
|
||||
COALESCE(SUM(CASE WHEN downloaded = 0 AND preview_hash IS NOT NULL THEN 1 ELSE 0 END), 0) AS cached,
|
||||
COALESCE(SUM(CASE WHEN downloaded = 0 THEN 1 ELSE 0 END), 0) AS not_downloaded
|
||||
FROM media ${where}`
|
||||
)
|
||||
.get(...values) as unknown as {
|
||||
total: number;
|
||||
downloaded: number;
|
||||
cached: number;
|
||||
not_downloaded: number;
|
||||
};
|
||||
|
||||
return {
|
||||
total: row?.total ?? 0,
|
||||
downloaded: row?.downloaded ?? 0,
|
||||
cached: row?.cached ?? 0,
|
||||
notDownloaded: row?.not_downloaded ?? 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user