1) takes a snapshot from a camera (Curl) and saves it in a folder "IPCamRotate/R.jpg". <-- I have several control pages that look at that image... so when something changes that one image address can change from any camera or any other image. (The key to this is that the "R.jpg" is continually overwritten with updated images based on different events)
2) Uses some script to create a unique filename "set filename to "Backyard_" & the file & ".jpg as string"
3) Copies R.jpg to new jpg with the unique filename to be stored in a log folder on the server computer.
4) Sends the new logged jpg image file as an attachment. (in this script, I send the image via iMessage). I may have to modify to send via email to text or via pushover.
- Code: Select all
do shell script "curl -f 'http://10.0.6.185:8085/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=whmoorejr&pwd=donkey' -o ~/Desktop/IPCamRotate/R.jpg"
set TheYear to year of (current date) as string
set TheMonth to month of (current date) as integer
set TheDay to day of (current date) as string
set Today to TheYear & TheMonth & TheDay as string
set Myhour to get the (hours of (current date)) as string
set Myminutes to get the (minutes of (current date)) as string
set Myseconds to get the (seconds of (current date)) as string
set MyTime to Myhour & "-" & Myminutes & "-" & Myseconds
set thefile to Today & "_" & MyTime as string
--set filedate to (current date) as number
set filename to "BackYard_" & thefile & ".jpg" as string
set sourceFile to POSIX file "/Users/williammoore/Desktop/IPCamRotate/R.jpg"
set destFolder to POSIX file "/Users/williammoore/Desktop/IPCamLog"
tell application "Finder"
set dupeFile to duplicate sourceFile to destFolder
set dupeFile's name to filename
end tell
tell application "Finder"
set folderPath to folder "MacMini:Users:williammoore:Desktop:IPCamLog"
set thefile to file filename in folderPath as alias
set filename to name of thefile
end tell
set theAttachment1 to thefile
tell application "Messages"
send theAttachment1 to buddy "bill.moore.jr@gmail.com" of (service 1 whose service type is iMessage)
-- send theAttachment1 to buddy "msvikki04@gmail.com" of (service 1 whose service type is iMessage)
end tell
So far (from this part of the forum), I've got...
- Code: Select all
url = 'http://10.0.6.185:8085/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=whmoorejr&pwd=donkey'
# Make the request and get the reply
reply = requests.get(url)
# This will raise an exception if the request returned an error
reply.raise_for_status()
# Save the content to a file
with open('/Users/williammoore/Desktop/IPCamRotate/R.jpg', 'wb') as image_file:
image_file.write(reply.content)
I also tried
- Code: Select all
import os
os.system("/usr/bin/curl -f 'http://10.0.6.185:8085/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=whmoorejr&pwd=donkey -o ~/Desktop/IPCamRotate/R.jpg")