Add zip compression support

This commit is contained in:
Jeffrey Serio 2024-09-17 22:27:48 -05:00
parent 191192b9a1
commit fe46295b62
2 changed files with 15 additions and 13 deletions

23
afw.py
View File

@ -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}")

View File

@ -2,8 +2,11 @@ with import <nixpkgs> { };
pkgs.mkShellNoCC {
packages = with pkgs; [
python312Packages.docopt
python312Packages.black
python312Packages.beautifulsoup4
python312Packages.docopt
python312Packages.isort
python312Packages.rich
pyright
];
}