maintain (path): absolute path

getting things ready to have config coming as a plugin to handle
various distributions
This commit is contained in:
Mickael Kerjean
2023-03-02 20:15:56 +11:00
parent 8059730720
commit 8ca7a0e3f9
18 changed files with 34 additions and 40 deletions

View File

@ -12,7 +12,6 @@ import (
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
@ -78,7 +77,7 @@ func init() {
return
}
cachePath := filepath.Join(GetCurrentDir(), VideoCachePath)
cachePath := GetAbsolutePath(VideoCachePath)
os.RemoveAll(cachePath)
os.MkdirAll(cachePath, os.ModePerm)
@ -124,8 +123,7 @@ func hls_playlist(reader io.ReadCloser, ctx *App, res *http.ResponseWriter, req
}
cacheName := "vid_" + GenerateID(ctx) + "_" + QuickHash(path, 10) + ".dat"
cachePath := filepath.Join(
GetCurrentDir(),
cachePath := GetAbsolutePath(
VideoCachePath,
cacheName,
)
@ -172,8 +170,7 @@ func hls_transcode(ctx *App, res http.ResponseWriter, req *http.Request) {
return
}
startTime := segmentNumber * HLS_SEGMENT_LENGTH
cachePath := filepath.Join(
GetCurrentDir(),
cachePath := GetAbsolutePath(
VideoCachePath,
req.URL.Query().Get("path"),
)