Skip to content

Commit

Permalink
feat: added flag for enabling the archiving/compressing
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMysterius committed Feb 3, 2023
1 parent 1dc4e4e commit 1a6a760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 #"));

Expand Down

0 comments on commit 1a6a760

Please sign in to comment.