{"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 → <\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/posts\/623"}],"collection":[{"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/comments?post=623"}],"version-history":[{"count":3,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/posts\/623\/revisions"}],"predecessor-version":[{"id":626,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/posts\/623\/revisions\/626"}],"wp:attachment":[{"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/media?parent=623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/categories?post=623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.daft-ideas.co.uk\/wp-json\/wp\/v2\/tags?post=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}