Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- delay="1"
- echo -n "Book Title:"
- read title
- title="${title// /-}"
- mkdir "$title" || exit 1
- if [ "$1" = "collier" ]
- then
- #collier County Lib
- echo "Working with Collier County"
- p1="664x900+296+144"
- p2="664x900+960+144"
- else
- #Amazon Kindle
- echo "Working With Kindle Cloud"
- p1="750x1023+200+43"
- p2="750x1023+960+43"
- fi
- #now using Smart ender
- # let p=100
- # echo -n "Number of Pages:"
- # read pages
- #
- # let max="$(echo $pages+$p|bc)"
- echo "5 seconds to get to book"
- sleep 5
- #stop when end is greater then 2
- let end=0
- while [ "$end" -lt 2 ]
- #while [ "$p" -lt "$max" ]
- do
- echo "Page: $(echo $p-100|bc)"
- import -window root -crop $p1 -quality 90 ${title}/page_$p.jpg
- let p+=1
- echo "Page: $(echo $p-100|bc)"
- import -window root -crop $p2 -quality 90 ${title}/page_$p.jpg
- xte "key Right"
- #after 10 pages
- #compare pages to determine end of book
- if [ $p -gt 110 ]
- then
- i1="${title}/page_$p.jpg"
- let l=$(($p-2))
- i2="${title}/page_$l.jpg"
- let v="$(/usr/bin/compare -verbose -metric mae "$i1" "$i2" "/tmp/bookd.png" 2>&1 >/dev/null | grep 'all:'| awk '{print $2}'|cut -d\. -f1)"
- if [ $v -gt 0 ]
- then
- let end=0
- else
- let end+=1
- echo "Page Match - $end"
- fi
- fi
- let p+=1
- sleep $delay
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement