From 6c6b071375beeefc5caccc717d66c645fc07fba0 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Tue, 7 Dec 2021 14:22:49 +0100 Subject: [PATCH] Add script to convert manga into cbz. --- arch-config/scripts/pieces/manga-cbz.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 arch-config/scripts/pieces/manga-cbz.sh diff --git a/arch-config/scripts/pieces/manga-cbz.sh b/arch-config/scripts/pieces/manga-cbz.sh new file mode 100755 index 00000000..61370606 --- /dev/null +++ b/arch-config/scripts/pieces/manga-cbz.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ $# -ne 1 ]; then + echo "Please use this script with a \"PATH\" to a folder containing Manga chapters" + $(exit 1); echo "$?" +fi + +dir=$1 + +cd "$dir" + +# "-not -name \." so the top directory isn't shown +readarray -d '' chapters < <(find . -type d -not -name \. -print0) + +for directory in "${chapters[@]}"; do + echo $directory + zip -9 -r "$directory.zip" "$directory" + mv "$directory.zip" "$directory.cbz" +done