| Class | DiscID::DiscID |
| In: |
ext/ext.c
|
| Parent: | Object |
Read the disc id from the medium in the given device. If the argument is ommitted, DiscID.default_device is used instead.
/*
* call-seq:
* DiscID::DiscID.read([device]) -> object
*
* Read the disc id from the medium in the given device.
* If the argument is ommitted, DiscID.default_device is used instead.
*/
static VALUE
c_read (int argc, VALUE *argv, VALUE klass)
{
VALUE self, device;
RbDiscID *o;
char *cdev = NULL;
int s;
rb_scan_args (argc, argv, "01", &device);
if (!NIL_P (device))
cdev = StringValuePtr (device);
self = rb_class_new_instance (0, NULL, klass);
Data_Get_Struct (self, RbDiscID, o);
s = discid_read (o->real, cdev);
if (!s)
rb_raise (eReadError, discid_get_error_msg (o->real));
return self;
}
Returns the submission url for the disc id.
/*
* call-seq:
* discid.submission_url -> string
*
* Returns the submission url for the disc id.
*/
static VALUE
c_submission_url (VALUE self)
{
RbDiscID *o;
char *s;
Data_Get_Struct (self, RbDiscID, o);
s = discid_get_submission_url (o->real);
return rb_str_new2 (s);
}