Class DiscID::DiscID
In: ext/ext.c
Parent: Object

call-seq:

 discid.freedb_id -> string

Returns the FreeDB disc id.

Methods

freedb_id   id   read   submission_url  

Public Class methods

Read the disc id from the medium in the given device. If the argument is ommitted, DiscID.default_device is used instead.

[Source]

/*
 * 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;
}

Public Instance methods

Returns the FreeDB disc id.

[Source]

/*
 * call-seq:
 *  discid.freedb_id -> string
 *
 * Returns the FreeDB disc id.
 */
static VALUE
c_freedb_id (VALUE self)
{
        RbDiscID *o;
        char *s;

        Data_Get_Struct (self, RbDiscID, o);

        s = discid_get_freedb_id (o->real);

        return rb_str_new2 (s);
}

Returns the MusicBrainz disc id.

[Source]

/*
 * call-seq:
 *  discid.id -> string
 *
 * Returns the MusicBrainz disc id.
 */
static VALUE
c_id (VALUE self)
{
        RbDiscID *o;
        char *s;

        Data_Get_Struct (self, RbDiscID, o);

        s = discid_get_id (o->real);

        return rb_str_new2 (s);
}

Returns the submission url for the disc id.

[Source]

/*
 * 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);
}

[Validate]