Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions adapters/fromimmich/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,17 @@ func (fic *FromImmichCmd) getAssets(ctx context.Context, grpChan chan *assets.Gr
return err
}

// Transfer the album
simplifiedA, err := fic.client.Immich.GetAssetAlbums(ctx, a.ID)
if err = fic.app.ProcessError(err); err != nil {
return err
}
albums := immich.AlbumsFromAlbumSimplified(simplifiedA)

asset := a.AsAsset()
asset.SetNameInfo(fic.ic.GetInfo(asset.OriginalFileName))
asset.File = fshelper.FSName(fic.ifs, a.ID)

asset.FromApplication = &assets.Metadata{
FileName: a.OriginalFileName,
Latitude: a.ExifInfo.Latitude,
Expand All @@ -396,10 +406,10 @@ func (fic *FromImmichCmd) getAssets(ctx context.Context, grpChan chan *assets.Gr
Archived: a.IsArchived,
Favorited: a.IsFavorite,
Rating: byte(a.ExifInfo.Rating),
Albums: albums,
Tags: asset.Tags,
}
asset.UseMetadata(asset.FromApplication)
asset.File = fshelper.FSName(fic.ifs, a.ID)

// Record asset discovery
code := fileevent.DiscoveredImage
Expand All @@ -408,20 +418,11 @@ func (fic *FromImmichCmd) getAssets(ctx context.Context, grpChan chan *assets.Gr
}
fic.processor.RecordAssetDiscovered(ctx, asset.File, int64(asset.FileSize), code)

// Transfer the album
simplifiedA, err := fic.client.Immich.GetAssetAlbums(ctx, a.ID)
if err = fic.app.ProcessError(err); err != nil {
return err
}

albums := immich.AlbumsFromAlbumSimplified(simplifiedA)
// clear the ID of the album that exists in from server, but not in to server
for i := range albums {
albums[i].ID = ""
for i := range asset.Albums {
asset.Albums[i].ID = ""
}

asset.Albums = albums

// Transfer tags
for t := range asset.Tags {
asset.Tags[t].ID = ""
Expand Down