func movieLinks(imdbId string) []*bittorrent.Torrent { log.Println("Searching links for IMDB:", imdbId) movie := tmdb.GetMovieFromIMDB(imdbId, config.Get().Language) log.Printf("Resolved %s to %s\n", imdbId, movie.Title) searchers := providers.GetMovieSearchers() if len(searchers) == 0 { xbmc.Notify("Pulsar", "LOCALIZE[30204]", config.AddonIcon()) } return providers.SearchMovie(searchers, movie) }
func ProviderGetMovie(ctx *gin.Context) { imdbId := ctx.Params.ByName("imdbId") provider := ctx.Params.ByName("provider") log.Println("Searching links for IMDB:", imdbId) movie := tmdb.GetMovieFromIMDB(imdbId, "en") log.Printf("Resolved %s to %s\n", imdbId, movie.Title) searcher := providers.NewAddonSearcher(provider) torrents := searcher.SearchMovieLinks(movie) if ctx.Request.URL.Query().Get("resolve") == "true" { for _, torrent := range torrents { torrent.Resolve() } } data, err := json.MarshalIndent(providerDebugResponse{ Payload: searcher.GetMovieSearchObject(movie), Results: torrents, }, "", " ") if err != nil { ctx.Error(err) } ctx.Data(200, "application/json", data) }