Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
eeef16f07e
commit
379c46df64
2 changed files with 10 additions and 6 deletions
|
@ -288,8 +288,12 @@ func (m *MediaFile) RelatedFiles(stripSequence bool) (result RelatedFiles, err e
|
|||
result.Files = append(result.Files, resultFile)
|
||||
}
|
||||
|
||||
if result.Main == nil {
|
||||
return result, fmt.Errorf("no main file found for %s", txt.Quote(m.BaseName()))
|
||||
}
|
||||
|
||||
// Add hidden JPEG if exists.
|
||||
if !result.ContainsJpeg() && result.Main != nil {
|
||||
if !result.ContainsJpeg() {
|
||||
if jpegName := fs.TypeJpeg.FindFirst(result.Main.FileName(), []string{Config().SidecarPath(), fs.HiddenPath}, Config().OriginalsPath(), stripSequence); jpegName != "" {
|
||||
if resultFile, err := NewMediaFile(jpegName); err == nil {
|
||||
result.Files = append(result.Files, resultFile)
|
||||
|
|
|
@ -8,15 +8,15 @@ type RelatedFiles struct {
|
|||
|
||||
// ContainsJpeg returns true if related file list contains a JPEG.
|
||||
func (rf RelatedFiles) ContainsJpeg() bool {
|
||||
if rf.Main.IsJpeg() {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, f := range rf.Files {
|
||||
if f.IsJpeg() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if rf.Main == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return rf.Main.IsJpeg()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue