示例#1
0
文件: play.go 项目: razer1s/quasar
func PasteURL(ctx *gin.Context) {
	magnet := xbmc.Keyboard("", "LOCALIZE[30217]")
	if magnet == "" {
		return
	}
	xbmc.PlayURL(UrlQuery(UrlForXBMC("/play"), "uri", magnet))
}
示例#2
0
文件: play.go 项目: i96751414/quasar
func PasteURL(ctx *gin.Context) {
	retval := xbmc.DialogInsert()
	if retval["path"] == "" {
		return
	} else if retval["type"] == "url" {
		xbmc.PlayURL(UrlQuery(UrlForXBMC("/play"), "uri", retval["path"]))
	} else if retval["type"] == "file" {
		if _, err := os.Stat(retval["path"]); err == nil {
			info := libtorrent.NewTorrentInfo(retval["path"])
			shaHash := info.InfoHash().ToString()
			infoHash := hex.EncodeToString([]byte(shaHash))
			magnet := fmt.Sprintf("magnet:?xt=urn:btih:%s&dn=%s", infoHash, info.Name())
			xbmc.PlayURL(UrlQuery(UrlForXBMC("/play"), "uri", magnet))
		}
	}
}