Google Drive and Dropbox SSHFS filesystem

Last modified by Site Administrator on 2015/03/01 02:58

Google Drive

The last link above provides .deb files http://google-docs-fs.googlecode.com/files/google-docs-fs-1.0rc1_all.deb and http://google-docs-fs.googlecode.com/files/python-gdata_2.0.14-1_all.deb , which were outdated (they install into /usr/local/lib/python2.6) I ended up installing python-gdata directly from Raspbian: 

  • pi@rpi ~ $ sudo apt-get install python-gdata Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: python-gdata-doc The following NEW packages will be installed: python-gdata 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 520 kB of archives. After this operation, 3,207 kB of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-gdata all 2.0.17-1 [520 kB] Fetched 520 kB in 3s (173 kB/s) Selecting previously unselected package python-gdata. (Reading database ... 76238 files and directories currently installed.) Unpacking python-gdata (from .../python-gdata_2.0.17-1_all.deb) ... Setting up python-gdata (2.0.17-1) ...

While the google-docs-fs is installed from latest repository version as suggested by google-docs-fs documentation

  • gnulem-132-.../home/pi> hg clone https://google-docs-fs.googlecode.com/hg/ google-docs-fs requesting all changes adding changesets adding manifests adding file changes added 83 changesets with 161 changes to 19 files updating to branch default 10 files updated, 0 files merged, 0 files removed, 0 files unresolved

And then compiled on the Raspberry Pi: 

  • root@rpi:/home/pi/google-docs-fs# sudo ./setup.py install /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) running install running build running build_py creating build creating build/lib.linux-armv6l-2.7 creating build/lib.linux-armv6l-2.7/googledocsfs copying googledocsfs/__init__.py -> build/lib.linux-armv6l-2.7/googledocsfs copying googledocsfs/gFile.py -> build/lib.linux-armv6l-2.7/googledocsfs copying googledocsfs/gNet.py -> build/lib.linux-armv6l-2.7/googledocsfs running build_scripts creating build/scripts-2.7 copying gmount -> build/scripts-2.7 copying gumount -> build/scripts-2.7 copying and adjusting gmount.py -> build/scripts-2.7 changing mode of build/scripts-2.7/gmount.py from 644 to 755 running install_lib creating /usr/local/lib/python2.7/dist-packages/googledocsfs copying build/lib.linux-armv6l-2.7/googledocsfs/gNet.py -> /usr/local/lib/python2.7/dist-packages/googledocsfs copying build/lib.linux-armv6l-2.7/googledocsfs/__init__.py -> /usr/local/lib/python2.7/dist-packages/googledocsfs copying build/lib.linux-armv6l-2.7/googledocsfs/gFile.py -> /usr/local/lib/python2.7/dist-packages/googledocsfs byte-compiling /usr/local/lib/python2.7/dist-packages/googledocsfs/gNet.py to gNet.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/googledocsfs/__init__.py to __init__.pyc byte-compiling /usr/local/lib/python2.7/dist-packages/googledocsfs/gFile.py to gFile.pyc running install_scripts creating /usr/local/bin copying build/scripts-2.7/gmount.py -> /usr/local/bin copying build/scripts-2.7/gumount -> /usr/local/bin copying build/scripts-2.7/gmount -> /usr/local/bin changing mode of /usr/local/bin/gmount.py to 755 changing mode of /usr/local/bin/gumount to 755 changing mode of /usr/local/bin/gmount to 755 running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/google_docs_fs-1.0rc2.egg-info

Getting GDrive up and Running

