fix invalid links if videos are in subfolders

This commit is contained in:
lukas-heiligenbrunner 2022-05-22 20:48:04 +02:00
parent f7a0d8fa07
commit 929e0c337d

View File

@ -6,7 +6,6 @@ import (
"openmediacenter/apiGo/config" "openmediacenter/apiGo/config"
"openmediacenter/apiGo/database" "openmediacenter/apiGo/database"
"os" "os"
"path/filepath"
"strings" "strings"
) )
@ -33,22 +32,19 @@ func StartReindex() bool {
return false return false
} }
var files []string filelist, err := ioutil.ReadDir(vidFolder)
err := filepath.Walk(vidFolder, func(path string, info os.FileInfo, err error) error {
if err != nil {
fmt.Println(err.Error())
return err
}
if !info.IsDir() && strings.HasSuffix(info.Name(), ".mp4") {
files = append(files, info.Name())
}
return nil
})
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
return false
} }
var files []string
for _, file := range filelist {
if !file.IsDir() && strings.HasSuffix(file.Name(), ".mp4") {
files = append(files, file.Name())
}
}
// start reindex process // start reindex process
AppendMessage("Starting Reindexing!") AppendMessage("Starting Reindexing!")
InitDeps(&mSettings) InitDeps(&mSettings)