Created
March 2, 2019 11:54
-
-
Save pSub/54087c3b0c5f779b1350b1a7f7565ca8 to your computer and use it in GitHub Desktop.
Downloads Peppter & Carrort comics and crafts a PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
EPISODE=$1 | |
NUMBER=$2 | |
i=0 | |
while | |
echo $i | |
URL="https://www.peppercarrot.com/0_sources/$EPISODE/hi-res/de_Pepper-and-Carrot_by-David-Revoy_E${NUMBER}P${(l:2::0:)i}.jpg" | |
STATUSCODE=$(curl --silent --remote-name --write-out "%{http_code}" $URL) | |
if test $STATUSCODE -ne 200; then | |
URL="https://www.peppercarrot.com/0_sources/$EPISODE/low-res/de_Pepper-and-Carrot_by-David-Revoy_E${Number}P${(l:2::0:)i}.jpg" | |
STATUSCODE=$(curl --silent --remote-name --write-out "%{http_code}" $URL) | |
fi | |
(( i = i + 1 )) | |
echo $STATUSCODE | |
test $STATUSCODE -eq 200 | |
do :; done | |
convert -rotate 270 -extent 1240x1753 -units PixelsPerInch \ | |
-density 150x150 -gravity center *P00.jpg title-page.pdf | |
convert *P<1-99>.jpg -compress jpeg -resize 1240x1753 \ | |
-extent 1240x1753 -gravity center \ | |
-units PixelsPerInch -density 150x150 story.pdf | |
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="$(basename $PWD).pdf" title-page.pdf story.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An improved version with readily available PDFs can be found at https://github.com/pSub/pepper-and-carrot-pdfs.