From 161309e3929e60884259c2f339778bac5361efdc Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Mon, 4 Apr 2022 14:24:32 +0200 Subject: [PATCH] Convert: Show relative file name in error and log messages #2214 --- internal/photoprism/convert.go | 8 +++----- internal/photoprism/convert_avc.go | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/internal/photoprism/convert.go b/internal/photoprism/convert.go index 537377ab1..f9dd30e92 100644 --- a/internal/photoprism/convert.go +++ b/internal/photoprism/convert.go @@ -147,9 +147,7 @@ func (c *Convert) ToJson(f *MediaFile) (jsonName string, err error) { return jsonName, nil } - relName := f.RelName(c.conf.OriginalsPath()) - - log.Debugf("exiftool: extracting metadata from %s", relName) + log.Debugf("exiftool: extracting metadata from %s", sanitize.Log(f.RootRelName())) cmd := exec.Command(c.conf.ExifToolBin(), "-n", "-m", "-api", "LargeFileSupport", "-j", f.FileName()) @@ -252,7 +250,7 @@ func (c *Convert) ToJpeg(f *MediaFile, force bool) (*MediaFile, error) { } if !f.Exists() { - return nil, fmt.Errorf("convert: %s not found", f.RelName(c.conf.OriginalsPath())) + return nil, fmt.Errorf("convert: %s not found", f.RootRelName()) } if f.IsJpeg() { @@ -279,7 +277,7 @@ func (c *Convert) ToJpeg(f *MediaFile, force bool) (*MediaFile, error) { } if !c.conf.SidecarWritable() { - return nil, fmt.Errorf("convert: disabled in read only mode (%s)", f.RelName(c.conf.OriginalsPath())) + return nil, fmt.Errorf("convert: disabled in read only mode (%s)", f.RootRelName()) } fileName := f.RelName(c.conf.OriginalsPath()) diff --git a/internal/photoprism/convert_avc.go b/internal/photoprism/convert_avc.go index e717a08a9..e86a019d6 100644 --- a/internal/photoprism/convert_avc.go +++ b/internal/photoprism/convert_avc.go @@ -178,7 +178,7 @@ func (c *Convert) ToAvc(f *MediaFile, encoderName string) (file *MediaFile, err } if !f.Exists() { - return nil, fmt.Errorf("convert: %s not found", f.RelName(c.conf.OriginalsPath())) + return nil, fmt.Errorf("convert: %s not found", f.RootRelName()) } avcName := fs.FormatAvc.FindFirst(f.FileName(), []string{c.conf.SidecarPath(), fs.HiddenPath}, c.conf.OriginalsPath(), false) @@ -190,15 +190,15 @@ func (c *Convert) ToAvc(f *MediaFile, encoderName string) (file *MediaFile, err } if !c.conf.SidecarWritable() { - return nil, fmt.Errorf("convert: transcoding disabled in read only mode (%s)", f.RelName(c.conf.OriginalsPath())) + return nil, fmt.Errorf("convert: transcoding disabled in read only mode (%s)", f.RootRelName()) } if c.conf.DisableFFmpeg() { - return nil, fmt.Errorf("convert: ffmpeg is disabled for transcoding %s", f.RelName(c.conf.OriginalsPath())) + return nil, fmt.Errorf("convert: ffmpeg is disabled for transcoding %s", f.RootRelName()) } - avcName = fs.FileName(f.FileName(), c.conf.SidecarPath(), c.conf.OriginalsPath(), fs.AvcExt) fileName := f.RelName(c.conf.OriginalsPath()) + avcName = fs.FileName(f.FileName(), c.conf.SidecarPath(), c.conf.OriginalsPath(), fs.AvcExt) cmd, useMutex, err := c.AvcConvertCommand(f, avcName, encoderName)