Class: RbPod::Device

Inherits:
Object
  • Object
show all
Defined in:
ext/rbpod/device.c

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'ext/rbpod/device.c', line 76

static VALUE rbpod_device_sysinfo_get(VALUE self, VALUE key)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    gchar *value = NULL;
    VALUE result;

    value = itdb_device_get_sysinfo(device, StringValueCStr(key));
    result = (value == NULL) ? Qnil : rb_str_new2(value);

    g_free(value);
    return result;

}

#[]=(key, value) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
# File 'ext/rbpod/device.c', line 90

static VALUE rbpod_device_sysinfo_set(VALUE self, VALUE key, VALUE value)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    gchar *_value, *_key;

    _key   = StringValueCStr(key);
    _value = !NIL_P(value) ? StringValueCStr(value) : NULL;

    itdb_device_set_sysinfo(device, _key, _value);

    return Qnil;
}

#capacityObject



62
63
64
65
66
67
# File 'ext/rbpod/device.c', line 62

static VALUE rbpod_device_capacity_get(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    const Itdb_IpodInfo *info = itdb_device_get_ipod_info(device);
    return DBL2NUM(info->capacity);
}

#generationObject



55
56
57
58
59
60
# File 'ext/rbpod/device.c', line 55

static VALUE rbpod_device_generation_get(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    const Itdb_IpodInfo *info = itdb_device_get_ipod_info(device);
    return rb_str_new2(itdb_info_get_ipod_generation_string(info->ipod_generation));
}

#model_nameObject



41
42
43
44
45
46
# File 'ext/rbpod/device.c', line 41

static VALUE rbpod_device_model_name_get(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    const Itdb_IpodInfo *info = itdb_device_get_ipod_info(device);
    return rb_str_new2(itdb_info_get_ipod_model_name_string(info->ipod_model));
}

#model_numberObject



48
49
50
51
52
53
# File 'ext/rbpod/device.c', line 48

static VALUE rbpod_device_model_number_get(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    const Itdb_IpodInfo *info = itdb_device_get_ipod_info(device);
    return rb_str_new2(info->model_number);
}

#save!Object



103
104
105
106
107
108
109
110
111
112
113
# File 'ext/rbpod/device.c', line 103

static VALUE rbpod_device_sysinfo_save(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    GError *error = NULL;

    if (itdb_device_write_sysinfo(device, &error) == FALSE) {
        return rbpod_raise_error(error);
    }

    return Qnil;
}

#supports_artwork?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'ext/rbpod/device.c', line 23

static VALUE rbpod_device_artwork_support_p(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    return BooleanValue(itdb_device_supports_artwork(device));
}

#supports_chapter_images?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'ext/rbpod/device.c', line 11

static VALUE rbpod_device_chapter_image_support_p(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    return BooleanValue(itdb_device_supports_chapter_image(device));
}

#supports_photos?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
# File 'ext/rbpod/device.c', line 35

static VALUE rbpod_device_photo_support_p(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    return BooleanValue(itdb_device_supports_photo(device));
}

#supports_podcasts?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'ext/rbpod/device.c', line 17

static VALUE rbpod_device_podcast_support_p(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    return BooleanValue(itdb_device_supports_podcast(device));
}

#supports_videos?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'ext/rbpod/device.c', line 29

static VALUE rbpod_device_video_support_p(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    return BooleanValue(itdb_device_supports_video(device));
}

#uuidObject



69
70
71
72
73
74
# File 'ext/rbpod/device.c', line 69

static VALUE rbpod_device_uuid_get(VALUE self)
{
    Itdb_Device *device = TYPED_DATA_PTR(self, Itdb_Device);
    const gchar *uuid = itdb_device_get_uuid(device);
    return (uuid == NULL) ? Qnil : rb_str_new2(uuid);
}