Use tmdb as the default detailer even in ExplorePopular
This commit is contained in:
parent
403ca081cc
commit
190571bc24
@ -8,8 +8,6 @@ import (
|
|||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/odwrtw/papi"
|
"github.com/odwrtw/papi"
|
||||||
"github.com/odwrtw/polochon/lib"
|
|
||||||
traktdetailer "github.com/odwrtw/polochon/modules/trakttv"
|
|
||||||
"github.com/odwrtw/trakttv"
|
"github.com/odwrtw/trakttv"
|
||||||
|
|
||||||
"gitlab.quimbo.fr/odwrtw/canape-sql/src/internal/auth"
|
"gitlab.quimbo.fr/odwrtw/canape-sql/src/internal/auth"
|
||||||
@ -92,6 +90,7 @@ func FromPolochon(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExplorePopular(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
func ExplorePopular(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
||||||
|
log := env.Log.WithField("function", "movies.ExplorePopular")
|
||||||
|
|
||||||
queryOption := trakttv.QueryOption{
|
queryOption := trakttv.QueryOption{
|
||||||
ExtendedInfos: []trakttv.ExtendedInfo{
|
ExtendedInfos: []trakttv.ExtendedInfo{
|
||||||
@ -104,21 +103,18 @@ func ExplorePopular(env *web.Env, w http.ResponseWriter, r *http.Request) error
|
|||||||
}
|
}
|
||||||
trakt := trakttv.New(env.Config.TraktTVClientID)
|
trakt := trakttv.New(env.Config.TraktTVClientID)
|
||||||
trakt.Endpoint = trakttv.ProductionEndpoint
|
trakt.Endpoint = trakttv.ProductionEndpoint
|
||||||
|
|
||||||
|
log.Debug("getting movies from trakttv")
|
||||||
tmovies, err := trakt.PopularMovies(queryOption)
|
tmovies, err := trakt.PopularMovies(queryOption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
log.Debugf("got %d movies from trakttv", len(tmovies))
|
||||||
detailer, err := traktdetailer.New(&traktdetailer.Params{env.Config.TraktTVClientID})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
movies := []*Movie{}
|
movies := []*Movie{}
|
||||||
ids := []string{}
|
ids := []string{}
|
||||||
for _, m := range tmovies {
|
for _, m := range tmovies {
|
||||||
movie := New(m.IDs.ImDB)
|
movie := New(m.IDs.ImDB)
|
||||||
movie.Detailers = []polochon.Detailer{detailer}
|
|
||||||
err := movie.GetDetails(env, false)
|
err := movie.GetDetails(env, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
env.Log.Error(err)
|
env.Log.Error(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user