From fe46295b623cce972c9a87415f2f53d7f35f7d35 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Tue, 17 Sep 2024 22:27:48 -0500 Subject: [PATCH] Add zip compression support --- afw.py | 23 +++++++++++------------ shell.nix | 5 ++++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/afw.py b/afw.py index 185bb20..0b92593 100755 --- a/afw.py +++ b/afw.py @@ -226,24 +226,23 @@ class FandomWiki: timestamp = datetime.now().strftime("%Y%m%d-%H%M%S") - with console.status("Archiving images...", spinner="aesthetic"): - shutil.make_archive( - "images", - "xztar", - root_dir=self.site_dir, - base_dir="images", - ) - shutil.move("images.tar.xz", self.site_dir) - shutil.rmtree(self.images_dir) - - with console.status("Archiving web files...", spinner="aesthetic"): + with console.status("tar.gzipping downloaded files...", spinner="aesthetic"): shutil.make_archive( f"{self.name}-{timestamp}", "gztar", root_dir=self.archive_rootdir, base_dir=self.canonical_name, ) - shutil.rmtree(self.site_dir) + + with console.status("zipping downloaded files...", spinner="aesthetic"): + shutil.make_archive( + f"{self.name}-{timestamp}", + "zip", + root_dir=self.archive_rootdir, + base_dir=self.canonical_name, + ) + + shutil.rmtree(self.site_dir) console.log(f"\nTotal web files archived: {total_web_files}") console.log(f"Total images archived: {total_image_files}") diff --git a/shell.nix b/shell.nix index c04505b..e6b0776 100644 --- a/shell.nix +++ b/shell.nix @@ -2,8 +2,11 @@ with import { }; pkgs.mkShellNoCC { packages = with pkgs; [ - python312Packages.docopt + python312Packages.black python312Packages.beautifulsoup4 + python312Packages.docopt + python312Packages.isort python312Packages.rich + pyright ]; }