]> zdv2.bktei.com Git - BK-2020-03.git/blobdiff - user/htmlz_to_cbz.sh
feat(user/mp3s_to_m4b.sh):Adapt flacs_to_m4b for mp3 input
[BK-2020-03.git] / user / htmlz_to_cbz.sh
index bf535f05f5ca154c646f2fd7a0eff9e6fa102d07..655256302d4c31661751e1ad564f552a479175fa 100755 (executable)
@@ -1,13 +1,13 @@
 #!/bin/bash
 # Desc: Collects .jpg/jpeg files from a Calibre .htmlz file into .cbz files
-# Version: 0.0.1
+# Version: 0.0.3
 
 for fin in ./*.htmlz; do
     (
         dout="${fin%.*}";
         unzip "$fin" -x / -d "$dout";
         pushd "$dout";
-        mapfile -t images < <(cat index.html  | grep -E "(.jpg|.jpeg)" | sed -E -e 's#.+(images/[0-9]+.(jpeg|jpg)).+#\1#');
+        mapfile -t images < <(cat index.html  | grep -E "(.jpg|.jpeg)" | sed -E -e 's#.+(images/[0-9]+.(jpeg|jpg)).+#\1#' | uniq; );
         dout="./output";
         if [[ -d "$dout" ]]; then
             rm -r "$dout";
@@ -26,7 +26,7 @@ for fin in ./*.htmlz; do
         if [[ -f "$faout" ]]; then
             rm "$fout";
         fi;
-        zip -r output.cbz output;
+        zip -j output.cbz output/*;
     ) &
 done;
 wait && echo "STATUS:Finished." 1>&2;