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

Automatic photo upload - timestamp when the photo was taken but not when it was uploaded #317

Open
VanLampe opened this issue Sep 20, 2021 · 6 comments

Comments

@VanLampe
Copy link

Hi,

it would be helpfull, if photos that are uploaded automatically, would be timestamped by the date and time they were taken and not when they have beenuploaded.

Current behavior:

  • enable automatic photo upload
  • wait until your local photos are synced to your seafile server
  • changedates were set to the time when the photos have been uploaded even if it was taken a while ago

Expected behavior:

  • change date corresponds to the time when the photos have been taken

In my opinion this would be the appropriate beavior. If you delete all local photos or if you loose your device, you won't be able to determine when your photos were taken.

Thanks and greetings,
Frank

@pandiloko
Copy link

The uploaded photos usually have the date in the filename (failing that there should also be a date in the exif metadata). In Nextcloud there is the same problem. I used to touch the files to set them to appropriate timestamp. Here is the script I use:

#format 2021-02-18_201122_5428.mov
for i in $(find . -type f -mtime -40 );do
   tstamp=$(basename "$i" | cut  -d"_" -f1-2 | tr -d '_-');
       echo $tstamp;
   tstamp=$(echo $tstamp | sed  -E 's/(.{12})(.*)/\1\.\2/g')
       touch -t $tstamp "$i";
done
#confirm changes with `docker-compose exec --user www-data app php occ files:scan --path=/path/to/Camera-Uploads`

Now, I tried the same with Seafile but so far I wasn't able to change the timestamp in any file while using Seadrive Daemon in a Linux Server (no gui). Is that a limitation of Seadrive or does it happen also if I synchronize the library with Seafile client?

Please give us at least a workaround. Thank you.

@pandiloko
Copy link

pandiloko commented Nov 23, 2021

So I did a quick test and this technique seems to work for libraries/folders synchronized through Seafile Desktop Client. It is a pain to synchronize a big library just to change the timestamps so again: is there some configuration we can change to enable timestamp modification with Seadrive? Thank you

EDIT: Turns out it took a couple of minutes to synchronize the timestamp changes to the server but the previous script worked like a charm updating the timestamps through SeaDrive. More than 6000 files correctly "timestamped". Nevertheless the App should preserve the file metadata when uploading.

To clarify the actual format for iOS Photos is IMG_20161224_191347_0394.JPG so there is a small change in the cut command. Again the complete working script:

#format IMG_20161224_191347_0394.JPG
for i in $(find . -type f -mtime -40 );do
    tstamp=$(basename "$i" | cut  -d"_" -f2-3 | tr -d '_-');
        echo $tstamp;
    tstamp=$(echo $tstamp | sed  -E 's/(.{12})(.*)/\1\.\2/g')
        touch -t $tstamp "$i";
done

@pandiloko
Copy link

surprise twist: after applying the script and correcting all the timestamps, the auto upload function thinks the local file (in the iPhone) differs from the remote file (on the Seafile server) and re-uploads everything again!!!. We are talking here about near to 7000 files so yeah... my phone is on fire today.

TLDR: I take everything back about the possible workaround. There seems to be no possibility of fixing the data on the server end: the iOS Seafile app must send the real timestamp on the first place.

Pleasee fix this. Thanks

@pandiloko
Copy link

I discovered a new workaround and I think in my case it will stay this way long term. I'll explain: I also have a remote backup in a cloud service where apparently the original timestamps are honored. In the server where Seafile runs I have both the cloud and Seadrive mounted with fuse (Seadrive). I then have a cron task in place which synchronizes (rsync -avhP ...) the files from the cloud to Seadrive preserving timestamps and everything.

This works and I think in my case is even better because I only have to upload the files one time from my phone while the sync to Seafiles happens automatically on the server. This has also the advantage of having a backup of the small videos that the iPhone takes with the so-called "live photos" which were missing from the Seafile "Automatic Upload".

@floco
Copy link

floco commented Dec 4, 2021

I have the same issue.
Thanks for the workaround. I may do this too but of course would prefer not to depend on a third party cloud.
Anyone knows if the limitation comes from the iOS client or from the API (found this related issue haiwen/seafile#1456) ?

@VanLampe
Copy link
Author

Thanks for sharing your workaround @pandiloko - I think this may be a solution an I'll give it a try. Nevertheless, I also think, that the photos should contain the meta data to be able to sort them by the real time they where taken.

Sorting photos by the name also works at the moment, but won't work if they get renamed.

And: Its not possible to change the order by name to show the latest photos first. It would be great if we could choose between asc and desc order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants