func PasteURL(ctx *gin.Context) { magnet := xbmc.Keyboard("", "LOCALIZE[30217]") if magnet == "" { return } xbmc.PlayURL(UrlQuery(UrlForXBMC("/play"), "uri", magnet)) }
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)) } } }