Skip to content

Commit f7153cd

Browse files
committed
People: Improve logging, command help, and handling of broken files #22
1 parent 00ced81 commit f7153cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+870
-719
lines changed

frontend/package-lock.json

Lines changed: 445 additions & 431 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/dialog/photo/files.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
@click.stop.prevent="downloadFile(file)">
4242
<translate>Download</translate>
4343
</v-btn>
44-
<v-btn v-if="features.edit && file.Type === 'jpg' && !file.Primary" small depressed dark
44+
<v-btn v-if="features.edit && file.Type === 'jpg' && file.Error === '' && !file.Primary" small depressed dark
4545
color="primary-button"
4646
class="ma-0 action-primary"
4747
@click.stop.prevent="primaryFile(file)">
4848
<translate>Primary</translate>
4949
</v-btn>
50-
<v-btn v-if="features.edit && !file.Sidecar && !file.Primary && file.Root === '/'" small
50+
<v-btn v-if="features.edit && !file.Sidecar && file.Error === '' && !file.Primary && file.Root === '/'" small
5151
depressed dark color="primary-button"
5252
class="ma-0 action-unstack"
5353
@click.stop.prevent="unstackFile(file)">
@@ -66,6 +66,12 @@
6666
</td>
6767
<td>{{ file.UID | uppercase }}</td>
6868
</tr>
69+
<tr v-if="file.Error">
70+
<td>
71+
<translate>Error</translate>
72+
</td>
73+
<td><span class="body-2">{{ file.Error | uppercase }}</span></td>
74+
</tr>
6975
<tr v-if="file.InstanceID" title="XMP">
7076
<td>
7177
<translate>Instance ID</translate>
@@ -162,12 +168,6 @@
162168
</td>
163169
<td>{{ file.Chroma }} / 100</td>
164170
</tr>
165-
<tr v-if="file.Error">
166-
<td>
167-
<translate>Error</translate>
168-
</td>
169-
<td>{{ file.Error }}</td>
170-
</tr>
171171
<tr v-if="file.Missing">
172172
<td>
173173
<translate>Missing</translate>

internal/api/covers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ func AlbumCover(router *gin.RouterGroup) {
7676
f, err := query.AlbumCoverByUID(uid)
7777

7878
if err != nil {
79-
log.Debugf("%s: no photos yet, using generic image for %s", albumCover, uid)
79+
log.Debugf("%s: %s contains no photos, using generic cover", albumCover, uid)
8080
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
8181
return
8282
}
8383

8484
fileName := photoprism.FileName(f.FileRoot, f.FileName)
8585

8686
if !fs.FileExists(fileName) {
87-
log.Errorf("%s: could not find original for %s", albumCover, fileName)
87+
log.Errorf("%s: found no original for %s", albumCover, fileName)
8888
c.Data(http.StatusOK, "image/svg+xml", albumIconSvg)
8989

9090
// Set missing flag so that the file doesn't show up in search results anymore.

internal/api/covers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func TestAlbumCover(t *testing.T) {
1515

1616
assert.Equal(t, http.StatusOK, r.Code)
1717
})
18-
t.Run("album has no photo (because is not existing)", func(t *testing.T) {
18+
t.Run("album contains no photos (because is not existing)", func(t *testing.T) {
1919
app, router, conf := NewApiTest()
2020
AlbumCover(router)
2121
r := PerformRequest(app, "GET", "/api/v1/albums/987-986435/t/"+conf.PreviewToken()+"/tile_500")

internal/api/folder_cover.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func FolderCover(router *gin.RouterGroup) {
8585
f, err := query.FolderCoverByUID(uid)
8686

8787
if err != nil {
88-
log.Debugf("%s: no photos yet, using generic image for %s", folderCover, uid)
88+
log.Debugf("%s: %s contains no photos, using generic cover", folderCover, uid)
8989
c.Data(http.StatusOK, "image/svg+xml", folderIconSvg)
9090
return
9191
}

internal/api/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func StartImport(router *gin.RouterGroup) {
7777
}
7878

7979
if len(f.Albums) > 0 {
80-
log.Debugf("import: files will be added to album %s", strings.Join(f.Albums, " and "))
80+
log.Debugf("import: adding files to album %s", strings.Join(f.Albums, " and "))
8181
opt.Albums = f.Albums
8282
}
8383

internal/api/photo_unstack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ func PhotoUnstack(router *gin.RouterGroup) {
8181
AbortEntityNotFound(c)
8282
return
8383
} else if related.Len() == 0 {
84-
log.Errorf("photo: no files found for %s (unstack)", txt.Quote(baseName))
84+
log.Errorf("photo: found no files for %s (unstack)", txt.Quote(baseName))
8585
AbortEntityNotFound(c)
8686
return
8787
} else if related.Main == nil {
88-
log.Errorf("photo: no main file found for %s (unstack)", txt.Quote(baseName))
88+
log.Errorf("photo: found no main file for %s (unstack)", txt.Quote(baseName))
8989
AbortEntityNotFound(c)
9090
return
9191
}

internal/commands/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func configAction(ctx *cli.Context) error {
8585
fmt.Printf("%-25s %s\n", "site-url", conf.SiteUrl())
8686
fmt.Printf("%-25s %s\n", "site-preview", conf.SitePreview())
8787
fmt.Printf("%-25s %s\n", "site-title", conf.SiteTitle())
88+
fmt.Printf("%-25s %s\n", "site-author", conf.SiteAuthor())
8889
fmt.Printf("%-25s %s\n", "site-caption", conf.SiteCaption())
8990
fmt.Printf("%-25s %s\n", "site-description", conf.SiteDescription())
90-
fmt.Printf("%-25s %s\n", "site-author", conf.SiteAuthor())
9191
fmt.Printf("%-25s %s\n", "cdn-url", conf.CdnUrl("/"))
9292
fmt.Printf("%-25s %s\n", "content-uri", conf.ContentUri())
9393
fmt.Printf("%-25s %s\n", "static-uri", conf.StaticUri())

internal/commands/faces.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var FacesCommand = cli.Command{
3535
Flags: []cli.Flag{
3636
cli.BoolFlag{
3737
Name: "fix, f",
38-
Usage: "issues will be fixed automatically",
38+
Usage: "automatically fixes issues",
3939
},
4040
},
4141
Action: facesAuditAction,
@@ -46,7 +46,7 @@ var FacesCommand = cli.Command{
4646
Flags: []cli.Flag{
4747
cli.BoolFlag{
4848
Name: "force, f",
49-
Usage: "remove all people and faces",
49+
Usage: "removes all people and faces",
5050
},
5151
},
5252
Action: facesResetAction,
@@ -63,7 +63,7 @@ var FacesCommand = cli.Command{
6363
Flags: []cli.Flag{
6464
cli.BoolFlag{
6565
Name: "force, f",
66-
Usage: "update all faces",
66+
Usage: "updates all faces",
6767
},
6868
},
6969
Action: facesUpdateAction,

internal/commands/index_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ func TestIndexCommand(t *testing.T) {
4848
// Expected index command output.
4949
assert.Contains(t, output, "indexing originals")
5050
assert.Contains(t, output, "classify: loading labels")
51-
assert.Contains(t, output, "index: no .ppignore file found")
52-
assert.Contains(t, output, "index: updating primary files")
53-
assert.Contains(t, output, "index: flagging hidden files")
51+
assert.Contains(t, output, "index: found no .ppignore file")
5452
} else {
5553
t.Fatal("log output missing")
5654
}

0 commit comments

Comments
 (0)