From cbafaa57818da8a88117a9c376e8a15d27978dd9 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Tue, 20 Nov 2018 14:26:47 -0600 Subject: [PATCH] test --- pkg/eraser/eraser.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/eraser/eraser.go b/pkg/eraser/eraser.go index afe99e6..c539304 100644 --- a/pkg/eraser/eraser.go +++ b/pkg/eraser/eraser.go @@ -11,7 +11,6 @@ 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 @@ -49,6 +48,7 @@ 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) + m := make(map[string]bool) 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,9 +77,9 @@ func LookupTVFileLocation(config config.Config, ids []int) []string { plexTV := plexModel.Video for _, i := range plexTV { - if sliceutil.Contains(fileList, i.Media.Part.File) { - fmt.Println("Already exists.") - } else { + f := i.Media.Part.File + if _, ok := m[f]; !ok { + m[f] = true fileList = append(fileList, filepath.Dir(filepath.Dir(i.Media.Part.File))) } }