Пример #1
0
func Authentifaction(login string, password string) *C.sp_session {

	sc := initSessionConfig()
	session := new(C.sp_session)
	err := C.sp_session_create(sc, &session)
	fmt.Printf("%d\n", err)
	C.puts(C.sp_error_message(err))
	C.sp_session_set_connection_rules(session, C.SP_CONNECTION_RULE_NETWORK)
	return session
}
Пример #2
0
func spotify_init() {
	var config C.sp_session_config
	var session *C.sp_session

	temp_location := C.CString("tmp")
	user_agent := C.CString("spotigo client")

	config.api_version = C.SPOTIFY_API_VERSION
	config.cache_location = temp_location
	config.settings_location = temp_location
	config.application_key = PointerTo(C.g_appkey_ptr)
	config.application_key_size = C.g_appkey_size
	config.user_agent = user_agent

	// Register the callbacks.
	config.callbacks = &session_callbacks

	err := C.sp_session_create(&config, &session)
	if C.SP_ERROR_OK != err {
		fmt.Println("sp_session_create error", err)
	} else {
		fmt.Println("got session")
	}
}