mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add search folder .tsc for cache
This commit is contained in:
@@ -2,6 +2,10 @@ package settings
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
"io/fs"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"server/log"
|
"server/log"
|
||||||
)
|
)
|
||||||
@@ -62,6 +66,23 @@ func SetBTSets(sets *BTSets) {
|
|||||||
|
|
||||||
if sets.TorrentsSavePath == "" {
|
if sets.TorrentsSavePath == "" {
|
||||||
sets.UseDisk = false
|
sets.UseDisk = false
|
||||||
|
} else if sets.UseDisk {
|
||||||
|
BTsets = sets
|
||||||
|
|
||||||
|
go filepath.WalkDir(sets.TorrentsSavePath, func(path string, d fs.DirEntry, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if d.IsDir() && strings.ToLower(d.Name()) == ".tsc" {
|
||||||
|
BTsets.TorrentsSavePath = path
|
||||||
|
log.TLogln("Find directory \"" + BTsets.TorrentsSavePath + "\", use as cache dir")
|
||||||
|
return io.EOF
|
||||||
|
}
|
||||||
|
if d.IsDir() && strings.HasPrefix(d.Name(), ".") {
|
||||||
|
return filepath.SkipDir
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
BTsets = sets
|
BTsets = sets
|
||||||
|
|||||||
Reference in New Issue
Block a user