Migrate generated files when a scene is rescanned (#1106)

This commit is contained in:
InfiniteTF
2021-02-10 00:50:34 +01:00
committed by GitHub
parent bcbbd1474c
commit 8d8a8530e8
4 changed files with 68 additions and 51 deletions

View File

@@ -380,10 +380,17 @@ func (t *ScanTask) scanScene() *models.Scene {
// scene, then recalculate the checksum and regenerate the thumbnail
modified := t.isFileModified(fileModTime, s.FileModTime)
if modified || !s.Size.Valid {
oldHash := s.GetHash(config.GetVideoFileNamingAlgorithm())
s, err = t.rescanScene(s, fileModTime)
if err != nil {
return logError(err)
}
// Migrate any generated files if the hash has changed
newHash := s.GetHash(config.GetVideoFileNamingAlgorithm())
if newHash != oldHash {
MigrateHash(oldHash, newHash)
}
}
// We already have this item in the database