mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Version transcoder cache
This commit is contained in:
parent
2eecb5174c
commit
5a4575a93d
@ -16,6 +16,11 @@ import (
|
||||
|
||||
var safe_path = src.GetEnvOr("GOCODER_SAFE_PATH", "/video")
|
||||
|
||||
// Encode the version in the hash path to update cached values.
|
||||
// Older versions won't be deleted (needed to allow multiples versions of the transcoder to run at the same time)
|
||||
// If the version changes a lot, we might want to automatically delete older versions.
|
||||
var version = "v1."
|
||||
|
||||
func GetPath(c echo.Context) (string, string, error) {
|
||||
key := c.Param("path")
|
||||
if key == "" {
|
||||
@ -49,7 +54,7 @@ func getHash(path string) (string, error) {
|
||||
h.Write([]byte(path))
|
||||
h.Write([]byte(info.ModTime().String()))
|
||||
sha := hex.EncodeToString(h.Sum(nil))
|
||||
return sha, nil
|
||||
return version + sha, nil
|
||||
}
|
||||
|
||||
func SanitizePath(path string) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user