Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[photo sync] Upload to library root, not hard coded sub folder #311

Closed
tomchiverton opened this issue Mar 25, 2015 · 1 comment
Closed
Labels

Comments

@tomchiverton
Copy link

It would be great if I could have the photos just sync to a library (such as 'My unsorted photos') without them going in to a sub folder.
Even better would be able to give not only the library to sync to, but the path to a folder inside the library (that could be an empty path e.g. the library's root).

@TehEnforce
Copy link

YES THIS PLEASE

forouher added a commit to forouher/seadroid that referenced this issue Nov 15, 2015
This patch reworks most of the camera upload. It contains two important
changes:

(1) The old code implemented camera upload as a service. While that worked,
it proved somewhat problematic. Services can be killed by Android, and the
service had to be started by an Activity.

Android provides an API for implementing data syncing:
https://developer.android.com/training/sync-adapters/index.html

This API provides a number of advantages compared to a self-implemented
service. Among them are:

* Less code
* Automatic error recovery (e.g. retry on network errors)
* Periodic synchronisation (e.g. every 24h)
* Better visibility to the user (via Android Settings->Accounts)

(2) The old camera media sync algortihm tried to upload media via two ways:

a) when a new photo was added to the MediaStore, that photo was uploaded. But
*only* if the data plan allowed it.
b) when the user interacts with Seadroid, the service uploaded all photos
not yet uploaded. It did that by scanning certain hard-coded directories
on the externalStorage  and looking for new media files.

Important changes added by this patch:

- This new design builds soly on the MediaStore. The MediaStore contains
all images/videos on the phone. Therefore it should not be necessary to
scan (or even be aware of) where the photos are actually stored.

- The MediaStore has a column where it records the "DATA_ADDED" for every
media file. We can use that to sort and filter for new newly added media
files. This eases up the syncing mechanism considerably.

- Allowing to sync to sub directories in a repository.

- There is still a service necessary to monitor MediaStore activity. However
even without that service, Android will perform a sync about every 24h.
Also that service is now autostarted on System boot and on Seadroid
apk upgrades.

- Finally merging with existing files on the server was also improved by
skipping files that are already present on the server (it compares the file
size and will still upload if the sizes differ. That's probably the best
one can do with the current API2).

Overall, this patch should adresses the following issues:

issue haiwen#277 (Camera upload function dumps all subdir files into single dir)
issue haiwen#301 (Inconsistency in camera upload sync)
issue haiwen#311 (second suggestion: target repo sub directories)
issue haiwen#336 (file duplication when doing a full resync)
issue haiwen#375 (Picture upload not acting as service?)
issue haiwen#423 (Pictures never upload) [maybe. not sure what's going on there]

Useful links:
https://developer.android.com/training/sync-adapters/creating-sync-adapter.html
http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter/
forouher added a commit to forouher/seadroid that referenced this issue Nov 23, 2015
This patch reworks most of the camera upload. It contains two important
changes:

(1) The old code implemented camera upload as a service. While that worked,
it proved somewhat problematic. Services can be killed by Android, and the
service had to be started by an Activity.

Android provides an API for implementing data syncing:
https://developer.android.com/training/sync-adapters/index.html

This API provides a number of advantages compared to a self-implemented
service. Among them are:

* Less code
* Automatic error recovery (e.g. retry on network errors)
* Periodic synchronisation (e.g. every 24h)
* Better visibility to the user (via Android Settings->Accounts)

(2) The old camera media sync algortihm tried to upload media via two ways:

a) when a new photo was added to the MediaStore, that photo was uploaded. But
*only* if the data plan allowed it.
b) when the user interacts with Seadroid, the service uploaded all photos
not yet uploaded. It did that by scanning certain hard-coded directories
on the externalStorage  and looking for new media files.

Important changes added by this patch:

- This new design builds soly on the MediaStore. The MediaStore contains
all images/videos on the phone. Therefore it should not be necessary to
scan (or even be aware of) where the photos are actually stored.

- The MediaStore has a column where it records the "DATA_ADDED" for every
media file. We can use that to sort and filter for new newly added media
files. This eases up the syncing mechanism considerably.

- Allowing to sync to sub directories in a repository.

- There is still a service necessary to monitor MediaStore activity. However
even without that service, Android will perform a sync about every 24h.
Also that service is now autostarted on System boot and on Seadroid
apk upgrades.

- Finally merging with existing files on the server was also improved by
skipping files that are already present on the server (it compares the file
size and will still upload if the sizes differ. That's probably the best
one can do with the current API2).

Overall, this patch should adresses the following issues:

issue haiwen#277 (Camera upload function dumps all subdir files into single dir)
issue haiwen#301 (Inconsistency in camera upload sync)
issue haiwen#311 (second suggestion: target repo sub directories)
issue haiwen#336 (file duplication when doing a full resync)
issue haiwen#375 (Picture upload not acting as service?)
issue haiwen#423 (Pictures never upload) [maybe. not sure what's going on there]

Useful links:
https://developer.android.com/training/sync-adapters/creating-sync-adapter.html
http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter/
forouher added a commit to forouher/seadroid that referenced this issue Jan 5, 2016
This patch reworks most of the camera upload. It contains two important
changes:

(1) The old code implemented camera upload as a service. While that worked,
it proved somewhat problematic. Services can be killed by Android, and the
service had to be started by an Activity.

Android provides an API for implementing data syncing:
https://developer.android.com/training/sync-adapters/index.html

This API provides a number of advantages compared to a self-implemented
service. Among them are:

* Less code
* Automatic error recovery (e.g. retry on network errors)
* Periodic synchronisation (e.g. every 24h)
* Better visibility to the user (via Android Settings->Accounts)

(2) The old camera media sync algortihm tried to upload media via two ways:

a) when a new photo was added to the MediaStore, that photo was uploaded. But
*only* if the data plan allowed it.
b) when the user interacts with Seadroid, the service uploaded all photos
not yet uploaded. It did that by scanning certain hard-coded directories
on the externalStorage  and looking for new media files.

Important changes added by this patch:

- This new design builds soly on the MediaStore. The MediaStore contains
all images/videos on the phone. Therefore it should not be necessary to
scan (or even be aware of) where the photos are actually stored.

- The MediaStore has a column where it records the "DATA_ADDED" for every
media file. We can use that to sort and filter for new newly added media
files. This eases up the syncing mechanism considerably.

- Allowing to sync to sub directories in a repository.

- There is still a service necessary to monitor MediaStore activity. However
even without that service, Android will perform a sync about every 24h.
Also that service is now autostarted on System boot and on Seadroid
apk upgrades.

- Finally merging with existing files on the server was also improved by
skipping files that are already present on the server (it compares the file
size and will still upload if the sizes differ. That's probably the best
one can do with the current API2).

Overall, this patch should adresses the following issues:

issue haiwen#277 (Camera upload function dumps all subdir files into single dir)
issue haiwen#301 (Inconsistency in camera upload sync)
issue haiwen#311 (second suggestion: target repo sub directories)
issue haiwen#336 (file duplication when doing a full resync)
issue haiwen#375 (Picture upload not acting as service?)
issue haiwen#423 (Pictures never upload) [maybe. not sure what's going on there]

Useful links:
https://developer.android.com/training/sync-adapters/creating-sync-adapter.html
http://blog.udinic.com/2013/07/24/write-your-own-android-sync-adapter/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants