]>
zdv2.bktei.com Git - BK-2020-03.git/blob - user/htmlz_to_cbz.sh
2 # Desc: Collects .jpg/jpeg files from a Calibre .htmlz file into .cbz files
4 # Depends: jdupes 1.27.3
6 for fin
in .
/*.htmlz
; do
9 unzip "$fin" -x / -d "$dout";
11 mapfile
-t images
< <(cat index.html |
grep -E "(.jpg|.jpeg)" |
sed -E -e 's#.+(images/[0-9]+.(jpeg|jpg)).+#\1#' |
uniq; );
13 if [[ -d "$dout" ]]; then
18 for path
in "${images[@]}"; do
19 fnew
="${dout}/$(printf "%06d
" "$n").jpg";
23 # Add cover file if present
24 if [[ -f cover.jpg
]]; then
25 cp -n cover.jpg
"${dout}/000000.jpg";
27 # Remove duplicate images
28 if command -v jdupes
1>/dev
/random
2>&1; then
32 if [[ -f "$faout" ]]; then
35 zip -j output.cbz
"$dout"/*;
38 wait && echo "STATUS:Finished." 1>&2;