From 1a6a7607721b055e101c23bb02b9d3bc403200c7 Mon Sep 17 00:00:00 2001 From: Mr Mysterius Date: Fri, 3 Feb 2023 11:48:41 +0000 Subject: [PATCH 1/2] feat: added flag for enabling the archiving/compressing --- download.ts | 5 +++-- main.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/download.ts b/download.ts index 8b1d7f4..59c63c3 100644 --- a/download.ts +++ b/download.ts @@ -93,7 +93,8 @@ export async function download( chapters: Chapter[], start: Chapter, end: Chapter, - current: Chapter | null = null + current: Chapter | null = null, + archive = true ) { const BASE_FOLDER_PATH = join(folder_path, mangaIndexName); Deno.mkdirSync(BASE_FOLDER_PATH, { recursive: true }); @@ -128,7 +129,7 @@ export async function download( Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |")} ${Color.yellow("Writing Metadata")}`)); if (!writeComicInfo(CHAPTER_PATH, metadata, current, pages)) return false; Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |")} ${Color.magenta("Archiving")}`)); - if (!(await archive(CHAPTER_PATH, `${CHAPTER_PATH}.cb7`))) return false; + if (archive && !(await archive(CHAPTER_PATH, `${CHAPTER_PATH}.cb7`))) return false; Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |\n")}`)); if (chapter.raw == end.raw) break; diff --git a/main.ts b/main.ts index d0ef5f9..5c0b8e3 100644 --- a/main.ts +++ b/main.ts @@ -116,7 +116,8 @@ switch (ARGS._[0] || undefined) { console.log(Color.gray("\n----------------------------------------")); - await download(ARGS._[1] as string, metadata.basic, Deno.cwd(), metadata.chapters, start, end, current); + const archive = ARGS.c || ARGS['compress'] || false; + await download(ARGS._[1] as string, metadata.basic, Deno.cwd(), metadata.chapters, start, end, current, archive); console.log(Color.green("# Finished Download #")); From 4c348848b68a359f93ce6255efcbb4d590f6cfe5 Mon Sep 17 00:00:00 2001 From: Mr Mysterius Date: Fri, 3 Feb 2023 11:59:11 +0000 Subject: [PATCH 2/2] fix: overlapping variable name in download function --- download.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.ts b/download.ts index 59c63c3..06f9b0d 100644 --- a/download.ts +++ b/download.ts @@ -94,7 +94,7 @@ export async function download( start: Chapter, end: Chapter, current: Chapter | null = null, - archive = true + doArchive = true ) { const BASE_FOLDER_PATH = join(folder_path, mangaIndexName); Deno.mkdirSync(BASE_FOLDER_PATH, { recursive: true }); @@ -129,7 +129,7 @@ export async function download( Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |")} ${Color.yellow("Writing Metadata")}`)); if (!writeComicInfo(CHAPTER_PATH, metadata, current, pages)) return false; Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |")} ${Color.magenta("Archiving")}`)); - if (archive && !(await archive(CHAPTER_PATH, `${CHAPTER_PATH}.cb7`))) return false; + if (doArchive && !(await archive(CHAPTER_PATH, `${CHAPTER_PATH}.cb7`))) return false; Deno.stdout.write(new TextEncoder().encode(`${Color.white(" Done |\n")}`)); if (chapter.raw == end.raw) break;