Created
January 27, 2015 12:25
-
-
Save filviu/efacba850a1aa51caaf3 to your computer and use it in GitHub Desktop.
Simple raspi "cloud" scanner
This file contains hidden or 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
| # | |
| # ESE Key Deamon 1.2.7 config file | |
| # | |
| # | |
| # example 1: to run mutt in xterm we must set DISPLAY | |
| # so the command line will be as follows: | |
| #MAIL:/bin/sh -c "DISPLAY=:0 xterm -e mutt" | |
| # | |
| # example 2: turn on/off GPS reciever when lid is open/closed | |
| #RADIO(press):echo 1 >/sys/device/platform/gps/gps_power | |
| #RADIO(release):echo 0 >/sys/device/platform/gps/gps_power | |
| # | |
| # example 3: run nautilus when both left meta and e keys are press | |
| #LEFTMETA+E:nautilus | |
| # | |
| #KP1(press): | |
| KP1(release):/home/pi/bin/scan.sh --mode Gray --resolution 75 --type pdf > /tmp/log.txt 2>&1 | |
| #KP2(press): | |
| KP2(release):/home/pi/bin/scan.sh --mode Gray --resolution 150 --type pdf | |
| #KP3(press): | |
| KP3(release):/home/pi/bin/scan.sh --mode Gray --resolution 300 --type pdf | |
| #KP4(press): | |
| KP4(release):/home/pi/bin/scan.sh --mode Color --resolution 150 --type pdf | |
| #KP5(press): | |
| KP5(release):/home/pi/bin/scan.sh --mode Color --resolution 300 --type pdf | |
| #KP6(press): | |
| #KP6(release):/home/pi/bin/scan.sh --mode Color --resolution 600 --type pdf | |
| #KP7(press): | |
| KP7(release):/home/pi/bin/scan.sh --mode Gray --resolution 1200 --type png --nocomp | |
| #KP8(press): | |
| KP8(release):/home/pi/bin/scan.sh --mode Color --resolution 600 --type png --nocomp | |
| #KP9(press): | |
| KP9(release):/home/pi/bin/scan.sh --mode Color --resolution 1200 --type png --nocomp | |
| #KPSLASH(press): | |
| #KPSLASH(release): | |
| #KPASTERISK(press): | |
| #KPASTERISK(release): | |
| #KPPLUS(press): | |
| #KPPLUS(release): |
This file contains hidden or 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
| #!/bin/bash | |
| FILENAME="/home/pi/scan/$(date +%Y-%m-%d_%H%M%S)" | |
| function usage { | |
| echo "See code" | |
| exit | |
| } | |
| SMOD="Gray" | |
| FTYP="pdf" | |
| RESOLUTION="150" | |
| COMP="JPEG" | |
| while [ "$1" != "" ]; do | |
| case $1 in | |
| -m | --mode ) shift | |
| SMOD=$1 | |
| ;; | |
| -t | --type ) shift | |
| FTYP=$1 | |
| ;; | |
| -r | --resolution ) shift | |
| RESOLUTION=$1 | |
| ;; | |
| -n | --nocomp ) shift | |
| COMP="None" | |
| ;; | |
| -h | --help ) usage | |
| ;; | |
| * ) usage | |
| esac | |
| shift | |
| done | |
| sudo scanimage --mode $SMOD --resolution $RESOLUTION --compression $COMP | convert - "$FILENAME"."$FTYP" | |
| sudo chown pi: "$FILENAME"."$FTYP" | |
| /home/pi/bin/dropbox_uploader.sh -f /home/pi/.dropbox_uploader upload "$FILENAME"."$FTYP" / | |
| rm "$FILENAME"."$FTYP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment