From e152509fabbe2dc89e4e831c35d32561323a2be3 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Sun, 21 Feb 2021 15:19:08 +0100 Subject: [PATCH] added scan --- scan.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scan.sh diff --git a/scan.sh b/scan.sh new file mode 100755 index 0000000..f665fac --- /dev/null +++ b/scan.sh @@ -0,0 +1,21 @@ +#!/bin/bash +#get the ip +#TODO: store ip in env (faster) +ip=$1 +echo "printer on $ip" + +#TODO: state checking + +#start job # -H 'Origin: http://10.188.17.24' +curl "http://$ip/Scan/Jobs" --compressed -H 'Content-Type: text/xml' --data-raw '6006000024803508Jpeg0Color8PlatenNTSC10001000100017925Photo' + +# get latest job id +jobid=$(curl "http://$ip/Jobs/JobList" --compressed -s --output - | grep "JobUrl" | cut -d "/" -f 4 | cut -d "<" -f 1 | sort -n | tail -n 1) + +echo "jobid: $jobid" + +# stream job +outname="$2" #TODO: default value +curl "http://$ip/Scan/Jobs/$jobid/Pages/1" --output "$outname" -H 'Connection: keep-alive' + +echo "done: $outname" \ No newline at end of file