TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ANDY BURNS
from: ROBH
date: 2018-06-16 12:49:00
subject: Re: ftp causing invalid s

On 16/06/18 12:24, Andy Burns wrote:
> On 16/06/2018 12:05, RobH wrote:
>
>> Current version of what, the code ?
>
> yes, unless it's huge ...

  As you look down through the code, you will see what I have added by
something like this:
  < I added this,
< and this
I was just trying different things which I read about the shutil module

CODE:
from picamera import PiCamera
import time
import os
import os.path
import shutil
from os.path import join < I added this

src = ("RAMname")< and this
dst = ("NASname")< this

from gpiozero import MotionSensor  #According to google motionsensor is
in gpiozero

# Create object for PIR Sensor
# PIR Sensor is on GPIO-4 (Pin 7)
pir = MotionSensor(4)

# Create Object for Camera
camera = PiCamera()



while True:
     # Wait for motion being detected
     pir.wait_for_motion()
     triggerTime = time.time()

     #create base filename at time of motion trigger
     fname = time.strftime("%Y-%m-%d_%H.%M.%S.h264",
time.localtime(triggerTime))

     RAMname = os.path.join("/run/shm", fname)
     NASname = os.path.join("/mnt/CCTV/PiZero" , fname)

     camera.start_preview()

     #capture video to RAM device first
     camera.start_recording(RAMname)
     camera.wait_recording(10)
     camera.stop_recording()
     camera.stop_preview()

     #copy from RAM device to NAS device
     #shutil.copyfile(RAMname, NASname)  * Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)                                                                                                                                                                                                                                                                          

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.