From 48665ba389922ea373c3541cea0f3752a93494d1 Mon Sep 17 00:00:00 2001 From: RealStickman Date: Tue, 10 May 2022 15:07:05 +0200 Subject: [PATCH] Add handling of cover.jpeg when epub was exported from calibre --- arch-config/scripts/pieces/manga-extract-epub.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch-config/scripts/pieces/manga-extract-epub.sh b/arch-config/scripts/pieces/manga-extract-epub.sh index ce587c6f..dc652b61 100755 --- a/arch-config/scripts/pieces/manga-extract-epub.sh +++ b/arch-config/scripts/pieces/manga-extract-epub.sh @@ -24,11 +24,16 @@ rm -rf "$outdir" unzip "$dir" -d "$outdir" # 2. images under "(folder name)/OEBPS/image" -mv "$outdir/OEBPS/image/"* "$outdir/" +#mv "$outdir/OEBPS/image/"* "$outdir/" +mv "$outdir/images/"* "$outdir/" # 3. delete folders "META-INF", "OEBPS" and file "mimetype" -rm -r "$outdir/"{META-INF,OEBPS,mimetype} +rm -rf "$outdir/"{META-INF,OEBPS,mimetype,images,text,content.opf,page_styles.css,stylesheet.css,titlepage.xhtml,toc.ncx} # 4. rename images to "pageXXX.(ext)" cd "$outdir" +# if cover.jpg exists, rename it to be the first page +if [ -f cover.jpg ] || [ -f cover.jpeg ]; then + mv cover.* 0000000000.jpg +fi ls | cat -n | while read n f; do mv "$f" `printf "page%03d.jpg" $n`; done