Class: Shout
- Inherits:
-
Object
- Object
- Shout
- Defined in:
- lib/shout.rb,
ext/shout_ext.c
Constant Summary collapse
- INT_ACCESSORS =
:port, :format
- STRING_ACCESSORS =
:host, :user, :username, :pass, :password, :protocol, :mount, :dumpfile, :agent, :user_agent, :public, :name, :url, :genre, :description, :bitrate
- HTTP =
INT2FIX(SHOUT_PROTOCOL_HTTP)
- XAUDIOCAST =
INT2FIX(SHOUT_PROTOCOL_XAUDIOCAST)
- ICY =
INT2FIX(SHOUT_PROTOCOL_ICY)
- MP3 =
INT2FIX(SHOUT_FORMAT_MP3)
- OGG =
INT2FIX(SHOUT_FORMAT_OGG)
- VORBIS =
INT2FIX(SHOUT_FORMAT_VORBIS)
Instance Attribute Summary collapse
Class Method Summary collapse
- .new(*args) ⇒ Object
-
.version ⇒ Object
Returns the libshout version, as a string.
Instance Method Summary collapse
- #agent ⇒ Object
-
#agent=(value) ⇒ Object
Set the User-Agent reported.
- #bitrate ⇒ Object
-
#bitrate=(value) ⇒ Object
Set the ‘bitrate’ in the audio_info of the stream.
-
#close ⇒ Object
Disconnect from the server.
-
#connect ⇒ Object
Connect to the server.
-
#connect_non_blocking ⇒ Object
The new _sh_connect_non_blocking function (aka #connect_non_blocking method) wrapping _sh_connect in a rb_thread_blocking_region call.
-
#connected? ⇒ Boolean
Returns true if connected, false otherwise, nil if something really crazy happened.
-
#delay ⇒ Object
Return the proper amount of time, in milliseconds, before more data needs to be sent.
- #description ⇒ Object
-
#description=(value) ⇒ Object
Set a longer description of the stream.
-
#disconnect ⇒ Object
Disconnect from the server.
- #dumpfile ⇒ Object
-
#dumpfile=(value) ⇒ Object
Set a filename where the server should dump the data from this stream.
- #ext_initialize ⇒ Object
- #format ⇒ Object
-
#format=(value) ⇒ Object
Set the format of the audio.
- #genre ⇒ Object
-
#genre=(value) ⇒ Object
Set the ‘genre’ of the stream.
-
#host ⇒ Object
getters.
-
#host=(value) ⇒ Object
Set the hostname to connect to.
-
#initialize(*args) ⇒ Object
constructor
Make a new shout object.
-
#metadata=(meta) ⇒ Object
Set MP3 metadata.
- #mount ⇒ Object
-
#mount=(value) ⇒ Object
Set the mountpoint on the server.
- #name ⇒ Object
-
#name=(value) ⇒ Object
Set the name of the stream, e.g.
-
#open ⇒ Object
Connect to the server.
- #pass ⇒ Object
-
#pass=(value) ⇒ Object
Set the password to authenticate with.
- #password ⇒ Object
-
#password=(value) ⇒ Object
Set the password to authenticate with.
- #port ⇒ Object
-
#port=(value) ⇒ Object
Set the destination port.
- #protocol ⇒ Object
-
#protocol=(value) ⇒ Object
Set the protocol to use when connecting.
- #public ⇒ Object
-
#public=(value) ⇒ Object
Set whether or not this stream should be “public”, i.e.
-
#send(to_send) ⇒ Object
Send some data.
-
#send_non_blocking(to_send) ⇒ Object
The new _sh_send_non_blocking function (aka #send_non_blocking method) packing the arguments of _sh_send in a struct and wrapping the _sh_send call into a rb_thread_blocking_region call.
-
#sync ⇒ Object
Sleep the necessary amount of time to play back the audio data sent since the last call to #sync.
- #url ⇒ Object
-
#url=(value) ⇒ Object
Set the URL to send the data to.
- #user ⇒ Object
-
#user=(value) ⇒ Object
Set the user to authenticate as.
- #user_agent ⇒ Object
-
#user_agent=(value) ⇒ Object
Set the User-Agent reported.
- #username ⇒ Object
-
#username=(value) ⇒ Object
Set the user to authenticate as.
Constructor Details
#initialize(*args) ⇒ Object
Make a new shout object. This method does not connect to any server. See #connect.
166 167 168 169 170 171 172 |
# File 'ext/shout_ext.c', line 166 def initialize(opts={}) ext_initialize (STRING_ACCESSORS + INT_ACCESSORS + [:charset]).each do |a| self.__send__ :"#{a}=", opts[a] if opts[a] end end |
Instance Attribute Details
#charset ⇒ Object
38 39 40 |
# File 'lib/shout.rb', line 38 def charset @charset || ((format && format==Shout::MP3) ? 'ISO-8859-1' : 'UTF-8') end |
Class Method Details
.new(*args) ⇒ Object
175 176 177 178 179 |
# File 'ext/shout_ext.c', line 175
static VALUE _Sh_new(int argc, VALUE *argv, VALUE klass) {
VALUE self = Data_Wrap_Struct(klass, 0, free_sh, 0);
rb_obj_call_init(self, argc, argv);
return self;
}
|
.version ⇒ Object
Returns the libshout version, as a string.
182 183 184 185 186 187 188 |
# File 'ext/shout_ext.c', line 182 static VALUE _Sh_version(VALUE klass) { const char *version; VALUE version_String; version = shout_version(NULL, NULL, NULL); version_String = rb_str_new2(version); return version_String; } |
Instance Method Details
#agent ⇒ Object
387 388 389 390 391 392 393 |
# File 'ext/shout_ext.c', line 387
VALUE _sh_agent(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_agent(s->conn);
return rb_str_new2(value);
}
|
#agent=(value) ⇒ Object
Set the User-Agent reported. The default is “libshout/<libshout version>”, e.g. “libshout/2.0.0”.
575 576 577 578 579 580 581 582 583 584 585 |
# File 'ext/shout_ext.c', line 575
VALUE _sh_agent_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_agent(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#bitrate ⇒ Object
440 441 442 443 444 445 446 447 |
# File 'ext/shout_ext.c', line 440
VALUE _sh_bitrate(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_audio_info(s->conn, SHOUT_AI_BITRATE);
return rb_str_new2(value);
}
|
#bitrate=(value) ⇒ Object
Set the ‘bitrate’ in the audio_info of the stream.
675 676 677 678 679 680 681 682 683 684 685 |
# File 'ext/shout_ext.c', line 675
VALUE _sh_bitrate_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_audio_info(s->conn, SHOUT_AI_BITRATE, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#close ⇒ Object
Disconnect from the server.
217 218 219 220 221 222 223 224 225 226 227 |
# File 'ext/shout_ext.c', line 217
static VALUE _sh_disconnect(VALUE self) {
int err;
shout_connection *s;
GET_SC(self, s);
err = shout_close(s->conn);
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return Qtrue;
}
|
#connect ⇒ Object
Connect to the server. You must set all the parameters you’re going to set before connecting.
193 194 195 196 197 198 199 200 201 202 203 |
# File 'ext/shout_ext.c', line 193
static VALUE _sh_connect(VALUE self) {
int err;
shout_connection *s;
GET_SC(self, s);
err = shout_open(s->conn);
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return Qtrue;
}
|
#connect_non_blocking ⇒ Object
The new _sh_connect_non_blocking function (aka #connect_non_blocking method) wrapping _sh_connect in a rb_thread_blocking_region call.
210 211 212 |
# File 'ext/shout_ext.c', line 210 static VALUE _sh_connect_non_blocking(VALUE self) { return rb_thread_blocking_region(_sh_connect, self, RUBY_UBF_IO, NULL); } |
#connected? ⇒ Boolean
Returns true if connected, false otherwise, nil if something really crazy happened.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'ext/shout_ext.c', line 232
static VALUE _sh_connectedp(VALUE self) {
int err;
shout_connection *s;
GET_SC(self, s);
err = shout_get_connected(s->conn);
if(err == SHOUTERR_CONNECTED) {
return Qtrue;
} else if(err == SHOUTERR_UNCONNECTED) {
return Qfalse;
} else {
return Qnil;
}
}
|
#delay ⇒ Object
Return the proper amount of time, in milliseconds, before more data needs to be sent. This is for use when you would like to do something else in the intervening time period besides sleep.
302 303 304 305 306 307 308 309 |
# File 'ext/shout_ext.c', line 302
static VALUE _sh_delay(VALUE self) {
int ms;
shout_connection *s;
GET_SC(self, s);
ms = shout_delay(s->conn);
return INT2NUM(ms);
}
|
#description ⇒ Object
432 433 434 435 436 437 438 |
# File 'ext/shout_ext.c', line 432
VALUE _sh_description(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_description(s->conn);
return rb_str_new2(value);
}
|
#description=(value) ⇒ Object
Set a longer description of the stream. Probably several lines of text.
645 646 647 648 649 650 651 652 653 654 655 |
# File 'ext/shout_ext.c', line 645
VALUE _sh_description_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_description(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#disconnect ⇒ Object
Disconnect from the server.
217 218 219 220 221 222 223 224 225 226 227 |
# File 'ext/shout_ext.c', line 217
static VALUE _sh_disconnect(VALUE self) {
int err;
shout_connection *s;
GET_SC(self, s);
err = shout_close(s->conn);
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return Qtrue;
}
|
#dumpfile ⇒ Object
378 379 380 381 382 383 384 |
# File 'ext/shout_ext.c', line 378
VALUE _sh_dumpfile(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_dumpfile(s->conn);
return rb_str_new2(value);
}
|
#dumpfile=(value) ⇒ Object
Set a filename where the server should dump the data from this stream. Only do this if you know what you are doing.
561 562 563 564 565 566 567 568 569 570 571 |
# File 'ext/shout_ext.c', line 561
VALUE _sh_dumpfile_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_dumpfile(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#ext_initialize ⇒ Object
11 |
# File 'lib/shout.rb', line 11 alias :ext_initialize :initialize |
#format ⇒ Object
360 361 362 363 364 365 366 |
# File 'ext/shout_ext.c', line 360
VALUE _sh_format(VALUE self) {
int value;
shout_connection *s; GET_SC(self, s);
value = shout_get_format(s->conn);
return INT2FIX(value);
}
|
#format=(value) ⇒ Object
Set the format of the audio. Possible values are:
- Shout::VORBIS
-
Ogg Vorbis
- Shout::MP3
-
MP3
534 535 536 537 538 539 540 541 542 543 544 |
# File 'ext/shout_ext.c', line 534
VALUE _sh_format_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_FIXNUM);
err = shout_set_format(s->conn, FIX2INT(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#genre ⇒ Object
423 424 425 426 427 428 429 |
# File 'ext/shout_ext.c', line 423
VALUE _sh_genre(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_genre(s->conn);
return rb_str_new2(value);
}
|
#genre=(value) ⇒ Object
Set the ‘genre’ of the stream.
632 633 634 635 636 637 638 639 640 641 642 |
# File 'ext/shout_ext.c', line 632
VALUE _sh_genre_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_genre(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#host ⇒ Object
getters
315 316 317 318 319 320 321 |
# File 'ext/shout_ext.c', line 315
VALUE _sh_host(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_host(s->conn);
return rb_str_new2(value);
}
|
#host=(value) ⇒ Object
Set the hostname to connect to. The default is localhost.
461 462 463 464 465 466 467 468 469 470 471 |
# File 'ext/shout_ext.c', line 461
VALUE _sh_host_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_host(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#metadata=(meta) ⇒ Object
Set MP3 metadata. Create a ShoutMetadata object, add some stuff to it and pass it to this method. If the format of the stream isn’t MP3, and you try to set its metadata, an exception will most likely be raised.
661 662 663 664 665 666 667 668 669 670 671 672 |
# File 'ext/shout_ext.c', line 661
VALUE _sh_metadata_eq(VALUE self, VALUE meta) {
int err;
shout_connection *s; GET_SC(self, s);
shout_metadata_t *m; Data_Get_Struct(meta, shout_metadata_t, m);
err = shout_set_metadata(s->conn, m);
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return meta;
}
|
#mount ⇒ Object
369 370 371 372 373 374 375 |
# File 'ext/shout_ext.c', line 369
VALUE _sh_mount(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_mount(s->conn);
return rb_str_new2(value);
}
|
#mount=(value) ⇒ Object
Set the mountpoint on the server.
547 548 549 550 551 552 553 554 555 556 557 |
# File 'ext/shout_ext.c', line 547
VALUE _sh_mount_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_mount(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#name ⇒ Object
405 406 407 408 409 410 411 |
# File 'ext/shout_ext.c', line 405
VALUE _sh_name(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_name(s->conn);
return rb_str_new2(value);
}
|
#name=(value) ⇒ Object
Set the name of the stream, e.g. “monkey’s radio tunes.”
606 607 608 609 610 611 612 613 614 615 616 |
# File 'ext/shout_ext.c', line 606
VALUE _sh_name_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_name(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#open ⇒ Object
Connect to the server. You must set all the parameters you’re going to set before connecting.
193 194 195 196 197 198 199 200 201 202 203 |
# File 'ext/shout_ext.c', line 193
static VALUE _sh_connect(VALUE self) {
int err;
shout_connection *s;
GET_SC(self, s);
err = shout_open(s->conn);
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return Qtrue;
}
|
#pass ⇒ Object
342 343 344 345 346 347 348 |
# File 'ext/shout_ext.c', line 342
VALUE _sh_pass(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_password(s->conn);
return rb_str_new2(value);
}
|
#pass=(value) ⇒ Object
Set the password to authenticate with. The default is no password.
500 501 502 503 504 505 506 507 508 509 510 |
# File 'ext/shout_ext.c', line 500
VALUE _sh_pass_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_password(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#password ⇒ Object
342 343 344 345 346 347 348 |
# File 'ext/shout_ext.c', line 342
VALUE _sh_pass(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_password(s->conn);
return rb_str_new2(value);
}
|
#password=(value) ⇒ Object
Set the password to authenticate with. The default is no password.
500 501 502 503 504 505 506 507 508 509 510 |
# File 'ext/shout_ext.c', line 500
VALUE _sh_pass_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_password(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#port ⇒ Object
324 325 326 327 328 329 330 |
# File 'ext/shout_ext.c', line 324
VALUE _sh_port(VALUE self) {
int value;
shout_connection *s; GET_SC(self, s);
value = shout_get_port(s->conn);
return INT2FIX(value);
}
|
#port=(value) ⇒ Object
Set the destination port. The default is 8000.
474 475 476 477 478 479 480 481 482 483 484 |
# File 'ext/shout_ext.c', line 474
VALUE _sh_port_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_FIXNUM);
err = shout_set_port(s->conn, FIX2INT(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#protocol ⇒ Object
351 352 353 354 355 356 357 |
# File 'ext/shout_ext.c', line 351
VALUE _sh_proto(VALUE self) {
int value;
shout_connection *s; GET_SC(self, s);
value = shout_get_protocol(s->conn);
return INT2FIX(value);
}
|
#protocol=(value) ⇒ Object
Set the protocol to use when connecting. Default is Shout::HTTP. Possible values are:
- Shout::HTTP
-
HTTP; the protocol used by Icecast.
- Shout::XAUDIOCAST
-
XAudioCast. Obsolete.
- Shout::ICY
-
Icy. Obsolete. Used by Shoutcast.
518 519 520 521 522 523 524 525 526 527 528 |
# File 'ext/shout_ext.c', line 518
VALUE _sh_proto_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_FIXNUM);
err = shout_set_protocol(s->conn, FIX2INT(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#public ⇒ Object
396 397 398 399 400 401 402 |
# File 'ext/shout_ext.c', line 396
VALUE _sh_public(VALUE self) {
int value;
shout_connection *s; GET_SC(self, s);
value = shout_get_public(s->conn);
return INT2FIX(value);
}
|
#public=(value) ⇒ Object
Set whether or not this stream should be “public”, i.e. advertised to a yp server such as yp.icecast.org. True or false. Nil counts as false.
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'ext/shout_ext.c', line 589
VALUE _sh_public_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
if(value == Qfalse || value == Qnil ||
(FIXNUM_P(value) && FIX2INT(value) == 0) ) {
err = shout_set_public(s->conn, 0);
} else {
err = shout_set_public(s->conn, 1);
}
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#send(to_send) ⇒ Object
Send some data. to_send is a String containing the data to send.
248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'ext/shout_ext.c', line 248
static VALUE _sh_send(VALUE self, VALUE to_send) {
int err;
shout_connection *s;
GET_SC(self, s);
Check_SafeStr(to_send);
err = shout_send(s->conn, (unsigned char *) (RSTRING_PTR(to_send)),
RSTRING_LEN(to_send));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return Qtrue;
}
|
#send_non_blocking(to_send) ⇒ Object
The new _sh_send_non_blocking function (aka #send_non_blocking method) packing the arguments of _sh_send in a struct and wrapping the _sh_send call into a rb_thread_blocking_region call.
280 281 282 283 284 285 |
# File 'ext/shout_ext.c', line 280
static VALUE _sh_send_non_blocking(VALUE self, VALUE to_send) {
SHOUT_SEND_ARGS send_args;
send_args.self = self;
send_args.to_send = (unsigned char *) to_send;
return rb_thread_blocking_region(_sh_send_non_block_unpack, &send_args, RUBY_UBF_IO, NULL);
}
|
#sync ⇒ Object
Sleep the necessary amount of time to play back the audio data sent since the last call to #sync. After calling this, it’s time to send more data.
291 292 293 294 295 296 297 |
# File 'ext/shout_ext.c', line 291
static VALUE _sh_sync(VALUE self) {
shout_connection *s;
GET_SC(self, s);
shout_sync(s->conn);
return Qtrue;
}
|
#url ⇒ Object
414 415 416 417 418 419 420 |
# File 'ext/shout_ext.c', line 414
VALUE _sh_url(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_url(s->conn);
return rb_str_new2(value);
}
|
#url=(value) ⇒ Object
Set the URL to send the data to. Takes a string.
619 620 621 622 623 624 625 626 627 628 629 |
# File 'ext/shout_ext.c', line 619
VALUE _sh_url_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_url(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#user ⇒ Object
333 334 335 336 337 338 339 |
# File 'ext/shout_ext.c', line 333
VALUE _sh_user(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_user(s->conn);
return rb_str_new2(value);
}
|
#user=(value) ⇒ Object
Set the user to authenticate as. The default is “source”.
487 488 489 490 491 492 493 494 495 496 497 |
# File 'ext/shout_ext.c', line 487
VALUE _sh_user_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_user(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#user_agent ⇒ Object
387 388 389 390 391 392 393 |
# File 'ext/shout_ext.c', line 387
VALUE _sh_agent(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_agent(s->conn);
return rb_str_new2(value);
}
|
#user_agent=(value) ⇒ Object
Set the User-Agent reported. The default is “libshout/<libshout version>”, e.g. “libshout/2.0.0”.
575 576 577 578 579 580 581 582 583 584 585 |
# File 'ext/shout_ext.c', line 575
VALUE _sh_agent_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_agent(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|
#username ⇒ Object
333 334 335 336 337 338 339 |
# File 'ext/shout_ext.c', line 333
VALUE _sh_user(VALUE self) {
const char *value;
shout_connection *s; GET_SC(self, s);
value = shout_get_user(s->conn);
return rb_str_new2(value);
}
|
#username=(value) ⇒ Object
Set the user to authenticate as. The default is “source”.
487 488 489 490 491 492 493 494 495 496 497 |
# File 'ext/shout_ext.c', line 487
VALUE _sh_user_eq(VALUE self, VALUE value) {
int err;
shout_connection *s; GET_SC(self, s);
Check_Type(value, T_STRING);
err = shout_set_user(s->conn, RSTRING_PTR(value));
if(err != SHOUTERR_SUCCESS) {
raise_shout_error(s->conn);
}
return value;
}
|