mirror of
https://codeberg.org/hyperreal/archive-fandom-wiki
synced 2024-11-25 09:33:41 +01:00
Add zip compression support
This commit is contained in:
parent
191192b9a1
commit
fe46295b62
23
afw.py
23
afw.py
@ -226,24 +226,23 @@ class FandomWiki:
|
|||||||
|
|
||||||
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
with console.status("Archiving images...", spinner="aesthetic"):
|
with console.status("tar.gzipping downloaded files...", 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"):
|
|
||||||
shutil.make_archive(
|
shutil.make_archive(
|
||||||
f"{self.name}-{timestamp}",
|
f"{self.name}-{timestamp}",
|
||||||
"gztar",
|
"gztar",
|
||||||
root_dir=self.archive_rootdir,
|
root_dir=self.archive_rootdir,
|
||||||
base_dir=self.canonical_name,
|
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"\nTotal web files archived: {total_web_files}")
|
||||||
console.log(f"Total images archived: {total_image_files}")
|
console.log(f"Total images archived: {total_image_files}")
|
||||||
|
@ -2,8 +2,11 @@ with import <nixpkgs> { };
|
|||||||
|
|
||||||
pkgs.mkShellNoCC {
|
pkgs.mkShellNoCC {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
python312Packages.docopt
|
python312Packages.black
|
||||||
python312Packages.beautifulsoup4
|
python312Packages.beautifulsoup4
|
||||||
|
python312Packages.docopt
|
||||||
|
python312Packages.isort
|
||||||
python312Packages.rich
|
python312Packages.rich
|
||||||
|
pyright
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user