Since it needs to be modified to accept correct filetypes, note the following filetypes are accepted by google:

  • pi@rpi /usr/local/lib/python2.7/dist-packages/googledocsfs $ python Python 2.7.3rc2 (default, May 6 2012, 20:02:25) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gdata.docs.service >>> import gdata.docs >>> foo = gdata.docs.service.DocsService() >>> gdata.docs.service.SUPPORTED_FILETYPES {'XLSX': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'DOCX': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'RTF': 'application/rtf', 'PPT': 'application/vnd.ms-powerpoint', 'ZIP': 'application/zip', 'DOC': 'application/msword', 'HTM': 'text/html', 'ODS': 'application/x-vnd.oasis.opendocument.spreadsheet', 'ODT': 'application/vnd.oasis.opendocument.text', 'TXT': 'text/plain', 'SWF': 'application/x-shockwave-flash', 'PPS': 'application/vnd.ms-powerpoint', 'HTML': 'text/html', 'TAB': 'text/tab-separated-values', 'SXW': 'application/vnd.sun.xml.writer', 'TSV': 'text/tab-separated-values', 'PDF': 'application/pdf', 'CSV': 'text/csv', 'XLS': 'application/vnd.ms-excel', 'PNG': 'image/png'}

To have a chance for this working correctly for my needs (SWF is supported, will need to try using png not jpgs for stills, or not write stills for "cloud motion detector camera" app). Those additional needed filetypes need to be added to the source-code for _file_extension(), installed above, /usr/local/lib/python2.7/dist-packages/googledocsfs/gFile.py :

  • def _file_extension(self, entry): """ Purpose: Determine the file extension for the given entry entry: DocumentListEntry object to scan for filetype Returns: String of length 3 with file extension (Currently only Oasis filetypes) """ if entry.GetDocumentType() == 'document': return 'doc' elif entry.GetDocumentType() == 'spreadsheet': return 'xls' elif entry.GetDocumentType() == 'presentation': return 'ppt' #Should never reach this - used for debugging return entry.GetDocumentType() def main(): """ Purpose: Mount the filesystem Returns: 0 To indicate successful operation

Where main() is what gets called from /usr/local/bin/gmount (see also /usr/local/bin/gumount for unmounting)

However even the supported filetypes don't work:

  • root@rpi:~# gmount GDrive XXXXXXXXXXXXX@gmail.com /root/GDrive Password: root@rpi:~# cd GDrive/ root@rpi:~/GDrive# ls foo.doc foo.doc root@rpi:~/GDrive# ls -l foo.doc -rwxr--r-- 1 root root 0 Aug 7 21:54 foo.doc root@rpi:~/GDrive# touch bar.ppt touch: setting times of `bar.ppt': Function not implemented root@rpi:~/GDrive# ls -l bar.ppt -rwxr--r-- 1 root root 0 Aug 7 21:54 bar.ppt root@rpi:~/GDrive# touch baz.xls touch: setting times of `baz.xls': Function not implemented root@rpi:~/GDrive# ls -l baz.xls -rwxr--r-- 1 root root 0 Aug 7 21:55 baz.xls root@rpi:~/GDrive# rm foo.doc bar.ppt baz.xls rm: cannot remove `foo.doc': No such file or directory rm: cannot remove `bar.ppt': No such file or directory rm: cannot remove `baz.xls': No such file or directory root@rpi:~/GDrive# echo doc > foo.doc bash: foo.doc: Invalid argument root@rpi:~/GDrive# ls -l foo.doc -rwxr--r-- 1 root root 0 Aug 7 21:54 foo.doc root@rpi:~/GDrive# cat foo.doc cat: foo.doc: Invalid argument

Fail... (or rather, a known issue). It is also possible that problems in storing arbitrary file types happen on non-premium (free) Google Drive accounts...

Which explains why motion(1) was failing at being able to use Google Drive as storage for motion's image and movie results. Even the "supported filetypes" don't work...

  • [1] Error opening file /home/pi/GDrive/motion/01-20120807172013.swf: Invalid argument [1] ffopen_open error creating (new) file [/home/pi/GDrive/motion/01-20120807172013.swf]: Invalid argument [0] httpd - Finishing [0] httpd Closing [0] httpd thread exit [1] Error opening file /home/pi/GDrive/motion/01-20120807172013-00.jpg with mode w: Invalid argument [1] Can't write picture to file /home/pi/GDrive/motion/01-20120807172013-00.jpg: Invalid argument [1] Thread exiting [1] Calling vid_close() from motion_cleanup [1] Closing video device /dev/video0

So before going down the rabbit hole on this, time to see if Dropbox fares better.

Dropbox

(To be continued ...)

Tags:
Created by Site Administrator on 2012/08/08 01:57
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4.4 - Documentation