mirror of
https://github.com/stashapp/stash.git
synced 2025-12-12 11:22:37 +01:00
* Add file scanner * Scan scene changes * Split scan files * Generalise scan * Refactor ffprobe * Refactor ffmpeg encoder * Move scene scan code to scene package * Move matchExtension to utils * Refactor gallery scanning * Refactor image scanning * Prevent race conditions on identical hashes * Refactor image thumbnail generation * Perform count concurrently * Allow progress increment before total set * Make progress updates more frequent
33 lines
756 B
Go
33 lines
756 B
Go
package manager
|
|
|
|
import (
|
|
"github.com/stashapp/stash/pkg/models"
|
|
"github.com/stashapp/stash/pkg/scene"
|
|
)
|
|
|
|
// MigrateHashTask renames generated files between oshash and MD5 based on the
|
|
// value of the fileNamingAlgorithm flag.
|
|
type MigrateHashTask struct {
|
|
Scene *models.Scene
|
|
fileNamingAlgorithm models.HashAlgorithm
|
|
}
|
|
|
|
// Start starts the task.
|
|
func (t *MigrateHashTask) Start() {
|
|
if !t.Scene.OSHash.Valid || !t.Scene.Checksum.Valid {
|
|
// nothing to do
|
|
return
|
|
}
|
|
|
|
oshash := t.Scene.OSHash.String
|
|
checksum := t.Scene.Checksum.String
|
|
|
|
oldHash := oshash
|
|
newHash := checksum
|
|
if t.fileNamingAlgorithm == models.HashAlgorithmOshash {
|
|
oldHash = checksum
|
|
newHash = oshash
|
|
}
|
|
|
|
scene.MigrateHash(instance.Paths, oldHash, newHash)
|
|
}
|