Adding Exclude List, #3
This commit is contained in:
parent
f3424d83bc
commit
33d7c5eaa7
@ -20,6 +20,7 @@ type Config struct {
|
|||||||
ServerName string `json:"serverName"`
|
ServerName string `json:"serverName"`
|
||||||
SonarrContext string `json:"sonarrContext"`
|
SonarrContext string `json:"sonarrContext"`
|
||||||
SonarrAPIKey string `json:"sonarrAPIKey"`
|
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.
|
//GetConfig gets the configuration values for the api using the file in the supplied configPath.
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"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"
|
||||||
@ -121,7 +122,21 @@ func GetTitles(config config.Config, sectionID int, days int) ([]int, []string)
|
|||||||
|
|
||||||
epoch := util.SubtractedEpoch(days)
|
epoch := util.SubtractedEpoch(days)
|
||||||
|
|
||||||
|
exclude := strings.Split(config.ExcludeList, ",")
|
||||||
|
|
||||||
|
fmt.Println(exclude)
|
||||||
|
var breakOut bool
|
||||||
|
|
||||||
for _, i := range data {
|
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 {
|
if int64(i.LastPlayed) <= epoch && int64(i.LastPlayed) != 0 {
|
||||||
titles = append(titles, i.Title)
|
titles = append(titles, i.Title)
|
||||||
strirk, err := strconv.Atoi(i.RatingKey)
|
strirk, err := strconv.Atoi(i.RatingKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user