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
} }
filelist, err := ioutil.ReadDir(vidFolder)
if err != nil {
fmt.Println(err.Error())
return false
}
var files []string var files []string
err := filepath.Walk(vidFolder, func(path string, info os.FileInfo, err error) error { for _, file := range filelist {
if err != nil { if !file.IsDir() && strings.HasSuffix(file.Name(), ".mp4") {
fmt.Println(err.Error()) files = append(files, file.Name())
return err }
} }
if !info.IsDir() && strings.HasSuffix(info.Name(), ".mp4") {
files = append(files, info.Name())
}
return nil
})
if err != nil {
fmt.Println(err.Error())
}
// start reindex process // start reindex process
AppendMessage("Starting Reindexing!") AppendMessage("Starting Reindexing!")
InitDeps(&mSettings) InitDeps(&mSettings)