Zaczero / google-photos-takeout.sh

🔧 Fixes Google Photos Takeout metadata
GNU Affero General Public License v3.0
11 stars 4 forks source link

Duplicate Name Disambiguation Issue #2

Closed RobLaw0304 closed 9 months ago

RobLaw0304 commented 1 year ago

If you have uploaded multiple files to Google which end up in the same folder in your Google Takeout that had the same original upload name, Google names the jpg and json files differently. This causes the google-photos-takeout.sh script to assign all identically named JSON files to the base jpg instead of a 1:1 mapping you'd expect.

Example: I have four files named IMG_0484.JPG that I upload to Google Photos. In my Google Takeout, I end up with four image files, IMG_0484.JPG, IMG_0484(1).JPG, IMG_0484(2).JPG, IMG_0484(3).JPG and four json files IMG_0484.JPG.json, IMG_0484.JPG(1).json, IMG_0484.JPG(2).json, IMG_0484.JPG(3).json,

google-photos-takeout.sh assigns as such:

[14120/129828] ./Photos from 2012/IMG_0484.JPG(1).json : ./Photos from 2012/IMG_0484.JPG
[14121/129828] ./Photos from 2012/IMG_0484.JPG(2).json : ./Photos from 2012/IMG_0484.JPG
[14122/129828] ./Photos from 2012/IMG_0484.JPG(3).json : ./Photos from 2012/IMG_0484.JPG
[14123/129828] ./Photos from 2012/IMG_0484.JPG.json : ./Photos from 2012/IMG_0484.JPG

This is what is expected:

[14120/129828] ./Photos from 2012/IMG_0484.JPG(1).json : ./Photos from 2012/IMG_0484(1).JPG
[14121/129828] ./Photos from 2012/IMG_0484.JPG(2).json : ./Photos from 2012/IMG_0484(2).JPG
[14122/129828] ./Photos from 2012/IMG_0484.JPG(3).json : ./Photos from 2012/IMG_0484(3).JPG
[14123/129828] ./Photos from 2012/IMG_0484.JPG.json : ./Photos from 2012/IMG_0484.JPG

This occurred for a huge number of my files since over the years many cameras from different families have been used which coincidentally had the same naming scheme.

RobLaw0304 commented 1 year ago

Here is the content of IMG_0484.JPG(1).json (you can see it still carries the base title though google renamed the image for takeout): { "title": "IMG_0484.JPG", "description": "", "imageViews": "3", "creationTime": { "timestamp": "1662837354", "formatted": "Sep 10, 2022, 7:15:54 PM UTC" }, "photoTakenTime": { "timestamp": "1350849177", "formatted": "Oct 21, 2012, 7:52:57 PM UTC" }, "geoData": { "latitude": 0.0, "longitude": 0.0, "altitude": 0.0, "latitudeSpan": 0.0, "longitudeSpan": 0.0 }, "geoDataExif": { "latitude": 0.0, "longitude": 0.0, "altitude": 0.0, "latitudeSpan": 0.0, "longitudeSpan": 0.0 }, "url": "<A GOOGLE URL>", "googlePhotosOrigin": { "webUpload": { "computerUpload": { } } } }

RobLaw0304 commented 1 year ago

Added #3 to address this use case.

Zaczero commented 1 year ago

"title": "IMG_0484.JPG" this is so unexpected and so stupid, I really wanted to avoid filename based operations but it looks like it's not longer possible. I'll review the PR when I have some more time. Thanks!

RobLaw0304 commented 1 year ago

I agree!!! Thanks for your work on this. This was by far the simplest and most effective scripted solution I found.

Zaczero commented 9 months ago

This is now fixed, thank you for the contribution!