/* * call-seq: * xc.medialib_entry_property_remove(id, key, *source) -> result * * Remove a custom field in the medialib associated with the entry _id_. * _source_ is an optional argument that describes where to write the * mediainfo. If _source_ is omitted, "client/<yourclient>" is used, * where <yourclient> is the name you specified in * _Xmms::Client.new(name)_. */ static VALUE c_medialib_entry_property_remove (int argc, VALUE *argv, VALUE self) { VALUE tmp, key, src = Qnil; RbXmmsClient *xmms = NULL; xmmsc_result_t *res; const char *ckey; int32_t id; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); rb_scan_args (argc, argv, "21", &tmp, &key, &src); id = check_int32 (tmp); Check_Type (key, T_SYMBOL); ckey = rb_id2name (SYM2ID (key)); if (NIL_P (src)) res = xmmsc_medialib_entry_property_remove (xmms->real, id, ckey); else res = xmmsc_medialib_entry_property_remove_with_source ( xmms->real, id, StringValuePtr (src), ckey); return TO_XMMS_CLIENT_RESULT (self, res); }
/* * call-seq: * xc.playback_volume_get -> result * * Gets the current playback volume. */ static VALUE c_playback_volume_get (VALUE self) { RbXmmsClient *xmms = NULL; xmmsc_result_t *res; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); res = xmmsc_playback_volume_get (xmms->real); return TO_XMMS_CLIENT_RESULT (self, res); }
/* * call-seq: * xc.medialib_entry_property_set(id, key, value, *source) -> result * * Write info to the medialib at _id_. _source_ is an optional argument that * describes where to write the mediainfo. If _source_ is omitted, the * mediainfo is written to "client/<yourclient>" where <yourclient> is the * name you specified in _Xmms::Client.new(name)_. */ static VALUE c_medialib_entry_property_set (int argc, VALUE *argv, VALUE self) { VALUE tmp, key, value, src = Qnil; RbXmmsClient *xmms = NULL; xmmsc_result_t *res; const char *ckey; bool is_str = false; uint32_t id; int32_t ivalue; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); rb_scan_args (argc, argv, "31", &tmp, &key, &value, &src); id = check_int32 (tmp); Check_Type (key, T_SYMBOL); if (!NIL_P (rb_check_string_type (value))) is_str = true; else ivalue = check_int32 (value); ckey = rb_id2name (SYM2ID (key)); if (NIL_P (src) && is_str) res = xmmsc_medialib_entry_property_set_str (xmms->real, id, ckey, StringValuePtr (value)); else if (NIL_P (src)) res = xmmsc_medialib_entry_property_set_int (xmms->real, id, ckey, ivalue); else if (is_str) res = xmmsc_medialib_entry_property_set_str_with_source ( xmms->real, id, StringValuePtr (src), ckey, StringValuePtr (value)); else res = xmmsc_medialib_entry_property_set_int_with_source ( xmms->real, id, StringValuePtr (src), ckey, ivalue); return TO_XMMS_CLIENT_RESULT (self, res); }
/* * call-seq: * xc.playback_volume_set(channel, volume) -> result * * Sets playback volume for _channel_ to _volume_. */ static VALUE c_playback_volume_set (VALUE self, VALUE channel, VALUE volume) { RbXmmsClient *xmms = NULL; xmmsc_result_t *res; Data_Get_Struct (self, RbXmmsClient, xmms); CHECK_DELETED (xmms); Check_Type (channel, T_SYMBOL); Check_Type (volume, T_FIXNUM); res = xmmsc_playback_volume_set (xmms->real, rb_id2name (SYM2ID (channel)), NUM2INT (volume)); return TO_XMMS_CLIENT_RESULT (self, res); }