Skip to content

Commit

Permalink
chore: better report exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Dec 24, 2023
1 parent 3e07fe1 commit ae2938f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmdupload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,35 +316,35 @@ func (app *UpCmd) handleAsset(ctx context.Context, a *browser.LocalAssetFile) er
}()
app.mediaCount++

ext := path.Ext(a.FileName)
if _, err := fshelper.MimeFromExt(ext); err != nil {
app.journalAsset(a, logger.DISCARDED, "not recognized extension")
return nil
}
// ext := path.Ext(a.FileName)
// if _, err := fshelper.MimeFromExt(ext); err != nil {
// app.journalAsset(a, logger.NOT_SELECTED, "not recognized extension")
// return nil
// }

if !app.KeepPartner && a.FromPartner {
app.journalAsset(a, logger.DISCARDED, "partners discarded")
app.journalAsset(a, logger.NOT_SELECTED, "partners asset excluded")
return nil
}

if !app.KeepTrashed && a.Trashed {
app.journalAsset(a, logger.DISCARDED, "trashed discarded")
app.journalAsset(a, logger.NOT_SELECTED, "trashed asset excluded")
return nil
}

if len(app.ImportFromAlbum) > 0 && !app.isInAlbum(a, app.ImportFromAlbum) {
app.journalAsset(a, logger.DISCARDED, "not in the requested album")
app.journalAsset(a, logger.NOT_SELECTED, "asset excluded because not from the required album")
return nil
}

if app.DateRange.IsSet() {
d := a.DateTaken
if d.IsZero() {
app.journalAsset(a, logger.DISCARDED, "date range import, impossible to get the date of capture")
app.journalAsset(a, logger.NOT_SELECTED, "asset excluded because the date of capture is unknown and a date range is required.")
return nil
}
if !app.DateRange.InRange(d) {
app.journalAsset(a, logger.DISCARDED, "date of capture out of the date range")
app.journalAsset(a, logger.NOT_SELECTED, "asset excluded because the date of capture out of the date range")
return nil
}
}
Expand Down
1 change: 1 addition & 0 deletions logger/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func (j *Journal) Report() {
j.Logger.OK("--------------------------------------------------------")

j.Logger.OK("%6d files with metadata", j.counts[ASSOCIATED_META])
j.Logger.OK("%6d discarded files because of options", j.counts[NOT_SELECTED])
j.Logger.OK("%6d discarded files because duplicated in the input", j.counts[LOCAL_DUPLICATE])
j.Logger.OK("%6d files already on the server", j.counts[SERVER_DUPLICATE])
j.Logger.OK("%6d uploaded files on the server", j.counts[UPLOADED])
Expand Down

0 comments on commit ae2938f

Please # to comment.