Esempio n. 1
0
// Stop playback.
func (x *Xmms2Client) Stop() error {
	defer x.returnValue.Unref()
	x.result = C.xmmsc_playback_stop(x.connection)
	C.xmmsc_result_wait(x.result)
	x.returnValue.data = C.xmmsc_result_get_value(x.result)
	return x.checkError("Playback stop returned error: %s")
}
Esempio n. 2
0
// Get Current ID. If failed, return -1 and error info
func (x *Xmms2Client) CurrentID() (int, error) {
	defer x.returnValue.Unref()
	x.result = C.xmmsc_playback_current_id(x.connection)
	C.xmmsc_result_wait(x.result)
	x.returnValue.data = C.xmmsc_result_get_value(x.result)
	err := x.checkError("Get current ID failed: %s")
	if err != nil {
		return -1, err
	}
	i, err := x.returnValue.GetInt32()
	return int(i), err
}
Esempio n. 3
0
// Get medialib info
func (x *Xmms2Client) MediaLibInfo(id int) (map[string]interface{}, error) {
	defer x.ResultUnref()
	defer x.returnValue.Unref()
	x.result = C.xmmsc_medialib_get_info(x.connection, C.int(id))
	C.xmmsc_result_wait(x.result)
	x.returnValue.data = C.xmmsc_result_get_value(x.result)
	err := x.checkError("Get medialib info failed: %s")
	if err != nil {
		return nil, err
	}

	m, err := x.returnValue.GetDict()
	defer m.Unref()
	if err != nil {
		return nil, err
	}
	return m.ToMap()
}
Esempio n. 4
0
func (r *Result) GetValue() *Value {
	v := new(Value)
	v.data = C.xmmsc_result_get_value(r.export())
	return v
}