#!/bin/bash #Kompas ePaper Downloader #by: Ardianto Satriawan #ditambahkan oleh Andrian Dion P. #need wget and imagemagick #sudo apt-get install wget imagemagick if `dpkg -l | awk {'print $2'} | grep -q wget`; then $(exit 0) else sudo apt-get install wget fi ###checking imagemagick package if `dpkg -l | awk {'print $2'} | grep -q imagemagick`; then $(exit 0) else sudo apt-get install imagemagick fi if `dpkg -l | awk {'print $2'} | grep -q imagemagick`; then $(exit 0) else sudo apt-get install imagemagick fi ###checking gs package if `dpkg -l | awk {'print $2'} | grep -q gs`; then $(exit 0) else sudo apt-get install gs fi ###checking pdftk package if `dpkg -l | awk {'print $2'} | grep -q pdftk`; then $(exit 0) else sudo apt-get install pdftk fi #get today's date TODAY=$(date +%d-%b-%Y) #create todays directory mkdir $TODAY #wget for jpg PAGE=1 until [ $PAGE -gt 9 ]; do wget "http://data.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page000000"$PAGE"_print.jpg" let PAGE+=1 done PAGE=10 until [ $PAGE -gt 44 ]; do wget "http://data.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page00000"$PAGE"_print.jpg" let PAGE=PAGE+1 done #move to today's directory mv ./*.jpg ./$TODAY #converting into PDFs echo "converting into PDF" convert ./$TODAY/*.jpg ./$TODAY/Kompas-$TODAY.pdf echo "done" #removing JPEGs echo "removing JPEGs" rm ./$TODAY/*.jpg