33 lines
762 B
Go
33 lines
762 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
"github.com/photoprism/photoprism/internal/photoprism"
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
// Converts RAW files to JPEG images, if no JPEG already exists
|
|
var ConvertCommand = cli.Command{
|
|
Name: "convert",
|
|
Usage: "Converts RAW originals to JPEG",
|
|
Action: convertAction,
|
|
}
|
|
|
|
func convertAction(ctx *cli.Context) error {
|
|
conf := config.NewConfig(ctx)
|
|
|
|
if err := conf.CreateDirectories(); err != nil {
|
|
return err
|
|
}
|
|
|
|
log.Infof("converting RAW images in %s to JPEG", conf.OriginalsPath())
|
|
|
|
converter := photoprism.NewConverter(conf.DarktableCli())
|
|
|
|
converter.ConvertAll(conf.OriginalsPath())
|
|
|
|
log.Infof("image conversion complete")
|
|
|
|
return nil
|
|
}
|