Script that takes pictures at regular intervals and uploads them without user input.
I made a shortcut using the apple shortcut application that do the following:
- Set screen brightness to 0%
- Take photo with back camera
- Rotate photo
- Resize photo
- Rename photo to current date
- Save to dropbox
- Make a get request to a php script (the script access the most recent picture from dropbox and copy its own server, the request response is not important)
- Wait 10 minutes
- Call itself
The phone is supposed to just sit without user interaction and keep taking and uploading pictures as long as there is power.
The shortcut script works fine, but a loss of network coverage prompts an error message, blocking the script execution, that cannot (apparently) be dismissed without human intervention.
The phone will be placed in a spot with 3G/4G network but no wifi, bad network coverage is bound to happen.
So I was wondering if I could achieve the same result in Pythonista, maybe adding a check for internet access or at least the possibility to fail gracefully and keep going in case of errors.
I just bought Pythonista, I am running IOS 14.3. The first problem I have is taking a picture without user intervention.
photos.capture_image()method does not work as it opens the camera app.
I found this thread but the
take_photo_nowmethod described in the first answer does not seem to work on my phone, I get the green dot signaling camera activity but nothing else.
- Is there another way to do this?
- Is what I am trying to achieve doable or am I likely to hit another roadblock down the line?
have you tried the later example further down in that thread?
you will also need to disable the idle timer (in console module) to keep pythonista from getting backgrounded while unattended.
I tried the second example as well. But I do not see any output. How can I test if a picture has been taken? I tried
console.quicklook.('output')The first does nothing, the second give me an error message:
<build in function quicklook > returned with an error set
@eniac314 you can find sample.jpg in Pythonista tree with
@eniac314 and you have to hear a click....of the camera
Ok I see it now! I'll process forward then, thanks!