mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-29 23:46:57 +08:00
Add export_ad settings for export_zip task
This commit is contained in:
@@ -14,6 +14,7 @@ export const handler: Handlers = {
|
||||
const cfg: ExportZipConfig = {};
|
||||
cfg.jpn_title = await parse_bool(params.get("jpn_title"), false);
|
||||
cfg.max_length = await parse_int(params.get("max_length"), 0);
|
||||
cfg.export_ad = await parse_bool(params.get("export_ad"), false);
|
||||
const m = get_task_manager();
|
||||
return get_export_zip_response(gid, m.db, cfg);
|
||||
},
|
||||
|
||||
@@ -50,6 +50,8 @@ export function get_export_zip_response(
|
||||
const maxLength = cfg.max_length || 0;
|
||||
const download_task = async (p: PMeta) => {
|
||||
const f = db.get_files(p.token);
|
||||
const t = db.get_filemeta(p.token);
|
||||
if (t && t.is_ad && !cfg.export_ad) return;
|
||||
if (f.length) {
|
||||
const r = await Deno.readFile(f[0].path, { signal });
|
||||
await zip_writer.add(
|
||||
|
||||
@@ -16,6 +16,7 @@ export type ExportZipConfig = {
|
||||
output?: string;
|
||||
jpn_title?: boolean;
|
||||
max_length?: number;
|
||||
export_ad?: boolean;
|
||||
};
|
||||
|
||||
export const DEFAULT_EXPORT_ZIP_CONFIG: ExportZipConfig = {};
|
||||
@@ -66,6 +67,12 @@ export async function export_zip(
|
||||
db.get_pmeta(gid).sort((a, b) => a.index - b.index),
|
||||
async (p) => {
|
||||
const f = db.get_files(p.token);
|
||||
const t = db.get_filemeta(p.token);
|
||||
if (t && t.is_ad && !ecfg.export_ad) {
|
||||
progress.total_page -= 1;
|
||||
sendEvent();
|
||||
return;
|
||||
}
|
||||
if (f.length) {
|
||||
const r = await Deno.readFile(f[0].path, { signal });
|
||||
await z.add(
|
||||
|
||||
Reference in New Issue
Block a user