test
This commit is contained in:
parent
267a891e4d
commit
31dc49eae4
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/config"
|
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/config"
|
||||||
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/model"
|
"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
|
// 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
|
// LookupTVFileLocation will gather a list of Information based on IDs returned by locator.GetTitles
|
||||||
func LookupTVFileLocation(config config.Config, ids []int) []string {
|
func LookupTVFileLocation(config config.Config, ids []int) []string {
|
||||||
fileList := make([]string, 0)
|
fileList := make([]string, 0)
|
||||||
results := make([]string, 0)
|
|
||||||
|
|
||||||
for _, i := range ids {
|
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)
|
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
|
plexTV := plexModel.Video
|
||||||
|
|
||||||
for _, i := range plexTV {
|
for _, i := range plexTV {
|
||||||
fileList = append(fileList, filepath.Dir(filepath.Dir(i.Media.Part.File)))
|
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 {
|
func isValueInList(value string, list []string) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user