This commit is contained in:
Matt Burchett 2018-11-20 14:20:34 -06:00
parent 267a891e4d
commit 31dc49eae4

View File

@ -11,6 +11,7 @@ import (
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/config"
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/model"
"github.com/forestgiant/sliceutil"
)
// LookupMovieFileLocation will gather a list of Information based on IDs returned by locator.GetTitles
@ -48,7 +49,6 @@ func LookupMovieFileLocation(config config.Config, ids []int) []string {
// LookupTVFileLocation will gather a list of Information based on IDs returned by locator.GetTitles
func LookupTVFileLocation(config config.Config, ids []int) []string {
fileList := make([]string, 0)
results := make([]string, 0)
for _, i := range ids {
plexURL := fmt.Sprintf("%s:%d%s%d%s%s", config.PlexHost, config.PlexPort, "/library/metadata/", i, "/allLeaves/?X-Plex-Token=", config.PlexToken)
@ -77,17 +77,13 @@ func LookupTVFileLocation(config config.Config, ids []int) []string {
plexTV := plexModel.Video
for _, i := range plexTV {
if sliceutil.Contains(fileList, i) {
fileList = append(fileList, filepath.Dir(filepath.Dir(i.Media.Part.File)))
}
}
for _, v := range fileList {
boolean := isValueInList(v, fileList)
if !boolean {
results = append(results, v)
}
}
}
return results
return fileList
}
func isValueInList(value string, list []string) bool {