示例#1
0
文件: movies.go 项目: xfanity/pulsar
func SearchMovies(ctx *gin.Context) {
	query := ctx.Request.URL.Query().Get("q")
	if query == "" {
		query = xbmc.Keyboard("", "Search Movies")
	}
	renderMovies(tmdb.SearchMovies(query, config.Get().Language), ctx)
}
示例#2
0
文件: play.go 项目: xfanity/pulsar
func PasteURL(ctx *gin.Context) {
	magnet := xbmc.Keyboard("", "Paste Magnet or URL")
	if magnet == "" {
		return
	}
	xbmc.PlayURL(UrlQuery(UrlForXBMC("/play"), "uri", magnet))
}
示例#3
0
文件: search.go 项目: xfanity/pulsar
func Search(c *gin.Context) {
	query := xbmc.Keyboard("", "Search")
	if query == "" {
		return
	}

	log.Println("Searching providers for:", query)

	searchers := providers.GetSearchers()
	torrents := providers.Search(searchers, query)

	items := make(xbmc.ListItems, 0, len(torrents))
	for _, torrent := range torrents {
		item := &xbmc.ListItem{
			Label:      fmt.Sprintf("S:%d P:%d - %s", torrent.Seeds, torrent.Peers, torrent.Name),
			Path:       UrlQuery(UrlForXBMC("/play"), "uri", torrent.URI),
			IsPlayable: true,
		}
		items = append(items, item)
	}

	c.JSON(200, xbmc.NewView("", items))
}