Add the picked providers and a Must include group
This commit is contained in:
@@ -119,6 +119,10 @@ export interface MediaFilterOptions {
|
||||
excludeProviders?: string[];
|
||||
/** Row sources to hide (attachment, sticker, embed). */
|
||||
excludeSources?: string[];
|
||||
/** Keep only providers matching one of these substrings; empty keeps all. */
|
||||
includeProviders?: string[];
|
||||
/** Keep only these row sources; empty keeps all. */
|
||||
includeSources?: string[];
|
||||
/** Bytes; rows with no known size drop out while this is set. */
|
||||
sizeLessThan?: number;
|
||||
sizeGreaterThan?: number;
|
||||
@@ -609,6 +613,17 @@ export class ScrapeStore {
|
||||
conditions.push(`COALESCE(source, '') NOT IN (${options.excludeSources.map(() => "?").join(", ")})`);
|
||||
values.push(...options.excludeSources);
|
||||
}
|
||||
if (options.includeProviders?.length) {
|
||||
const clauses = options.includeProviders.map(() => "lower(COALESCE(provider, '')) LIKE ?");
|
||||
conditions.push(`(${clauses.join(" OR ")})`);
|
||||
for (const provider of options.includeProviders) {
|
||||
values.push(`%${provider.toLowerCase()}%`);
|
||||
}
|
||||
}
|
||||
if (options.includeSources?.length) {
|
||||
conditions.push(`COALESCE(source, '') IN (${options.includeSources.map(() => "?").join(", ")})`);
|
||||
values.push(...options.includeSources);
|
||||
}
|
||||
if (options.sizeLessThan !== undefined) {
|
||||
conditions.push("COALESCE(file_bytes, size) < ?");
|
||||
values.push(options.sizeLessThan);
|
||||
|
||||
Reference in New Issue
Block a user