Compare commits
3 Commits
e5be15c954
...
937b12bb67
Author | SHA1 | Date | |
---|---|---|---|
937b12bb67 | |||
91bf3f8cdb | |||
8a07623668 |
@ -141,7 +141,7 @@ func GetShows(env *web.Env, user *models.User, source string, category string, f
|
||||
for _, id := range media.IDs {
|
||||
pShow, _ := pShows.Has(id)
|
||||
wShow, _ := wShows.IsShowInWishlist(id)
|
||||
show := shows.NewWithClient(id, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
show := shows.NewWithClient(&polochon.Show{ImdbID: id}, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
|
||||
// First check in the DB
|
||||
before := []polochon.Detailer{env.Backend.Detailer}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"git.quimbo.fr/odwrtw/canape/backend/models"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/subtitles"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/web"
|
||||
"github.com/odwrtw/errors"
|
||||
"github.com/odwrtw/papi"
|
||||
polochon "github.com/odwrtw/polochon/lib"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -97,10 +98,12 @@ func (m *Movie) GetDetails(env *web.Env, detailers []polochon.Detailer) error {
|
||||
m.Detailers = detailers
|
||||
|
||||
// GetDetail
|
||||
err := polochon.GetDetails(m.Movie, env.Log)
|
||||
err := polochon.GetDetails(m.Movie, log)
|
||||
if err != nil {
|
||||
if errors.IsFatal(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("got details from detailers")
|
||||
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"git.quimbo.fr/odwrtw/canape/backend/models"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/subtitles"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/web"
|
||||
"github.com/odwrtw/errors"
|
||||
"github.com/odwrtw/papi"
|
||||
polochon "github.com/odwrtw/polochon/lib"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -211,10 +212,12 @@ func (e *Episode) GetEpisodeDetails(env *web.Env, detailers []polochon.Detailer)
|
||||
e.ShowEpisode.Detailers = detailers
|
||||
|
||||
// Get the details
|
||||
err := polochon.GetDetails(e.ShowEpisode, env.Log)
|
||||
err := polochon.GetDetails(e.ShowEpisode, log)
|
||||
if err != nil {
|
||||
if errors.IsFatal(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("got details from detailers")
|
||||
|
||||
|
@ -43,7 +43,7 @@ func GetDetailsHandler(env *web.Env, w http.ResponseWriter, r *http.Request) err
|
||||
log.Println("Got error getting wishlisted show ", err)
|
||||
}
|
||||
|
||||
s := NewWithClient(id, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
s := NewWithClient(&polochon.Show{ImdbID: id}, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
// First try from the db
|
||||
first := []polochon.Detailer{env.Backend.Detailer}
|
||||
// Then try from the polochon detailers
|
||||
@ -89,7 +89,7 @@ func RefreshShowHandler(env *web.Env, w http.ResponseWriter, r *http.Request) er
|
||||
log.Println("Got error getting wishlisted show ", err)
|
||||
}
|
||||
|
||||
s := NewWithClient(id, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
s := NewWithClient(&polochon.Show{ImdbID: id}, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
// Refresh the polochon detailers
|
||||
detailers := env.Config.Show.Detailers
|
||||
err = s.Refresh(env, detailers)
|
||||
@ -128,11 +128,13 @@ func SearchShow(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
||||
searchers := env.Config.Show.Searchers
|
||||
// Iterate on all the searchers to search for the show
|
||||
for _, searcher := range searchers {
|
||||
result, err := searcher.SearchShow(search, env.Log)
|
||||
log := env.Log.WithField("searcher", searcher.Name())
|
||||
result, err := searcher.SearchShow(search, log)
|
||||
if err != nil {
|
||||
env.Log.Errorf("error while searching show : %s", err)
|
||||
log.Errorf("error while searching show : %s", err)
|
||||
continue
|
||||
}
|
||||
log.Debug("found show")
|
||||
// Add the results to the list of results
|
||||
shows = append(shows, result...)
|
||||
}
|
||||
@ -161,7 +163,7 @@ func SearchShow(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
||||
for _, s := range shows {
|
||||
pShow, _ := pShows.Has(s.ImdbID)
|
||||
wShow, _ := wShows.IsShowInWishlist(s.ImdbID)
|
||||
show := NewWithClient(s.ImdbID, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
show := NewWithClient(s, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
|
||||
// First try from the db
|
||||
first := []polochon.Detailer{env.Backend.Detailer}
|
||||
@ -240,7 +242,8 @@ func GetWishlistHandler(env *web.Env, w http.ResponseWriter, r *http.Request) er
|
||||
showList := []*Show{}
|
||||
for _, wishedShow := range wShows.List() {
|
||||
pShow, _ := pShows.Has(wishedShow.ImdbID)
|
||||
show := NewWithClient(wishedShow.ImdbID, client, pShow, wishedShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
poloShow := &polochon.Show{ImdbID: wishedShow.ImdbID}
|
||||
show := NewWithClient(poloShow, client, pShow, wishedShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
|
||||
// First check in the DB
|
||||
before := []polochon.Detailer{env.Backend.Detailer}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"git.quimbo.fr/odwrtw/canape/backend/models"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/web"
|
||||
"github.com/odwrtw/errors"
|
||||
"github.com/odwrtw/papi"
|
||||
polochon "github.com/odwrtw/polochon/lib"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -65,11 +66,9 @@ func New(imdbID string, publicDir, imgURLPrefix string) *Show {
|
||||
}
|
||||
|
||||
// NewWithClient returns a new Show with a polochon ShowConfig
|
||||
func NewWithClient(imdbID string, client *papi.Client, pShow *papi.Show, wShow *models.WishedShow, publicDir, imgURLPrefix string) *Show {
|
||||
func NewWithClient(show *polochon.Show, client *papi.Client, pShow *papi.Show, wShow *models.WishedShow, publicDir, imgURLPrefix string) *Show {
|
||||
s := &Show{
|
||||
Show: &polochon.Show{
|
||||
ImdbID: imdbID,
|
||||
},
|
||||
Show: show,
|
||||
client: client,
|
||||
pShow: pShow,
|
||||
publicDir: publicDir,
|
||||
@ -97,10 +96,12 @@ func (s *Show) GetDetails(env *web.Env, detailers []polochon.Detailer) error {
|
||||
s.Detailers = detailers
|
||||
|
||||
// Get the details
|
||||
err := polochon.GetDetails(s.Show, env.Log)
|
||||
err := polochon.GetDetails(s.Show, log)
|
||||
if err != nil {
|
||||
if errors.IsFatal(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("got details from detailers")
|
||||
|
||||
@ -219,7 +220,7 @@ func getPolochonShows(env *web.Env, user *models.User) ([]*Show, error) {
|
||||
// Create Shows objects from the shows retrieved
|
||||
for _, pShow := range pshows.List() {
|
||||
wShow, _ := wShows.IsShowInWishlist(pShow.ImdbID)
|
||||
show := NewWithClient(pShow.ImdbID, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
show := NewWithClient(&polochon.Show{ImdbID: pShow.ImdbID}, client, pShow, wShow, env.Config.PublicDir, env.Config.ImgURLPrefix)
|
||||
shows = append(shows, show)
|
||||
}
|
||||
return shows, nil
|
||||
|
3
go.mod
3
go.mod
@ -14,8 +14,9 @@ require (
|
||||
github.com/lib/pq v1.1.1
|
||||
github.com/mattn/go-sqlite3 v1.10.0 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/odwrtw/errors v0.0.0-20170604160533-c747b9d17833
|
||||
github.com/odwrtw/papi v0.0.0-20190511132159-936937ad8b6a
|
||||
github.com/odwrtw/polochon v0.0.0-20200131104911-522892bdd053
|
||||
github.com/odwrtw/polochon v0.0.0-20200403121328-985a643dc6aa
|
||||
github.com/phyber/negroni-gzip v0.0.0-20180113114010-ef6356a5d029
|
||||
github.com/pioz/tvdb v0.0.0-20190503215423-f45c687faba9 // indirect
|
||||
github.com/robfig/cron v1.1.0
|
||||
|
4
go.sum
4
go.sum
@ -137,8 +137,8 @@ github.com/odwrtw/papi v0.0.0-20190413103029-bd5bfea85ae6 h1:bF8XKFfYNY4quRdqJ5E
|
||||
github.com/odwrtw/papi v0.0.0-20190413103029-bd5bfea85ae6/go.mod h1:CXotdtODLpW0/yuFV5XH8Rmrj0eAfPLvdMKykPM2WCk=
|
||||
github.com/odwrtw/papi v0.0.0-20190511132159-936937ad8b6a h1:9mdPet/ianrckPWR2jSekoafz6BaqbF7kPXLnDEIKu8=
|
||||
github.com/odwrtw/papi v0.0.0-20190511132159-936937ad8b6a/go.mod h1:eY0skvVHJBwbSJ18uq2c1T4SvhdEV8R0XFSb0zKh5Yo=
|
||||
github.com/odwrtw/polochon v0.0.0-20200131104911-522892bdd053 h1:3Apbf8rWjgKswZuO5VWVoaFMtit4COdNP/ebRz6mi4Q=
|
||||
github.com/odwrtw/polochon v0.0.0-20200131104911-522892bdd053/go.mod h1:vb6PuVZ0ToGnfgVxijvUdYsayoItmdOYSVM8yMnEtJo=
|
||||
github.com/odwrtw/polochon v0.0.0-20200403121328-985a643dc6aa h1:Jh5cSZCcBwzULN9po+0mzydbPqiMRZAXkScON7BNvVw=
|
||||
github.com/odwrtw/polochon v0.0.0-20200403121328-985a643dc6aa/go.mod h1:vb6PuVZ0ToGnfgVxijvUdYsayoItmdOYSVM8yMnEtJo=
|
||||
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f h1:fwEIGT+o3e8+XkBqrwsE3/+9ketTQXflPhCkv3/w990=
|
||||
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f/go.mod h1:updLvMbQo2xHoz94MX9+GqmSoKhf6E8fs/J+wLvvu6A=
|
||||
github.com/odwrtw/trakttv v0.0.0-20170418094324-76889e438555 h1:5JfY2cKMq0g+IpgAaY+6EPRZZK8eV2lgRIUsqPB+hBY=
|
||||
|
Loading…
x
Reference in New Issue
Block a user