Creating Mac shares on Raspberry Pi
Post ReplyCreating Mac shares on Raspberry PiPosted: Tuesday, April 21, 2020 [12:28:55] - 1
Trying to run gphoto2 shooting time-lapse using Raspberry Pi and saving images on Hard Drive. Using RPi's MicroSD is one way of doing it, but saving them on external Hard Drive sometimes is a better option. Connecting an Apple share is quite easy. First we need to install afpfs: Then create a mount folder on Raspberry Pi: chmod og-rwx ~/YourMac Then, before using it, just mount it: i.e. mount_afp afp://user:[email protected]/root /home/pi/MacProShare Once done using a share - unmount it: It works flawlessly as far as saving files to a mounted share, creating directories, deleting files etc. One issue, though - if relative file name used - it may not work, but works every time when fully qualified file name used, i.e. /home/pi/YourMac/images/test.jpg - works Happy time-lapse shooting! |
Running a simple script to capturePosted: Tuesday, April 21, 2020 [14:30:32] - 2
This is a simple Perl script to capture images: my $dest='/home/pi/MacPro2010/testing'; unless(-d $dest) {`mkdir $dest`; print "Created folder $dest\n";} while(1) { ## Infinite loop, to stop the capture press Ctrl + C my $frdel = time; $frdel = localtime($frdel); $frdel =~ tr/ //s; my($wdr,$mor,$dar,$tir,$yer) = split(/\s/,$frdel); my($hr,$min,$sec) = split(/\:/,$tir); print "/usr/local/bin/gphoto2 --capture-image-and-download "$dest/$mor.$dar.$yer.$hr.$min.$sec.jpg"\n"; `/usr/local/bin/gphoto2 --capture-image-and-download "$dest/$mor.$dar.$yer.$hr.$min.$sec.jpg"`; sleep(5); ## Adjust delay accordingly } ## WHILE LOOP END Please keep in-mind - Apple share has to be mounted manually before running this script. Make sure gphoto2 program is not running prior to starting the program by checking "ps axj" and use "kill -9 Process_ID" if necessary. Also, you camera has to be set properly before running the program above. I.e. code in ticks has to run without any errors. Check your camera and gphoto2 help files to make your camera run smoothly. |