node build fixed
This commit is contained in:
19
seanime-2.9.10/internal/mediastream/videofile/info_utils.go
Normal file
19
seanime-2.9.10/internal/mediastream/videofile/info_utils.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package videofile
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetHashFromPath(path string) (string, error) {
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
h := sha1.New()
|
||||
h.Write([]byte(path))
|
||||
h.Write([]byte(info.ModTime().String()))
|
||||
sha := hex.EncodeToString(h.Sum(nil))
|
||||
return sha, nil
|
||||
}
|
||||
Reference in New Issue
Block a user