Page 1 of 1

Uploading Motion files to Google Drive on Raspbian?

Posted: Sun Mar 10, 2013 10:38 pm
by macintoshgeek
Hello,
I've been playing around with Motion on my Rapsberry Pi running Raspbian and came across this post that sounded like fun to do:
http://through-the-interface.typepad.co ... art-2.html

I've been trying to tweak the steps he lists to have it work with Raspbian, and as far as I know I should be good. I installed GData using

Code: Select all

sudo apt-get install python-gdata
And then I put the uploader.py and uploader.cfg files in /etc/motion and changed the motion.confg file to have the line

Code: Select all

on_movie_end /etc/motion/uploader.py /etc/motion/uploader.cfg %f
Am I missing something? Theoretically this should work on Raspbian right? What else has to be done?

Thanks

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Mon Mar 18, 2013 8:52 pm
by macintoshgeek
Anyone have any ideas?

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Tue Mar 19, 2013 1:26 am
by broo0ose
Do you get any errors?

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Tue Mar 19, 2013 1:49 am
by macintoshgeek
No error is returned in motion. So I can't figure out where a problem could be coming from. I've adjusted the script as the tutorial said to to. And I would assume that it should be working with raspbian. I just can't seem to figure out where the problem is coming from.

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Tue Mar 19, 2013 1:45 pm
by broo0ose
I've used the Google python API for Calendar and that worked perfectly, but my method used OAuth2 to do the authorisation.

If you want to try it that way I blogged the details here.
http://brucesbraindump.blogspot.co.uk/

then you would have to refer to the Google Drive API for the code to upload the motion files.
https://developers.google.com/drive/quickstart-python

HTH

Bruce

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Mon May 27, 2013 2:45 am
by Camper
Try changing your "on_movie_end /etc/motion/uploader.py /etc/motion/uploader.cfg %f" to "on_movie_end sudo python /etc/motion/uploader.py /etc/motion/uploader.cfg %f". It worked for me.

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Tue May 28, 2013 1:37 am
by Camper
Camper wrote:Try changing your "on_movie_end /etc/motion/uploader.py /etc/motion/uploader.cfg %f" to "on_movie_end sudo python /etc/motion/uploader.py /etc/motion/uploader.cfg %f". It worked for me.
Actually it looks like may be a permissions problem with the motion user id. :oops:

I noticed that I would get uploads and emails if it saved the images and video as the user pi when starting with daemon off but would not get email or uploads when the files were owned by the user motion when running as a service with daemon on. I'm sure there's a more secure way of solving the problem but as a temp fix I added motion to the list of sudoers with nopasswd and now it works either way. The upload.py script is +x for all users/goups and the .cfg is +r for all users/groups, so it shouldn't be a permissions issue with the script. I'm pretty sure it's that the motion user not allowed to run python scripts. I'll work some more when I get down to that item on the "to do list".

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Thu Nov 21, 2013 5:32 am
by diegoarpo
I am running into the same issue, the python script will work on the terminal but not on the motion.conf file when added. I have tried multiple proposed solutions, sudo python xx.py, python xx.py, ./xx.py (after chmod), and /home/pi/xx.py ... none would work. Is there a simpler way to test that the motion.conf on_picture_save event works?

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Sun Feb 02, 2014 8:10 am
by w0lfcry
I was having the same problem. After many trials, I settled with the below

Code: Select all

on_movie_end sudo -u motion /home/motion/uploader.py /home/motion/uploader.cfg %f >> /tmp/end.log
I inserted motion using visudo. motion is also the owner of uploader.py and uploader.cfg

Re: Uploading Motion files to Google Drive on Raspbian?

Posted: Sun Jul 14, 2019 6:46 pm
by Bobby05
Is there a way to have the videos be sent onto one Google Docs, instead of just sharing the videos to the drive?