Skip to content

Commit

Permalink
show procecessed in no-gui mode
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Jun 1, 2024
1 parent 7e5bede commit 26204a9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,28 @@ func (app *UpCmd) runNoUI(ctx context.Context) error {
if maxImmich > 0 {
immichPct = 100 * currImmich / maxImmich
}
ScannedAssets := counts[fileevent.DiscoveredImage] + counts[fileevent.DiscoveredVideo]
ProcessedAssets := counts[fileevent.UploadNotSelected] +
counts[fileevent.UploadUpgraded] +
counts[fileevent.UploadServerDuplicate] +
counts[fileevent.UploadServerBetter] +
counts[fileevent.Uploaded] +
counts[fileevent.AnalysisLocalDuplicate] + counts[fileevent.AnalysisMissingAssociatedMetadata]
if app.GooglePhotos {
gpPct := 0
upPct := 0
if counts[fileevent.DiscoveredImage]+counts[fileevent.DiscoveredVideo] > 0 {
gpPct = int(100 * counts[fileevent.AnalysisAssociatedMetadata] / (counts[fileevent.DiscoveredImage] + counts[fileevent.DiscoveredVideo]))
if ScannedAssets > 0 {
gpPct = int(100 * counts[fileevent.AnalysisAssociatedMetadata] / ScannedAssets)
upPct = int(100 * (counts[fileevent.UploadNotSelected] +
counts[fileevent.UploadUpgraded] +
counts[fileevent.UploadServerDuplicate] +
counts[fileevent.UploadServerBetter] +
counts[fileevent.Uploaded] +
counts[fileevent.AnalysisLocalDuplicate]) /
(counts[fileevent.DiscoveredImage] + counts[fileevent.DiscoveredVideo]))
counts[fileevent.AnalysisLocalDuplicate]) / ScannedAssets)
}
s = fmt.Sprintf("\rImmich read %d%%, Google Photos Analysis: %d%%, Uploaded %d%% %s", immichPct, gpPct, upPct, string(spinner[spinIdx]))
} else {
s = fmt.Sprintf("\rImmich read %d%%, Uploaded %d %s", immichPct, counts[fileevent.Uploaded], string(spinner[spinIdx]))
s = fmt.Sprintf("\rImmich read %d%%, Processed %d, Uploaded %d %s", immichPct, ProcessedAssets, counts[fileevent.Uploaded], string(spinner[spinIdx]))
}
spinIdx++
if spinIdx == len(spinner) {
Expand Down Expand Up @@ -652,8 +658,8 @@ func (app *UpCmd) handleAsset(ctx context.Context, a *browser.LocalAssetFile) er
if err != nil {
app.Jnl.Record(ctx, fileevent.UploadServerError, a, a.FileName, "error", err.Error())
}
time.Sleep(2 * time.Millisecond)
}
time.Sleep(2 * time.Millisecond)
return nil
}

Expand Down

0 comments on commit 26204a9

Please sign in to comment.