Config: Rename XMP face import option

This commit is contained in:
Ömer Duran 2026-07-13 14:10:26 +02:00
parent 68734b0290
commit b46b7a67af
No known key found for this signature in database
GPG key ID: 2550B0D579890013
13 changed files with 26 additions and 22 deletions

View file

@ -36,7 +36,7 @@ export class ConfigOptions extends Model {
DisableJpegXL: $config.values.disable.jpegxl,
DisableRaw: $config.values.disable.raw,
DetectNSFW: false,
XmpFaces: false,
XMPFaces: false,
UploadNSFW: $config.values.uploadNSFW,
RawPresets: false,
ThumbUncached: true,

View file

@ -134,7 +134,7 @@
<v-col cols="12" sm="6" lg="3">
<v-checkbox
v-model="settings.XmpFaces"
v-model="settings.XMPFaces"
:disabled="isDemo"
class="ma-0 pa-0 input-xmp-faces"
density="compact"

View file

@ -836,7 +836,7 @@
"WallpaperUri": {
"type": "string"
},
"XmpFaces": {
"XMPFaces": {
"type": "boolean"
}
},

View file

@ -87,9 +87,9 @@ func (c *Config) DisableFaces() bool {
return false
}
// XmpFaces checks if importing face regions and names from XMP metadata is enabled.
func (c *Config) XmpFaces() bool {
return c.options.XmpFaces
// XMPFaces checks if importing face regions and names from XMP metadata is enabled.
func (c *Config) XMPFaces() bool {
return c.options.XMPFaces
}
// DisableClassification checks if image classification is disabled.

View file

@ -118,13 +118,17 @@ func TestConfig_DisableFaces(t *testing.T) {
assert.False(t, c.DisableFaces())
}
func TestConfig_XmpFaces(t *testing.T) {
c := NewConfig(CliTestContext())
assert.False(t, c.XmpFaces())
c.options.XmpFaces = true
assert.True(t, c.XmpFaces())
c.options.XmpFaces = false
assert.False(t, c.XmpFaces())
func TestConfig_XMPFaces(t *testing.T) {
t.Run("Disabled", func(t *testing.T) {
c := NewConfig(CliTestContext())
assert.False(t, c.XMPFaces())
})
t.Run("Enabled", func(t *testing.T) {
ctx := CliTestContext()
assert.NoError(t, ctx.Set("xmp-faces", "true"))
c := NewConfig(ctx)
assert.True(t, c.XMPFaces())
})
}
func TestConfig_DisableClassification(t *testing.T) {

View file

@ -256,7 +256,7 @@ type Options struct {
VisionSchedule string `yaml:"VisionSchedule" json:"VisionSchedule" flag:"vision-schedule"`
VisionFilter string `yaml:"VisionFilter" json:"VisionFilter" flag:"vision-filter"`
DetectNSFW bool `yaml:"DetectNSFW" json:"DetectNSFW" flag:"detect-nsfw"`
XmpFaces bool `yaml:"XmpFaces" json:"XmpFaces" flag:"xmp-faces"`
XMPFaces bool `yaml:"XMPFaces" json:"XMPFaces" flag:"xmp-faces"`
FaceEngine string `yaml:"FaceEngine" json:"-" flag:"face-engine"`
FaceEngineThreads int `yaml:"FaceEngineThreads" json:"-" flag:"face-engine-threads"`
FaceSize int `yaml:"-" json:"-" flag:"face-size"`

View file

@ -336,7 +336,7 @@ func (c *Config) Report() (rows [][]string, cols []string) {
{"facenet-model-path", c.FacenetModelPath()},
{"nsfw-model-path", c.NsfwModelPath()},
{"detect-nsfw", fmt.Sprintf("%t", c.DetectNSFW())},
{"xmp-faces", fmt.Sprintf("%t", c.XmpFaces())},
{"xmp-faces", fmt.Sprintf("%t", c.XMPFaces())},
{"face-engine", faceEngine},
{"face-engine-run", vision.ReportRunType(c.FaceEngineRunType())},
}...)
@ -384,7 +384,7 @@ func (c *Config) FaceReport() (rows [][]string, cols []string) {
rows = [][]string{
{"disable-faces", fmt.Sprintf("%t", c.DisableFaces())},
{"xmp-faces", fmt.Sprintf("%t", c.XmpFaces())},
{"xmp-faces", fmt.Sprintf("%t", c.XMPFaces())},
{"vision-yaml", c.VisionYaml()},
{"face-engine", c.FaceEngine()},
{"face-engine-run", vision.ReportRunType(c.FaceEngineRunType())},

View file

@ -423,6 +423,7 @@ func CliTestContext() *cli.Context {
globalSet.String("wakeup-interval", "1h34m9s", "doc")
globalSet.Bool("vision-api", config.VisionApi, "doc")
globalSet.Bool("detect-nsfw", config.DetectNSFW, "doc")
globalSet.Bool("xmp-faces", config.XMPFaces, "doc")
globalSet.Bool("debug", false, "doc")
globalSet.Bool("sponsor", true, "doc")
globalSet.Bool("test", true, "doc")

View file

@ -67,7 +67,7 @@ func ApplyDetectedFaces(m *MediaFile, file *entity.File, faces face.Faces) (save
return false, 0, fmt.Errorf("faces: file is nil")
}
importXmp := m != nil && Config().XmpFaces()
importXmp := m != nil && Config().XMPFaces()
if len(faces) == 0 && !importXmp {
return false, 0, nil

View file

@ -53,7 +53,7 @@ func NewIndexOptions(path string, rescan, convert, stack, facesOnly, skipArchive
result.DetectNsfw = !facesOnly && c.VisionModelShouldRun(vision.ModelTypeNsfw, vision.RunOnIndex)
result.GenerateLabels = !facesOnly && c.VisionModelShouldRun(vision.ModelTypeLabels, vision.RunOnIndex)
result.ImportFaceTags = c.XmpFaces()
result.ImportFaceTags = c.XMPFaces()
result.ByteLimit = c.OriginalsLimitBytes()
result.ResolutionLimit = c.ResolutionLimit()

View file

@ -69,12 +69,12 @@ func TestNewIndexOptions_ImportFaceTags(t *testing.T) {
conf := config.NewMinimalTestConfig(t.TempDir())
t.Run("Enabled", func(t *testing.T) {
conf.Options().XmpFaces = true
conf.Options().XMPFaces = true
opts := NewIndexOptions("/", true, true, true, false, false, conf)
assert.True(t, opts.ImportFaceTags)
})
t.Run("Disabled", func(t *testing.T) {
conf.Options().XmpFaces = false
conf.Options().XMPFaces = false
opts := NewIndexOptions("/", true, true, true, false, false, conf)
assert.False(t, opts.ImportFaceTags)
})

View file

@ -145,7 +145,6 @@ config:
PHOTOPRISM_IMPORT_ALLOW: "zip,jpeg,jpg,png,gif,bmp,avif,webp,heic,heif,tiff,pdf,ai,svg,xmp"
PHOTOPRISM_UPLOAD_ARCHIVES: true
PHOTOPRISM_UPLOAD_NSFW: true
PHOTOPRISM_XMP_FACES: true
PHOTOPRISM_DISABLE_TLS: true
PHOTOPRISM_DISABLE_STS: true
PHOTOPRISM_DISABLE_MCP: false

View file

@ -22,5 +22,5 @@ DisableRaw: false
RawPresets: false
JpegQuality: 85
DetectNSFW: false
XmpFaces: true
XMPFaces: true
UploadNSFW: true