pageauc / pi-timolo

Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.
MIT License
548 stars 101 forks source link

Sync issue #48

Closed PhyNerd closed 7 years ago

PhyNerd commented 7 years ago

Sync currently has the issue, that if the Folder doesn't contain any images it exits the shell. This leads to the app status not being checkt and new config files not beeing loaded. Removing this one exit and replacing it with a return doesn't seem to cause errors, even if the folder is empty.

I also replaced the other 2 exits.

pageauc commented 7 years ago

The first check is to verify that a source file directory exists so exit and message is appropriate. default is media/motion

Second check is to verify there are files in the above folder. You are correct in that you could just post a message and sleep for a while and continue. It was just a way to see if any files exist that match the files that require syncing. default is jpg but * would be ok. Was just being cautious. I will change this to a sleep 10 and then allow program to continue even if there are no matching files types.

The next check if to verify that google drive has a matching sync folder that matches the local folder name to sync. If it does not exist then attempts to create the folder and if that fails then the exit is appropriate. gdrive will detect this but error message might not explain things so I add my error message.

I implemented the wait on the second item so should not exit if folder is empty or contains no matching file type file.

You can update using pi-timolo-install.sh or just do a wget

wget -O sync.sh https://raw.github.com/pageauc/pi-timolo/master/source/sync.sh
pageauc commented 7 years ago

Release version 4.20 per your original suggestion since as you mention the other checks would not be done in the script. I had to think of this for a while Appreciate your feedback. I have implemented the change so a merge is not required

Claude ...

PhyNerd commented 7 years ago

Thanks for the change and explanation of the exit's purpose.

While testing it struck me as odd that syc quit just because the Folder was empty. I then only noticed the other 2 exits and changed them as well. In my application purposes a Internet connection is not always a given, so I would run into these exits quite often. But I still really like the idea of a hourly check up on the status in case of the occasional crash due to the pi running out of memory. So this change really helps me a lot :)