fix invalid links if videos are in subfolders
This commit is contained in:
parent
f7a0d8fa07
commit
929e0c337d
@ -6,7 +6,6 @@ import (
|
||||
"openmediacenter/apiGo/config"
|
||||
"openmediacenter/apiGo/database"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -33,22 +32,19 @@ func StartReindex() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
filelist, err := ioutil.ReadDir(vidFolder)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return false
|
||||
}
|
||||
|
||||
var files []string
|
||||
err := filepath.Walk(vidFolder, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return err
|
||||
for _, file := range filelist {
|
||||
if !file.IsDir() && strings.HasSuffix(file.Name(), ".mp4") {
|
||||
files = append(files, file.Name())
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
AppendMessage("Starting Reindexing!")
|
||||
InitDeps(&mSettings)
|
||||
|
Loading…
Reference in New Issue
Block a user