A tool to shard photos across multiple Google Photo accounts
Project description
Sharded-Google-Photos
Description
Running out of space in your Google Photos account? Wish you can upload an unlimited number of photos on Google Photos? Now you can! With this Python library, you can upload your photos to multiple Google Photo Accounts and then share those albums to your main Google Photos account. That way, you get to see all of your photos on one main Google Photos account.
It works like this:
-
Let's say you have three Google Accounts.
-
Install
libmagic -
Install the package by running
pip install sharded-google-photos. -
Import the following code in your
main.pyapp:from sharded_google_photos.backup.gphotos_backup import GPhotosBackup from sharded_google_photos.shared.gphotos_client import GPhotosClient clients = [ GPhotosClient(creds_file = "credentials-1.json", client_secret="client_secret.json"), GPhotosClient(creds_file = "credentials-2.json", client_secret="client_secret.json"), GPhotosClient(creds_file = "credentials-3.json", client_secret="client_secret.json"), ] for client in clients: client.authenticate() backup_client = GPhotosBackup(clients)
-
To upload four photos from two folders, run the following:
new_album_uris = backup_client.backup([ { "modifier": "+", "file_path": "./Archives/Photos/2022/Trip to California/1.jpg", "modifier": "+", "file_path": "./Archives/Photos/2022/Trip to California/2.jpg", "modifier": "+", "file_path": "./Archives/Photos/2022/Trip to Toronto/3.jpg", "modifier": "+", "file_path": "./Archives/Photos/2022/Trip to Toronto/4.jpg", } ]) print(new_album_uris)
What will happen is that it will:
-
A shared read-only album
Archives/Photos/2022/Trip to Californiawill be made in some Google Photos account with the most amount of space available. -
A shared read-only album
Archives/Photos/2022/Trip to Torontowill be made in some Google Photos account with the second most amount of space available. -
Photos
1.jpg, and2.jpgwill be in theArchives/Photos/2022/Trip to Californiaalbum. -
Photos
3.jpg, and4.jpgwill be in theArchives/Photos/2022/Trip to Torontoalbum. -
The url to those new albums will be in
new_album_uristhat you can share to.
-
-
To update a file in a folder, run the following:
backup_client.backup([ { "modifier": "-", "file_path": "./Archives/Photos/2022/Trip to California/1.jpg", "modifier": "+", "file_path": "./Archives/Photos/2022/Trip to California/1.jpg", } ])
-
To delete a file in a folder, run the following:
backup_client.backup([ { "modifier": "-", "file_path": "./Archives/Photos/2022/Trip to California/1.jpg", } ])
Note: it is not possible for the Google Photos API to actually delete a photo from Google Photos. Instead, you can clean your Google Photo accounts by putting all album-less photos into a "Trash" album by running the following script:
from sharded_google_photos.cleanup.gphotos_cleaner import GPhotosCleaner for client in clients: cleaner = GPhotosCleaner(client) cleaner.cleanup()
After running that script, it will put all of the albumless photos into an album called "Trash", and you can log into Google Photos and delete those photos from your account manually.
Getting Started to Contribute
-
Ensure Python3, Pip, and Poetry are installed on your machine
-
Install dependencies by running:
poetry install -
Run the app in CLI mode by running:
poetry run python sharded_google_photos/main.py
-
To lint your code, run:
poetry run flake8 && poetry run black sharded_google_photos/
-
To run tests and code coverage, run:
poetry run coverage run -m pytest && poetry run coverage report -m
-
To publish your app:
-
First, set your PyPI api token to Poetry
poetry config pypi-token.pypi <YOUR_API_TOKEN>
-
Then, build the app by running:
poetry build -
Finally, publish the app by running:
poetry publish
-
Usage
Please note that this project is used for educational purposes and is not intended to be used commercially. We are not liable for any damages/changes done by this project.
Credits
Emilio Kartono, who made the entire project.
License
This project is protected under the GNU licence. Please refer to the LICENSE.txt for more information.
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