allow more videotypes than mp4

This commit is contained in:
2021-09-27 17:33:05 +02:00
parent e4f09eddac
commit 61ea42ef01
3 changed files with 19 additions and 5 deletions

View File

@ -38,6 +38,7 @@ func insertEpisodesIfNotExisting(show Show) {
fmt.Println(err.Error())
}
// todo no fixed mp4 extension here!
dbepisodes = append(dbepisodes, fmt.Sprintf("%s S%02dE%02d.mp4", epname, season, episode))
}

View File

@ -15,6 +15,20 @@ type StatusMessage struct {
ContentAvailable bool
}
func getVideoTypes() []string {
return []string{".mp4", ".mov", ".mkv", ".flv", ".avi", ".mpeg", ".m4v"}
}
func ValidVideoSuffix(filename string) bool {
validExts := getVideoTypes()
for _, validExt := range validExts {
if strings.HasSuffix(filename, validExt) {
return true
}
}
return false
}
func StartReindex() bool {
fmt.Println("starting reindex..")
SendEvent("start")
@ -40,7 +54,7 @@ func StartReindex() bool {
return err
}
if !info.IsDir() && strings.HasSuffix(info.Name(), ".mp4") {
if !info.IsDir() && ValidVideoSuffix(info.Name()) {
files = append(files, info.Name())
}
return nil
@ -107,7 +121,7 @@ func StartTVShowReindex() {
}
for _, epfile := range episodefiles {
if strings.HasSuffix(epfile.Name(), ".mp4") {
if ValidVideoSuffix(epfile.Name()) {
elem.files = append(elem.files, epfile.Name())
}
}