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.
170 171 172 173 174 175 176 |
# File 'ext/shout_ext.c', line 170 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
179 180 181 182 183 |
# File 'ext/shout_ext.c', line 179
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.
186 187 188 189 190 191 192 |
# File 'ext/shout_ext.c', line 186 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
391 392 393 394 395 396 397 |
# File 'ext/shout_ext.c', line 391
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”.
579 580 581 582 583 584 585 586 587 588 589 |
# File 'ext/shout_ext.c', line 579
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
444 445 446 447 448 449 450 451 |
# File 'ext/shout_ext.c', line 444
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.
679 680 681 682 683 684 685 686 687 688 689 |
# File 'ext/shout_ext.c', line 679
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.
221 222 223 224 225 226 227 228 229 230 231 |
# File 'ext/shout_ext.c', line 221
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.
197 198 199 200 201 202 203 204 205 206 207 |
# File 'ext/shout_ext.c', line 197
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.
214 215 216 |
# File 'ext/shout_ext.c', line 214 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.
236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'ext/shout_ext.c', line 236
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.
306 307 308 309 310 311 312 313 |
# File 'ext/shout_ext.c', line 306
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
436 437 438 439 440 441 442 |
# File 'ext/shout_ext.c', line 436
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.
649 650 651 652 653 654 655 656 657 658 659 |
# File 'ext/shout_ext.c', line 649
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.
221 222 223 224 225 226 227 228 229 230 231 |
# File 'ext/shout_ext.c', line 221
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
382 383 384 385 386 387 388 |
# File 'ext/shout_ext.c', line 382
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.
565 566 567 568 569 570 571 572 573 574 575 |
# File 'ext/shout_ext.c', line 565
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
364 365 366 367 368 369 370 |
# File 'ext/shout_ext.c', line 364
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
538 539 540 541 542 543 544 545 546 547 548 |
# File 'ext/shout_ext.c', line 538
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
427 428 429 430 431 432 433 |
# File 'ext/shout_ext.c', line 427
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.
636 637 638 639 640 641 642 643 644 645 646 |
# File 'ext/shout_ext.c', line 636
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
319 320 321 322 323 324 325 |
# File 'ext/shout_ext.c', line 319
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.
465 466 467 468 469 470 471 472 473 474 475 |
# File 'ext/shout_ext.c', line 465
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.
665 666 667 668 669 670 671 672 673 674 675 676 |
# File 'ext/shout_ext.c', line 665
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
373 374 375 376 377 378 379 |
# File 'ext/shout_ext.c', line 373
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.
551 552 553 554 555 556 557 558 559 560 561 |
# File 'ext/shout_ext.c', line 551
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
409 410 411 412 413 414 415 |
# File 'ext/shout_ext.c', line 409
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.”
610 611 612 613 614 615 616 617 618 619 620 |
# File 'ext/shout_ext.c', line 610
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.
197 198 199 200 201 202 203 204 205 206 207 |
# File 'ext/shout_ext.c', line 197
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
346 347 348 349 350 351 352 |
# File 'ext/shout_ext.c', line 346
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.
504 505 506 507 508 509 510 511 512 513 514 |
# File 'ext/shout_ext.c', line 504
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
346 347 348 349 350 351 352 |
# File 'ext/shout_ext.c', line 346
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.
504 505 506 507 508 509 510 511 512 513 514 |
# File 'ext/shout_ext.c', line 504
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
328 329 330 331 332 333 334 |
# File 'ext/shout_ext.c', line 328
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.
478 479 480 481 482 483 484 485 486 487 488 |
# File 'ext/shout_ext.c', line 478
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
355 356 357 358 359 360 361 |
# File 'ext/shout_ext.c', line 355
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.
522 523 524 525 526 527 528 529 530 531 532 |
# File 'ext/shout_ext.c', line 522
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
400 401 402 403 404 405 406 |
# File 'ext/shout_ext.c', line 400
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.
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'ext/shout_ext.c', line 593
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.
252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'ext/shout_ext.c', line 252
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.
284 285 286 287 288 289 |
# File 'ext/shout_ext.c', line 284
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.
295 296 297 298 299 300 301 |
# File 'ext/shout_ext.c', line 295
static VALUE _sh_sync(VALUE self) {
shout_connection *s;
GET_SC(self, s);
shout_sync(s->conn);
return Qtrue;
}
|
#url ⇒ Object
418 419 420 421 422 423 424 |
# File 'ext/shout_ext.c', line 418
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.
623 624 625 626 627 628 629 630 631 632 633 |
# File 'ext/shout_ext.c', line 623
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
337 338 339 340 341 342 343 |
# File 'ext/shout_ext.c', line 337
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”.
491 492 493 494 495 496 497 498 499 500 501 |
# File 'ext/shout_ext.c', line 491
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
391 392 393 394 395 396 397 |
# File 'ext/shout_ext.c', line 391
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”.
579 580 581 582 583 584 585 586 587 588 589 |
# File 'ext/shout_ext.c', line 579
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
337 338 339 340 341 342 343 |
# File 'ext/shout_ext.c', line 337
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”.
491 492 493 494 495 496 497 498 499 500 501 |
# File 'ext/shout_ext.c', line 491
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;
}
|