Skip to content

Commit

Permalink
feat: control archived google photos
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Dec 30, 2023
1 parent 0e9c8a4 commit 1782249
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmdupload/e2e_upload_folder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func Test_DescriptionAndFavorite(t *testing.T) {
name: "Test_DescriptionAndFavorite",
args: []string{
"-google-photos",
"-discard-archived",
"TEST_DATA/Takeout1",
},
resetImmich: true,
Expand Down
11 changes: 11 additions & 0 deletions cmdupload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type UpCmd struct {
CreateStacks bool // Stack jpg/raw/burst (Default: TRUE)
StackJpgRaws bool // Stack jpg/raw (Default: TRUE)
StackBurst bool // Stack burst (Default: TRUE)
DiscardArchived bool // Don't import archived assets (Default: FALSE)

BrowserConfig Configuration

Expand Down Expand Up @@ -136,6 +137,10 @@ func NewUpCmd(ctx context.Context, ic iClient, log logger.Logger, args []string)
"use-album-folder-as-name",
" google-photos only: Use folder name and ignore albums' title (default:FALSE)", myflag.BoolFlagFn(&app.UseFolderAsAlbumName, false))

cmd.BoolFunc(
"discard-archived",
" google-photos only: Do not import archived photos (default FALSE)", myflag.BoolFlagFn(&app.DiscardArchived, false))

cmd.BoolFunc(
"create-stacks",
"Stack jpg/raw or bursts (default TRUE)", myflag.BoolFlagFn(&app.CreateStacks, true))
Expand Down Expand Up @@ -332,6 +337,11 @@ func (app *UpCmd) handleAsset(ctx context.Context, a *browser.LocalAssetFile) er
return nil
}

if app.DiscardArchived && a.Archived {
app.journalAsset(a, logger.NOT_SELECTED, "asset excluded because archives are discarded")
return nil
}

if app.DateRange.IsSet() {
d := a.DateTaken
if d.IsZero() {
Expand Down Expand Up @@ -474,6 +484,7 @@ func (app *UpCmd) handleAsset(ctx context.Context, a *browser.LocalAssetFile) er
shouldUpdate = shouldUpdate || a.Favorite
shouldUpdate = shouldUpdate || a.Longitude != 0 || a.Latitude != 0
shouldUpdate = shouldUpdate || !a.DateTaken.IsZero()
shouldUpdate = shouldUpdate || a.Archived

if !app.DryRun && shouldUpdate {
_, err := app.client.UpdateAsset(ctx, ID, a)
Expand Down
5 changes: 4 additions & 1 deletion docs/releases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Release notes

## Release next
## Release 0.9.6

### feat: control archived Google photos
`-discard-archived` deactivate the import of archived photos.

### feat: better handling of boolean flags
Just mention the `-flag` to activate the functionality
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ Fine-tune import based on specific dates:<br>

### Google photos options:

Specialized options for Google Photos management:
Specialized options for Google Photos management:<br>
`-google-photos` import from a Google Photos structured archive, recreating corresponding albums.<br>
`-from-album "GP Album"` Create the album in `immich` and import album's assets.<br>
`-create-albums <bool>` Controls creation of Google Photos albums in Immich (default TRUE). <br>
`-keep-untitled-albums <bool>` Untitled albums are imported into `immich` with the name of the folder as title (default: FALSE).<br>
`-use-album-folder-as-name <bool>` Use the folder's name instead of the album title (default: FALSE).<br>
`-keep-partner <bool>` Specifies inclusion or exclusion of partner-taken photos (default: TRUE).<br>
`-partner-album "partner's album"` import assets from partner into given album.<br>
`-discard-archived <bool>` don't import archived assets (default: FALSE). <br>

Read [here](docs/google-takeout.md) to understand how Google Photos takeout isn't easy to handle.

Expand Down

0 comments on commit 1782249

Please sign in to comment.