feat: respect pvr exclusions (#37)

This commit is contained in:
l3uddz
2022-04-14 16:18:06 +01:00
committed by GitHub
parent 2468d5b251
commit 79507adb4a
32 changed files with 321 additions and 99 deletions

View File

@@ -4,9 +4,10 @@ import (
"errors"
"fmt"
"github.com/lefelys/state"
"github.com/l3uddz/nabarr"
"github.com/l3uddz/nabarr/media"
"github.com/lefelys/state"
)
func (c *Client) QueueFeedItem(item *media.FeedItem) {
@@ -171,6 +172,27 @@ func (c *Client) queueProcessor(tail state.ShutdownTail) {
continue
}
// lookup pvr exclusions
exclusions, err := c.getExclusions()
if err != nil {
c.log.Error().
Err(err).
Msg("Failed retrieving pvr exclusions")
continue
}
if _, ok := exclusions[s.TmdbId]; ok {
// item was in pvr exclusions
c.log.Debug().
Str("pvr_title", s.Title).
Int("pvr_year", s.Year).
Str("pvr_imdb_id", s.ImdbId).
Int("pvr_tmdb_id", s.TmdbId).
Str("feed_name", feedItem.Feed).
Msg("Item found in pvr exclusions")
continue
}
// add item to pvr
c.log.Debug().
Str("feed_title", mediaItem.FeedTitle).