func MoviePlay(ctx *gin.Context) { torrents := movieLinks(ctx.Params.ByName("imdbId")) if len(torrents) == 0 { xbmc.Notify("Quasar", "LOCALIZE[30205]", config.AddonIcon()) return } sort.Sort(sort.Reverse(providers.ByQuality(torrents))) rUrl := UrlQuery(UrlForXBMC("/play"), "uri", torrents[0].Magnet()) ctx.Redirect(302, rUrl) }
func MoviePlay(ctx *gin.Context) { tmdbId := ctx.Params.ByName("tmdbId") torrents := movieLinks(tmdbId) if len(torrents) == 0 { xbmc.Notify("Quasar", "LOCALIZE[30205]", config.AddonIcon()) return } movie := tmdb.GetMovieById(tmdbId, "") runtime := 120 if movie.Runtime > 0 { runtime = movie.Runtime } sort.Sort(sort.Reverse(providers.ByQuality(torrents))) AddToTorrentsMap(tmdbId, torrents[0]) rUrl := UrlQuery(UrlForXBMC("/play"), "uri", torrents[0].Magnet(), "tmdb", tmdbId, "type", "movie", "runtime", strconv.Itoa(runtime)) ctx.Redirect(302, rUrl) }