A library that sorts Google Takeout Photos by their creation date with metadata preserved.
Project description
██████╗ ██████╗ ████████╗████████╗
██╔════╝ ██╔══██╗╚══██╔══╝╚══██╔══╝
██║ ███╗██████╔╝ ██║ ██║
██║ ██║██╔═══╝ ██║ ██║
╚██████╔╝██║ ██║ ██║
╚═════╝ ╚═╝ ╚═╝ ╚═╝
----------------------------
google photos takeout toolkit
Table of Contents
- Why did I create this?
- What does gphotos_takeout_toolkit do?
- How to run?
- CLI
- Edge cases
- Metrics
- Roadmap
Why did I create this?
Well, my parents asked me to move all of their google photos to an external SSD drive. I saw how many photos they had and didn't want to do it manually so I decided to create a library that will do it for me.
What does gphotos_takeout_toolkit do?
This library sorts photos from Google Takeout and merges their missing metadata. Metadata is exported along with the file and has almost the same name. Files are moved according to this convention:
├── Your destination folder
├── videos
├── user (you could name it however you want, it sets to `user` folder by default)
├── photos_from_2024_11_05_by_user
├── photo.jpg
How to run?
Prerequisites
To be able to use this library, you need to have ExifTool installed on your machine as that is the required tool to restore metadata. Library checks whether you have it installed or not.
Windows/Mac
https://exiftool.org
Ubuntu
sudo apt install libimage-exiftool-perl
CentOS/RHEL
yum install perl-Image-ExifTool
Arch
sudo pacman -S perl-image-exiftool
Dependencies
Installation
To use gphotos_takeout_toolkit, you will need python 3.11+ (earlier versions will not work due to the lack of support).
Create a virtual environment:
python -m venv .venv
source ./.venv/bin/activate
From PyPi
Pip installation:
pip install gphotos_takeout_toolkit
Uv installation:
uv add gphotos_takeout_toolkit
From source
Clone the project on your local machine:
https://github.com/joludyaster/gphotos_takeout_toolkit.git
Run:
pip install .
And to make sure that everything is fine, run these commands to check whether the library has all needed dependencies:
gphotos_takeout_toolkit --help
python -m gphotos_takeout_toolkit
CLI
Main
Usage: gphotos_takeout_toolkit [OPTIONS] COMMAND [ARGS]...
Options:
--version, -V Show version and exit. │ │
--help Show this message and exit.
Commands:
organize Command to sort, organize and
merge metadata of the files.
Examples:
gphotos_takeout_toolkit --version
gphotos_takeout_toolkit --V
Organize
Usage: gphotos_takeout_toolkit organize [OPTIONS] INPUT_PATH DESTINATION_PATH
Options:
--owner-name, -o TEXT Owner of the folders. [default: user] │
--additional-file-move, -a Additionally move all files into one folder. │
--enable-verbosity, -v Enable verbosity to see all the logs in the console. │
--help Show this message and exit.
Examples:
gphotos_takeout_toolkit organize input_path destination_path -o jack -a -v
gphotos_takeout_toolkit organize input_path destination_path --owner-name jack --additional-file-move --enable-verbosity
gphotos_takeout_toolkit organize input_path destination_path -a -v
Metrics
Here I've performed some of the tests to see how long it takes to organize the files:
| Source | Size | Number of files | Time |
|---|---|---|---|
| folder | 26.9GB | 1501 | ~33m |
Edge cases
While the library handles majority of the tricky situations, there are moments where it's simply impossible to move or get a metadata for the file.
Here are some of the reasons:
- Not a valid JPG (looks more like a RIFF) - means that an actual type of the file is not supported by ExifTool, usually it's Webp.
- When a file name looks like this
Screenshot_2023-10-16-21-47-42-334_com.zhiliaoa.jpgorB5RjaEjPAEjbhnWhlB9JEJoo9M7dvFU-EmZgZseQH1kHdcC.jpg, google either strips the names or replaces some of the characters in the file name. Since this library iterates through JSON files first, it won't find a corresponding filename, therefore it won't be moved.
Roadmap
- Merge metadata and a file that's being moved.
- Allow users to modify how the folders are made and what structure to follow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gphotos_takeout_toolkit-0.4.0.tar.gz.
File metadata
- Download URL: gphotos_takeout_toolkit-0.4.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03ffb9d8d3e46ae1c417f74c66952f8c35bef166a8662c257e07f4e379faa34a
|
|
| MD5 |
bf6ecf9cda24c105a12d5f332d582169
|
|
| BLAKE2b-256 |
3bd575515af2ac551f704941e11803ea7f71d0035b0a780b22aa1ed541ece7b1
|
File details
Details for the file gphotos_takeout_toolkit-0.4.0-py3-none-any.whl.
File metadata
- Download URL: gphotos_takeout_toolkit-0.4.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aa1f4f6c45a190097c3b11def24846b73ee4ef7a186c00d988aa7a382157ea6
|
|
| MD5 |
c201d8caa9df9ff633eca45aa60c1dfd
|
|
| BLAKE2b-256 |
542384ee952a8e0261961b3e1a3f2dd67d9515e9c47bcc04c132244e69a6ed6b
|