Synchronizing files and directories from GNU/Linux to Android

In the long term, I plan to port Paperwork to Android. Before that, there is one problem : how to keep a synchronized copy of all the scans on an Android devices ?

For now, I've found a partial solution using SparkleShare and Agit. I say partial because I can get the files easily on my Android devices, but not have them automatically synchronized. Also, I cannot send files from my Android device by this mean.

SparkleShare keeps folder(s) synchronized across many computers. Change something in one of these folder in one of the computers, and will apply automatically the same change on the other computers. The problem is that there is no real Android client (there is an official Android client, but it's basically useless).

On the server part, the only thing SparkleShare requires is a Git server. Sparkleshare client will also connect to a notification broadcast server, but only hashes are exchanged on this server, so it's safe to use the official notification server for everything.

Here is the trick : for now, on my Android devices, I only want to get the files. I don't want to modify them or add some. Also, I'm fine with running a synchronization manually from time to time. So I don't need the notifications. On my Android devices, I only need a git client. This is where Agit comes into play.

Let's say we synchronize our photo album using SparkleShare, and let say we want them to appear in Android Gallery. The SparkleShare repository is hosted on one of our own computer - in this example - in /home/jflesch/sync/photos. We access it using ssh (login: jflesch). For the photos to appear in Android Gallery, we must have them in /sdcard/DCIM. So in Agit, you just have to use the following settings:

  • URL: ssh://
  • Uncheck 'default folder'
  • Target folder: /sdcard/DCIM/photos
  • Uncheck 'Bare' (otherwise you will be able to browse the repository content with Agit, but the photos won't be extracted from the repository).
  • Press 'Clone'.
  • Agit will ask you if the server key is ok. Beware that this popup may appear in background ! Keep an eye on the notification area of Android.
  • Next Agit will ask your password (I haven't found yet how to use public key authentication)

Then it's time to make coffee.

Note that Android Gallery won't take into account the new photos automatically (I have no idea why they don't use inotify). You may have to purge Android Gallery cache (settings -> Applications -> All -> Gallery -> Erase data / Purge cache) or even restart your device to see the photos.

This is definitively not as good as it could be, but it's a start. A real improvement would be to have a real Android client for Sparkleshare (using Jgit for instance).

2 réactions

  • 1 De Yves - 23/09/2014, 09:49

    Hi jflesch, did you try OwnCloud? It is cross-platform and it does have a real Android client.
    In my humble opinion, Paperwork shouldn't have to care about this issue, unless you want to allow concurrent access, which would need:
    — some kind of per-document locking,
    — maybe a carefully planned naming / identifying scheme,
    — partial refresh of the list / of some documents when needed.

  • 2 De Jflesch - 25/11/2014, 11:08

    I actually tried Owncloud quite a long time ago. It was awfully slow, and I got a lot of synchronization conflicts where there should have been none. So I dropped it. Maybe it got better now, I don't know.

Fil des commentaires de ce billet

Ajouter un rétrolien

URL de rétrolien :