|
| 1 | +import sys |
| 2 | +import time |
| 3 | +from goprocam import GoProCamera, constants |
| 4 | +import threading |
| 5 | +import logging |
| 6 | + |
| 7 | +""" |
| 8 | +I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly. |
| 9 | +
|
| 10 | +pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart |
| 11 | +
|
| 12 | +This script will overrride some settings for reliability: |
| 13 | +
|
| 14 | +Voice control: OFF |
| 15 | +AutoPower off: NEVER |
| 16 | +Beeps: OFF (Do not want the camera beeping at 6AM) |
| 17 | +
|
| 18 | +NightLapse configuration left untouched, I recommend always using Auto shutter for sunrise and locking the White Balance to 4000k or higher. |
| 19 | +""" |
| 20 | + |
| 21 | + |
| 22 | +def start_timelapse(interface): |
| 23 | + gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP( |
| 24 | + interface), camera=constants.gpcontrol, webcam_device=interface) |
| 25 | + logging.info( |
| 26 | + "Started goprocam instance with interface {}".format(interface)) |
| 27 | + gopro.gpControlSet(constants.Setup.VOICE_CONTROL, |
| 28 | + constants.Setup.VoiceControl.OFF) |
| 29 | + gopro.gpControlSet(constants.Setup.AUTO_OFF, constants.Setup.AutoOff.Never) |
| 30 | + logging.info("All config set") |
| 31 | + gopro.mode(constants.Mode.MultiShotMode, |
| 32 | + constants.Mode.SubMode.MultiShot.NightLapse) |
| 33 | + gopro.shutter(constants.start) |
| 34 | + logging.info("Started timelapse") |
| 35 | + |
| 36 | + |
| 37 | +cameras = sys.argv[1] |
| 38 | +cameras = cameras.split(",") |
| 39 | + |
| 40 | +for interface in cameras: |
| 41 | + thr = threading.Thread(target=start_timelapse, args=(interface,)) |
| 42 | + thr.start() |
0 commit comments