misc: rss and media changes (#27)
* refactor: tweak rss processing * media: override trakt network with tvdb network if trakts is empty * media: dont merge tvdb language with trakt language * media: resolve issue with imdb ids
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/l3uddz/nabarr/media/trakt"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -64,7 +63,11 @@ func (c *Client) GetShowInfo(item *FeedItem) (*Item, error) {
|
||||
Msg("Item was not found on tvdb")
|
||||
} else if ti != nil {
|
||||
mi.Tvdb = *ti
|
||||
mi.Languages = util.StringSliceMergeUnique(mi.Languages, []string{ti.Language})
|
||||
|
||||
// merge with trakt data
|
||||
if mi.Network == "" {
|
||||
mi.Network = ti.Network
|
||||
}
|
||||
}
|
||||
|
||||
return mi, nil
|
||||
|
||||
@@ -4,7 +4,9 @@ import (
|
||||
"encoding/xml"
|
||||
"github.com/l3uddz/nabarr/media/omdb"
|
||||
"github.com/l3uddz/nabarr/media/tvdb"
|
||||
"github.com/l3uddz/nabarr/util"
|
||||
"github.com/pkg/errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -80,11 +82,11 @@ type FeedItem struct {
|
||||
|
||||
func (f *FeedItem) GetProviderData() (string, string) {
|
||||
switch {
|
||||
case f.TvdbId != "" && f.TvdbId != "0":
|
||||
case f.TvdbId != "" && !util.StringSliceContains([]string{"0", "1"}, f.TvdbId):
|
||||
return "tvdb", f.TvdbId
|
||||
case f.TmdbId != "" && f.TmdbId != "0":
|
||||
case f.TmdbId != "" && !util.StringSliceContains([]string{"0", "1"}, f.TmdbId):
|
||||
return "tmdb", f.TmdbId
|
||||
case f.ImdbId != "":
|
||||
case f.ImdbId != "" && strings.HasPrefix(f.ImdbId, "tt"):
|
||||
return "imdb", f.ImdbId
|
||||
}
|
||||
return "", ""
|
||||
|
||||
@@ -46,6 +46,7 @@ func (c *Client) GetItem(tvdbId string) (*Item, error) {
|
||||
return &Item{
|
||||
Runtime: util.Atoi(b.Data.Runtime, 0),
|
||||
Language: b.Data.Language,
|
||||
Network: b.Data.Network,
|
||||
Genre: b.Data.Genre,
|
||||
AirsDayOfWeek: b.Data.AirsDayOfWeek,
|
||||
SiteRating: b.Data.SiteRating,
|
||||
|
||||
@@ -35,6 +35,7 @@ type lookupResponse struct {
|
||||
type Item struct {
|
||||
Runtime int `json:"Runtime,omitempty"`
|
||||
Language string `json:"Language,omitempty"`
|
||||
Network string `json:"Network,omitempty"`
|
||||
Genre []string `json:"Genre,omitempty"`
|
||||
AirsDayOfWeek string `json:"AirsDayOfWeek,omitempty"`
|
||||
SiteRating float64 `json:"SiteRating,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user