Skip to content

Instantly share code, notes, and snippets.

@pSub
Created March 2, 2019 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pSub/54087c3b0c5f779b1350b1a7f7565ca8 to your computer and use it in GitHub Desktop.
Save pSub/54087c3b0c5f779b1350b1a7f7565ca8 to your computer and use it in GitHub Desktop.
Downloads Peppter & Carrort comics and crafts a PDF
#!/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
@pSub
Copy link
Author

pSub commented Feb 3, 2023

An improved version with readily available PDFs can be found at https://github.com/pSub/pepper-and-carrot-pdfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment