diff --git a/pkg/config/config.go b/pkg/config/config.go index 0bf9643..500af5e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -20,6 +20,7 @@ type Config struct { ServerName string `json:"serverName"` SonarrContext string `json:"sonarrContext"` SonarrAPIKey string `json:"sonarrAPIKey"` + ExcludeList string `json:"excludeList"` // ExcludeList will be checked against any section. } //GetConfig gets the configuration values for the api using the file in the supplied configPath. diff --git a/pkg/locator/locator.go b/pkg/locator/locator.go index 8506f41..05faf78 100644 --- a/pkg/locator/locator.go +++ b/pkg/locator/locator.go @@ -9,6 +9,7 @@ import ( "net/http" "sort" "strconv" + "strings" "git.linuxrocker.com/mattburchett/Housekeeper/pkg/config" "git.linuxrocker.com/mattburchett/Housekeeper/pkg/model" @@ -121,7 +122,21 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string) epoch := util.SubtractedEpoch(days) + exclude := strings.Split(config.ExcludeList, ",") + + fmt.Println(exclude) + var breakOut bool + for _, i := range data { + for _, ex := range exclude { + if strings.Contains(i.Title, ex) { + breakOut = true + } + } + if breakOut { + breakOut = false + continue + } if int64(i.LastPlayed) <= epoch && int64(i.LastPlayed) != 0 { titles = append(titles, i.Title) strirk, err := strconv.Atoi(i.RatingKey)