Convert: Show relative file name in error and log messages #2214

This commit is contained in:
Michael Mayer 2022-04-04 14:24:32 +02:00
parent c74fcbf282
commit 161309e392
2 changed files with 7 additions and 9 deletions

View file

@ -147,9 +147,7 @@ func (c *Convert) ToJson(f *MediaFile) (jsonName string, err error) {
return jsonName, nil return jsonName, nil
} }
relName := f.RelName(c.conf.OriginalsPath()) log.Debugf("exiftool: extracting metadata from %s", sanitize.Log(f.RootRelName()))
log.Debugf("exiftool: extracting metadata from %s", relName)
cmd := exec.Command(c.conf.ExifToolBin(), "-n", "-m", "-api", "LargeFileSupport", "-j", f.FileName()) 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() { 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() { if f.IsJpeg() {
@ -279,7 +277,7 @@ func (c *Convert) ToJpeg(f *MediaFile, force bool) (*MediaFile, error) {
} }
if !c.conf.SidecarWritable() { 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()) fileName := f.RelName(c.conf.OriginalsPath())

View file

@ -178,7 +178,7 @@ func (c *Convert) ToAvc(f *MediaFile, encoderName string) (file *MediaFile, err
} }
if !f.Exists() { 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) 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() { 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() { 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()) 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) cmd, useMutex, err := c.AvcConvertCommand(f, avcName, encoderName)