1fc4ef123b
Work in progress. No performance optimizations yet.
49 lines
885 B
Go
49 lines
885 B
Go
package commands
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
"github.com/photoprism/photoprism/internal/service"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
// PeopleCommand registers the people cli command.
|
|
var PeopleCommand = cli.Command{
|
|
Name: "people",
|
|
Usage: "Performs face clustering and recognition",
|
|
Action: peopleAction,
|
|
}
|
|
|
|
// peopleAction performs face clustering and recognition.
|
|
func peopleAction(ctx *cli.Context) error {
|
|
start := time.Now()
|
|
|
|
conf := config.NewConfig(ctx)
|
|
service.SetConfig(conf)
|
|
|
|
_, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
|
|
if err := conf.Init(); err != nil {
|
|
return err
|
|
}
|
|
|
|
conf.InitDb()
|
|
|
|
people := service.People()
|
|
|
|
if err := people.Start(); err != nil {
|
|
return err
|
|
} else {
|
|
elapsed := time.Since(start)
|
|
|
|
log.Infof("completed in %s", elapsed)
|
|
}
|
|
|
|
conf.Shutdown()
|
|
|
|
return nil
|
|
}
|