Deduplicate media across scrapes and polish the viewer controls
This commit is contained in:
@@ -59,8 +59,10 @@ export interface ScrapeEngineOptions {
|
||||
download?: DownloadOptions;
|
||||
/** Cache Discord-hosted image previews after every walk. Default true. */
|
||||
previews?: boolean;
|
||||
/** Read dimensions from a downloaded file. Defaults to ffprobe. */
|
||||
probe?: (path: string) => Promise<{ width: number; height: number } | null>;
|
||||
/** Read dimensions and duration from a downloaded file. Defaults to ffprobe. */
|
||||
probe?: (
|
||||
path: string
|
||||
) => Promise<{ width: number | null; height: number | null; durationSecs: number | null } | null>;
|
||||
/** Called when a scrape fails. */
|
||||
onError?: (scrapeId: string, message: string) => void;
|
||||
}
|
||||
@@ -320,11 +322,11 @@ export class ScrapeEngine {
|
||||
});
|
||||
meta.downloaded = (meta.downloaded ?? 0) + 1;
|
||||
|
||||
if (row.width === null || row.height === null) {
|
||||
const dimensions = await (this.options.probe ?? probeDimensions)(
|
||||
if (row.width === null || row.height === null || row.duration_secs === null) {
|
||||
const info = await (this.options.probe ?? probeDimensions)(
|
||||
join(targetDir, outcome.path)
|
||||
);
|
||||
if (dimensions) store.updateDimensions(row.id, dimensions.width, dimensions.height);
|
||||
if (info) store.updateMediaInfo(row.id, info);
|
||||
}
|
||||
|
||||
if (row.kind === "video" && !row.preview_hash) {
|
||||
|
||||
Reference in New Issue
Block a user