Tweak indexing of related files #391

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-07-19 19:28:41 +02:00
parent f8170e30c7
commit 48407b4526
3 changed files with 9 additions and 5 deletions

View file

@ -166,11 +166,11 @@ func (ind *Index) Start(opt IndexOptions) fs.Done {
var files MediaFiles
for _, f := range related.Files {
if done[f.FileName()].Processed() || f.FileName() == fileName {
if done[f.FileName()].Processed() {
continue
}
if ind.files.Ignore(f.RelName(originalsPath), f.ModTime(), opt.Rescan) {
if f.FileName() != fileName && ind.files.Ignore(f.RelName(originalsPath), f.ModTime(), opt.Rescan) {
continue
}
@ -179,9 +179,13 @@ func (ind *Index) Start(opt IndexOptions) fs.Done {
done[f.FileName()] = fs.Processed
}
filesIndexed++
done[fileName] = fs.Processed
if len(files) == 0 || related.Main == nil {
// Nothing to do.
return nil
}
related.Files = files
jobs <- IndexJob{

View file

@ -155,7 +155,7 @@ func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName string) (
fileChanged = file.Changed(fileSize, modTime)
if fileChanged {
log.Debugf("index: file was modified (new size %d, old size %d, new timestamp %d, old timestamp %d)", fileSize, file.FileSize, modTime.Unix(), file.ModTime)
log.Debugf("index: %s was modified (new size %d, old size %d, new timestamp %d, old timestamp %d)", txt.Quote(m.BaseName()), fileSize, file.FileSize, modTime.Unix(), file.ModTime)
}
}

View file

@ -111,7 +111,7 @@ func IndexRelated(related RelatedFiles, ind *Index, opt IndexOptions) (result In
}
}
log.Infof("index: %s related %s file %s", res, f.FileType(), txt.Quote(f.RelName(ind.originalsPath())))
log.Infof("index: %s related %s file %s", res, f.FileType(), txt.Quote(f.BaseName()))
}
return result