
Punjab Kesari
- Details
- Category: ePaper Linux Shell Scripts
- Published on Monday, 17 February 2014 14:53
- Written by Administrator
- Hits: 12243
Punjab Kesari
#!/bin/bash
#Script to download epaper from punjabkesari
#Get user to select edition
############################################
# For Testing purpose only , comment out when not in use
#if false
# then
# echo "Start"
# read x
############################################
cd $HOME/some_directory/scripts/punjabkesari
sleep 1
export TZ=Asia/Calcutta
echo "Punjabkesari NewsPaper script started : $(date)" >> /$HOME/some_directory/mybackup.log
#spider the selected edition using wget to estimate number of pages
#define max incremental page limit
max_spider=100
echo "Estimating number of pages"
#start spider for main editon
for (( j = 1 ; j <= $max_spider; j++ ))
do
#prepend zero to single digits
pageno=`printf "%02d" $j`
echo "Searching for Page $pageno"
I_FILE="https://www.punjabkesari.com/E-Paper/Delhi/lo$j.pdf"
debug=`wget --spider $I_FILE 2>&1`
echo $debug
if [[ $debug =~ .*link!!!.* ]]
then
break
fi
done
clear
#decrement counter
(( j = j - 1 ))
npages_A=$j
echo "Estimating number of pages in supplement"
#start spider for newapaper supplement
for (( j = 1 ; j <= $max_spider; j++ ))
do
#prepend zero to single digits
pageno=`printf "%02d" $j`
echo "Searching for Page $pageno"
I_FILE="https://www.punjabkesari.com/E-Paper/Magzine/adv_$j.pdf"
debug=`wget --spider $I_FILE 2>&1`
echo $debug
if [[ $debug =~ .*link!!!.* ]]
then
break
fi
done
clear
#decrement counter
(( j = j - 1 ))
npages_B=$j
ty_dir="./punjabkesari_delhi_`date +%d``date +%m``date +%Y`"
#mkdir to store individual pages
mkdir $ty_dir
echo "Please be patient..Bandwidth intensive operation starts..;-)"
echo "Downloading Main Paper .. total $npages_A pages"
for (( i = 1 ; i <= npages_A; i++ ))
do
#prepend zero to single digits
pageno=`printf "%02d" $i`
echo "Downloading Page $pageno"
O_FILE="$ty_dir/A$pageno.pdf"
I_FILE="https://www.punjabkesari.com/E-Paper/Delhi/lo$i.pdf"
wget -O $O_FILE $I_FILE
done
echo "Downloading Supplement .. total $npages_B pages"
for (( i = 1 ; i <= npages_B; i++ ))
do
#prepend zero to single digits
pageno=`printf "%02d" $i`
echo "Downloading Page $pageno"
O_FILE="$ty_dir/B$pageno.pdf"
I_FILE="https://www.punjabkesari.com/E-Paper/Magzine/adv_$i.pdf"
wget -O $O_FILE $I_FILE
done
#########################
# break
#fi
#echo "End"
#read x
########################
#intialize local variables here for testing only, comment out when not in use
########################
echo "Combining all pages into a single pdf document"
#combine multiple pdf files
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=punjabkesari_delhi_`date +%d``date +%b``date +%Y`.pdf -dBATCH $ty_dir/*
mv punjabkesari_delhi_`date +%d``date +%b``date +%Y`.pdf $HOME/some_directory/epapersPDF-ZIP/Hindi
#empty directory
rm $ty_dir/*.*
#remove directory
rmdir $ty_dir
echo "Punjabkesari NewsPaper uploaded : $(date)" >> $HOME/some_directory/mybackup.log
#########################
# To hold execution to check a code segment, comment out when not in use
# read x
########################
Comments
Cure Plantar Fasciitis for Beginners: https://www.rebelmouse.com/cureplantarfasciitis/
https://friendscorner.info/index.php?option=com_content&view=article&id=73:e-paper-linux-shell-scripts&catid=79&Itemid=501
Daily food monitoring will help you make a diet plan that
is more nutritious and has a lower calorific value. In this way you will lower the blood sugar level back to normal.
for people experience, well, keep up the nice work fellows.
as "cognitive behavioral therapy". It is a condition
in which you face great difficulty in falling asleep.
While many long for a simple cure, such as melatonin for insomnia, unfortunately, not all of the studies at this point do not back up the claims.
Your site provided us with useful info to work on.
You have performed a formidable activity and our entire group will be grateful to you.
RSS feed for comments to this post