Skip to content

Commit

Permalink
Merge branch 'main' into simulot/issue159-Albums-from-subdirectories-…
Browse files Browse the repository at this point in the history
…with-matching-names
  • Loading branch information
simulot committed Mar 23, 2024
2 parents a3ab22c + 156ca3c commit 7ef3a01
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
13 changes: 10 additions & 3 deletions cmd/duplicate/duplicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (

type DuplicateCmd struct {
*cmd.SharedFlags
AssumeYes bool // When true, doesn't ask to the user
DateRange immich.DateRange // Set capture date range
IgnoreTZErrors bool // Enable TZ error tolerance
AssumeYes bool // When true, doesn't ask to the user
DateRange immich.DateRange // Set capture date range
IgnoreTZErrors bool // Enable TZ error tolerance
IgnoreExtension bool // Ignore file extensions when checking for duplicates

assetsByID map[string]*immich.Asset
assetsByBaseAndDate map[duplicateKey][]*immich.Asset
Expand All @@ -32,6 +33,7 @@ type DuplicateCmd struct {
type duplicateKey struct {
Date time.Time
Name string
Type string
}

func NewDuplicateCmd(ctx context.Context, common *cmd.SharedFlags, args []string) (*DuplicateCmd, error) {
Expand All @@ -50,6 +52,7 @@ func NewDuplicateCmd(ctx context.Context, common *cmd.SharedFlags, args []string
cmd.BoolFunc("ignore-tz-errors", "Ignore timezone difference to check duplicates (default: FALSE).", myflag.BoolFlagFn(&app.IgnoreTZErrors, false))
cmd.BoolFunc("yes", "When true, assume Yes to all actions", myflag.BoolFlagFn(&app.AssumeYes, false))
cmd.Var(&app.DateRange, "date", "Process only documents having a capture date in that range.")
cmd.BoolFunc("ignore-extension", "When true, ignores extensions when checking for duplicates (default: FALSE)", myflag.BoolFlagFn(&app.IgnoreExtension, false))
err := cmd.Parse(args)
if err != nil {
return nil, err
Expand Down Expand Up @@ -84,8 +87,12 @@ func DuplicateCommand(ctx context.Context, common *cmd.SharedFlags, args []strin
k := duplicateKey{
Date: d,
Name: strings.ToUpper(a.OriginalFileName + path.Ext(a.OriginalPath)),
Type: a.Type,
}

if app.IgnoreExtension {
k.Name = strings.TrimSuffix(k.Name, path.Ext(a.OriginalPath))
}
l := app.assetsByBaseAndDate[k]
if len(l) > 0 {
dupCount++
Expand Down
2 changes: 1 addition & 1 deletion cmd/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (app *SharedFlags) Start(ctx context.Context) error {

if app.LogFile != "" {
if app.out == nil {
f, err := os.Create(app.LogFile)
f, err := os.OpenFile(app.LogFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o664)
if err != nil {
joinedErr = errors.Join(joinedErr, err)
} else {
Expand Down
4 changes: 4 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ an album per folder Holydays*.

It can handle patterns like : /photo/\*/raw/\*.dmg

### fix: Append Log #182
Log are now appended to the log file


## Release 0.12.0

### fix: #173 [Feature Request:] Set date from file system timestamp
Expand Down
6 changes: 0 additions & 6 deletions e2e.env

This file was deleted.

18 changes: 11 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@

## Key Features:

* **Effortlessly Upload Large Google Photos Takeouts:** Immich-Go excels at handling the massive archives you download from Google Photos using Google Takeout. It efficiently processes these archives while preserving valuable metadata.
* **Leverage Google Photos Metadata:** Immich-Go doesn't just upload your photos; it also imports the associated metadata from Google Photos. This includes details like GPS location, date taken, and album information, ensuring your photos stay organized on your Immich server.
* **Effortlessly Upload Large Google Photos Takeouts:** Immich-Go excels at handling the massive archives you download from Google Photos using Google Takeout. It efficiently processes these archives while preserving valuable metadata like GPS location, date taken, and album information.
* **Flexible Uploads:** Immich-Go isn't limited to Google Photos. You can upload photos directly from your computer folders, folders tree and ZIP archives.
* **Simple Installation:** Forget complex setups! Immich-Go doesn't require NodeJS or Docker for installation. This makes it easy to get started, even for those less familiar with technical environments.
* **Simple Installation:** Immich-Go doesn't require NodeJS or Docker for installation. This makes it easy to get started, even for those less familiar with technical environments.
* **Prioritize Quality, Discard Duplicates:** Immich-Go discards any lower-resolution versions that might be included in Google Photos Takeout, ensuring you have the best possible copies on your Immich server.
* **Duplicate removal:** Remove "logical" duplicates generated when importing full resolution photos and lower resolution photos from the takeout.
* **Stack burst and raw/jpg photos**: Group together related photos in Immich.


## Google Photos Best Practices:

* **Taking Out Your Photos:**
* Choose the ZIP format when creating your takeout for easier import.
* Select the largest file size available (50GB) to ensure all your photos are included.
* Select the largest file size available (50GB) to minimize the number of archive parts.
* Download all parts on your computer

* **Importing Your Photos:**
* If your takeout is in ZIP format, you can import it directly without needing to unzip the files first.
* It's important to import all the parts of the takeout together, since some data might be spread across multiple files.
<br>Use `path/to/your/files/takeout-*.zip` as file name.
* For **.tgz** files (compressed tar archives), you'll need to decompress all the files into a single folder before importing. When using the import tool, include the `-google-photos` option.
<br>Use `/path/to/you/files/takeout-*.zip` as file name.
* For **.tgz** files (compressed tar archives), you'll need to decompress all the files into a single folder before importing. When using the import tool, don't forget the `-google-photos` option.
* You can remove any unwanted files or folders from your takeout before importing. Immich-go might warn you about missing JSON files, but it should still import your photos successfully.
* Restarting an interrupted import won't cause any problems and it will resume the import.
* Restarting an interrupted import won't cause any problems and it will resume the work where it was left.


For insights into the reasoning behind this alternative to `immich-cli`, please read the motivation [here](docs/motivation.md).
Expand All @@ -39,6 +41,7 @@ For insights into the reasoning behind this alternative to `immich-cli`, please

# Executing `immich-go`
The `immich-go` is a command line tool.
The `immich-go` program uses the Immich API. Hence it need the server address and a valid API key.


Expand Down Expand Up @@ -144,6 +147,7 @@ Before deleting the inferior copies, the system get all albums they belong to, a
| `-yes` | Assume Yes to all questions | `FALSE` |
| `-date` | Check only assets have a date of capture in the given range | `1850-01-04,2030-01-01` |
| `-ignore-tz-errors <bool>` | Ignore timezone difference when searching for duplicates | `FALSE` |
| `-ignore-extension` | Ignore filetype extensions when searching for duplicates | `FALSE` |

### Example Usage: clean the `immich` server after having merged a google photo archive and original files

Expand Down

0 comments on commit 7ef3a01

Please # to comment.