test
This commit is contained in:
		@@ -8,7 +8,6 @@ import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"sort"
 | 
			
		||||
 | 
			
		||||
	"git.linuxrocker.com/mattburchett/Housekeeper/pkg/config"
 | 
			
		||||
	"git.linuxrocker.com/mattburchett/Housekeeper/pkg/model"
 | 
			
		||||
@@ -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)
 | 
			
		||||
	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,13 +77,25 @@ func LookupTVFileLocation(config config.Config, ids []int) []string {
 | 
			
		||||
		plexTV := plexModel.Video
 | 
			
		||||
 | 
			
		||||
		for _, i := range plexTV {
 | 
			
		||||
			count := sort.SearchStrings(fileList, i.Media.Part.File)
 | 
			
		||||
			if count == 0 {
 | 
			
		||||
			fileList = append(fileList, filepath.Dir(filepath.Dir(i.Media.Part.File)))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for _, v := range fileList {
 | 
			
		||||
			if !isValueInList(v, fileList) {
 | 
			
		||||
				results = append(results, v)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	return fileList
 | 
			
		||||
	}
 | 
			
		||||
	return results
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func isValueInList(value string, list []string) bool {
 | 
			
		||||
	for _, v := range list {
 | 
			
		||||
		if v == value {
 | 
			
		||||
			return true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteMovies will actually perform the deletion.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user