Package: google-photos-archiver
google-photos-archiverWhat?Why?How?Development Pre-reqsOptional ReqsGetting StartedGoogle Oauth SetupFirst RunDevelopment Usage... with DockerGeneral UsageRunning testsExamplesSpecify a different download locationDownload from specific dates (with wildcard support)Download Albums and their MediaItems onlyDownload Path HierarchyWhat?google-photos-archiveraims to provide a simple, fast, extensible interface to be able to back up one's Google Photos to a location of their choosing.I've drawn inspiration from projects such as:https://github.com/mholt/timeliner&https://github.com/gilesknap/gphotos-syncbut wanted to cut my teeth in this domain and see what I could come up with myself.Why?I wanted a tool (of my own creation) which could easily provide a copy of mine and my partner's Google Photos libraries, and keep said copy up to date over time.In reality I've mainly just needed a distraction from the vicious cycle of wake, work, Netflix, sleep, and I thought it was high time to do a little side project.How?Development Pre-reqsdocker... Orpython==3.8poetry>=1.0.0Optional Reqspre-commitRunpre-commit installGetting StartedGoogle Oauth SetupThese instructions will help you set up Google OAuth2 client credentials so you can start usinggoogle-photos-archiverWhile logged into your Google account navigate toCreate a New ProjectCreate one, and switch to using it with the UI dropdownNavigate toAPIs & Servicesclick on+ Enable APIs and services, and enable thePhotos Library APINavigate back toAPIs & Servicesand click onCredentialsClick on+ Create Credentials > OAuth client IDConfigure an OAuth consent screen. You can just fill out the required fields and hit Save.ClickAdd Or Remove Scopesand manually add scope:https://www.googleapis.com/auth/photoslibrary.readonlyAccept remaining defaults, save through and return toCredentialsClick on+ Create Credentials > OAuth client IDMake a"Desktop App"Congrats!, you now have a Client ID and Client SecretDownload the associatedclient_secret.jsonfile and make note of its location as we'll be providing it's path togoogle-photos-archiverFirst RunA browser window will be opened during the initial OAuth flow. After successfully authenticating once, a refresh token will be stored for future use (See:--refresh-token-path) and will omit the need to reauthenticate.Development Usage$ git clone git@github.com:scottx611x/google-photos-archiver.git
$ poetry install
$ poetry run google-photos-archiver --help... with DockerNote that some more Docker volume mounting will be warranted here if you want to specify a different path to download to etc.
Ref:https://docs.docker.com/storage/volumes$ docker build . -t google-photos-archiver
$ docker run -v $PWD:/app/ google-photos-archiver  --helpGeneral Usage$ pip install google-photos-archiver
$ google-photos-archiver --helpRunning tests$ poetry run pytestExamplesSpecify a different download location$ google-photos-archiver archive-media-items --download-path /Volumes/my-big-hdd/downloaded_mediaDownload from specific dates (with wildcard support)$ google-photos-archiver archive-media-items --date-filter 2020/*/*,2021/8/22
$ google-photos-archiver archive-media-items --date-range-filter 2019/8/22-2020/8/22Download Albums and their MediaItems only$ google-photos-archiver archive-media-items --albums-onlyDownload Path Hierarchy$ tree /<download_path>/downloaded_media/ | head
/<download_path>/downloaded_media/
├── 2021
│ └── 1
│     ├── 1
│     │ └── a.jpg
│     └── 2
│         └── b.mov
├── 2020
│ ├── 1
│ │ └── 2
│ │     └── c.jpg
│ └── 2
│     └── 3
│         └── d.jpg
└── albums
    └── Album A
        └── <symlink /<download_path>/downloaded_media/2021/1/1/a.jpg >
...