{"id":623,"date":"2020-11-24T10:25:43","date_gmt":"2020-11-24T10:25:43","guid":{"rendered":"https:\/\/blog.daft-ideas.co.uk\/?p=623"},"modified":"2020-11-24T10:30:55","modified_gmt":"2020-11-24T10:30:55","slug":"google-photos-takeout","status":"publish","type":"post","link":"https:\/\/blog.daft-ideas.co.uk\/2020\/11\/24\/google-photos-takeout\/","title":{"rendered":"Google Photos Takeout"},"content":{"rendered":"\n
Recently my wife found that she was nearly at capacity of the free storage on Google Photos. We decided that we’d replace it with the Nextcloud instance I run, so photos she takes are now being uploaded to Nextcloud and then transferred to our NAS.<\/p>\n\n\n\n
We wanted the existing photos from Google to be accessible from the same place, so we did a Google Takeout.<\/p>\n\n\n\n
Once we’d got the photos, I needed to parse the metadata that google stored about each one, so they could be transferred to the correct Folder.<\/p>\n\n\n\n
Bash script for scraping metadata and moving photos to correct location<\/p>\n\n\n\n
find . -name '*json' | while read line; do\necho \"----------------------------------------\"\n echo \"Processing file '$line'\"\n real=\"${line%.*}\"\n\necho \"Actual file '$real'\"\n#temp=$(echo $line)\n#echo $temp\n#jq \".\" \"$line\"\n#echo 'running jq jq .googlePhotosOrigin.mobileUpload.deviceFolder.localFolderName $(line)'\nfolder=$(jq -r .googlePhotosOrigin.mobileUpload.deviceFolder.localFolderName \"$line\")\ntimestamp=$(jq -r .photoTakenTime.timestamp \"$line\")\necho \"timestamp is $timestamp\"\nyear=$(date -r $timestamp +'%Y')\nmonth=$(date -r $timestamp +'%m')\necho \"result is $folder\"\necho \"taken $year $month\"\nnulstr=\"null\"\nempstr=\"\"\nif [ \"$folder\" == \"$nulstr\" ]; then\nfolder=Camera\nfi\nif [ \"$folder\" == \"$empstr\" ]; then\nfolder=Camera\nfi<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"Recently my wife found that she was nearly at capacity of the free storage on Google Photos. We decided that we’d replace it with the Nextcloud instance I run, so photos she takes are now being uploaded to Nextcloud and then transferred to our NAS. We wanted the existing photos… Continue reading