On 14/05/18 23:16, Dennis Lee Bieber wrote:
> On Mon, 14 May 2018 20:49:57 +0100, RobH declaimed the
> following:
>
>
>> Thanks, but when the python script runs without the inserted curl line,
>> it takes pictures of whatever is sensed and writes the actual file to
>> the sdcard.
>>
>> I read somewhere that writing to the Pizero sdcard so many times, as it
>> would, is not a could idea as it could be corrupted.
>>
>> So I looked for a way to upload the jpg file to my server.
>
> Unless your JPG fits entirely within the system RAM, you still have to
> write the file to the SD card. "curl" and pretty much every other FTP
> option requires files stored on the file system in order to read/transfer
> them -- so no saving of the SD card, you still are writing to it.
>
> If the JPG does fit in the RAM and is not written to SD card by the
> capture process, you could (with effort) feed the RAM copy to a programmed
> FTP transfer. Python's ftplib .storbinary() expects "an open file
> object"... I suspect anything that provides file-like I/O operations might
> be usable -- like using the StringIO library for the JPG data (but again,
> this assumes the camera capture can be to a string buffer and not to a file
> on the SD card). {"pycurl" is not part of the standard library, you'd have
> to install it}
>
>> # Start recording video
>> camera.start_recording(filename)
>
> You are using JPG for a video? Not MJPEG or JPEG XS? To my knowledge,
> JPeG (joint photographic experts group) is a still image format. Note that
> your filename format has an .h264 extension, which is likely compatible
> with AVCHD (advanced video codec for high definition) MPEG (motion picture
> experts group).
>
> However -- THAT is the statement that specifies where the capture is
> being stored. And therefore, that is the statement that needs to change to
> avoid writing to the SD card.
>
>> curl -T /home/pi/filename.jpg ftp://ftp-ipaddressof NAS
server/mnt/folder/filename.jpg --user
>
> There are so many things wrong with that line... Even ignoring that
> "curl" is an external program and not Python statement.
>
> a) You need to plug in the actual file name used in the capture command;
> there is no "/home/pi/filename.jpg" being created
>
> b) What is that "ftp-ipaddressof NAS ..." supposed to represent? Those
> added spaces are going to play hob with parsing of the command.
>
> c) If you are trying to save that file to a local network (NAS -- network
> attached storage) server, you don't need FTP... The NAS storage should have
> been mounted somewhere in the Linux filesystem associated with NFS protocol
> (or would show up with a "drive letter" in Windows). Just create your
> filename with the full path to the NAS mount point/directory you want to
> use for saving videos.
>
> https://en.wikipedia.org/wiki/Network-attached_storage
>
> https://en.wikipedia.org/wiki/Network_File_System#Typical_implementation
> """
> 5 The client machine requests access to exported data, typically by
> issuing a mount command. (The client asks the server (rpcbind) which port
> the NFS server is using, the client connects to the NFS server (nfsd), nfsd
> passes the request to mountd)
> 6 If all goes well, users on the client machine can then view and
> interact with mounted filesystems on the server within the parameters
> permitted.
> """
>
> Using direct reference to a NAS mounted directory avoids ever writing
> to the SD card... And if you were going to use FTP you have a network
> connection (wired or WiFi) so you could have a mounted NAS directory.
>
>
>
I found the said line or information here:
https://www.newth.net/mars/how-to-set-up-a-raspberry-pi-zero-to-upload-images-t
o-a-server-via-ftp/
And I used the 2nd line first, then both lines, and still it returned
the same error message: invalid syntax.
In answer to the b) the ip address of the NAS server means I actually
use an ip address to access my NAS server, 192.168.x.x as an example.
There would not be any added spaces when it is used.
When you say: Just create your filename with the full path to the NAS
mount point/directory you want to use for saving videos.
Do you then mean to use an exact file name to move or upload to the NAS
mount point.
This would be impractical I think because each picture has a date in the
name, ie: 2018-05-07_22.40.54.jpg
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|