-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Incorrect date and time #330
Comments
I’m fine with the file name being UTC based on gps data, which works. But the modification and creation time is neither UTC or local time which is just weird? What is it then? As for images without exif, the date and time is set to the current system time (-1 hour) which is obviously wrong. This means that all my images without exif basically has their time and date removed (set to current system time). I don’t believe any of this is addressed in the issue and PR mentioned. |
To clarify, EXIF does not contain time zone information so it's not in UTC. Instead whatever offset there existed is lost. If I took the photo in UTC+7 then Elodie sees it at just UTC and loses the +7 [source]. That being said, the time used when a photo does not have EXIF should be the earlier of |
Sorry if I'm explaining this poorly. First of all, Elodie renames my photos such that the date/time in the filename is 2 hours behind the Exif date. If this is correct behavior, as I'm assuming, we can go back to the issues I described:
I believe the desired behavior is to set modification date/time to the same as the filename (in UTC), so that in my case the date would appear two hours ahead, is this correct? Again sorry if I'm not making any sense, but I am finding all this quite confusing myself. |
Okay, so I managed to debug the first issue (images without exif). media.set_original_name()
metadata = media.get_metadata() makes exiftool overwrite the source file, which then has it's modification time changed, and then afterward we get the metadata (with wrong modification time). Maybe the problem can be solved by swapping these lines? |
Thanks for the explanation. When no EXIF is available: On UNIX systems there's no record kept of when a file was created - only modified and accessed. It's there on Windows but we're not doing anything Windows-specific here. That being said, I don't believe swapping the lines will help. When EXIF is available: #310 should address this though by applying the offset based off the location data in EXIF. I also added a todo on that PR to include tests to ensure it applies when updating the location of a photo or the date (i.e. changing the location of a photo should apply the appropriate timezone offset). |
Alright, turns out you were correct. Can you confirm if the fix in PR #331 addresses your issue? I added a test and here's the failure and passing after a change. Failure before change
Passing after fix
|
Thanks for the quick response and fixes. Yes, #331 fixes the first issue such that the modified date is taken into account. However, the resulting image file still has a modified date that's 1 hour before the source image. I have not looked over #310, but indeed considering location data would probably solve this and most timezone related problems. Edit: After examining this a bit more, I have opened a PR #332, which fixes my remaining issue. |
@jmathai I think this issue needs to be re-opened. I have a library of images which I had recently imported using Now, when I started updating the location of those images, the images which did not have DateTime data in their Exif, were getting modified to the current timestamp (and losing their original timestamp). Fortunately, I had a backup. To quickly reproduce the issue, you can try it out using a sample image: mkdir elodie-testing; cd elodie-testing;
mkdir source destination
#Download a sample image:
wget https://i.imgur.com/jGwDTpL.jpg -O source/image.jpg
#Its timestamp would be June 2017:
find . -type f -exec ls -l {} \;
#Import would work fine:
elodie.py import --destination="destination" source
#Check that the Timestamp was intact after import:
find . -type f -exec ls -l {} \;
#This will now mess up the timestamp:
elodie.py update --location "Bengaluru" destination/2017-06-Jun/Unknown\ Location/2017-06-27_00-31-20-image.jpg
#You can now see that the timestamp has been modified to the current datetime
find . -type f -exec ls -l {} \;
|
When I run Elodie on an image without Exif data, but with correct creation date and modification date, the file is copied such that the creation date and modification are changed to be exactly 1 hour before I ran elodie, this also affects the file name date which is 2 hour before.
Also, when I run it on an image with Exif data, it appears to work, but the creation and modification date are set to 1 hour before the date in Exif, and the filename is 1 hour before that (so 2 hours before the Exif date).
I'm not sure if this has something to do with timezones since I'm in UTC+2, but clearly, something isn't correct.
I'm using OS X 10.11.6.
The text was updated successfully, but these errors were encountered: