ruby-exiv2 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/ext/exif.cpp +7 -1
- data/ext/iptc.cpp +9 -1
- data/ext/marshall.cpp +7 -1
- data/test/image.rb +7 -0
- metadata +2 -2
data/Rakefile
CHANGED
data/ext/exif.cpp
CHANGED
@@ -51,9 +51,15 @@ static bool marshall_value(Exiv2::ExifData &data, const char* key, VALUE value)
|
|
51
51
|
data[key] = Exiv2::Rational(NUM2INT(value), 1);
|
52
52
|
return true;
|
53
53
|
}
|
54
|
+
case Exiv2::date: {
|
55
|
+
int year = NUM2INT(rb_funcall(value, rb_intern("year"), 0));
|
56
|
+
int month = NUM2INT(rb_funcall(value, rb_intern("month"), 0));
|
57
|
+
int day = NUM2INT(rb_funcall(value, rb_intern("day"), 0));
|
58
|
+
data[key] = Exiv2::DateValue(year, month, day);
|
59
|
+
return true;
|
60
|
+
}
|
54
61
|
|
55
62
|
case Exiv2::invalid6:
|
56
|
-
case Exiv2::date:
|
57
63
|
case Exiv2::time:
|
58
64
|
case Exiv2::comment:
|
59
65
|
case Exiv2::directory:
|
data/ext/iptc.cpp
CHANGED
@@ -52,8 +52,16 @@ static bool marshall_value(Exiv2::IptcData &data, const char* key, VALUE value)
|
|
52
52
|
return true;
|
53
53
|
}
|
54
54
|
|
55
|
-
case Exiv2::invalid6:
|
56
55
|
case Exiv2::date:
|
56
|
+
{
|
57
|
+
int year = NUM2INT(rb_funcall(value, rb_intern("year"), 0));
|
58
|
+
int month = NUM2INT(rb_funcall(value, rb_intern("month"), 0));
|
59
|
+
int day = NUM2INT(rb_funcall(value, rb_intern("day"), 0));
|
60
|
+
data[key] = Exiv2::DateValue(year, month, day);
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
|
64
|
+
case Exiv2::invalid6:
|
57
65
|
case Exiv2::time:
|
58
66
|
case Exiv2::comment:
|
59
67
|
case Exiv2::directory:
|
data/ext/marshall.cpp
CHANGED
@@ -91,9 +91,15 @@ VALUE unmarshall_value(const Exiv2::Value& value) {
|
|
91
91
|
}
|
92
92
|
return INT2NUM(r.first/r.second);
|
93
93
|
}
|
94
|
+
case Exiv2::date:
|
95
|
+
{
|
96
|
+
Exiv2::DateValue *date_value = dynamic_cast<Exiv2::DateValue *>(const_cast<Exiv2::Value *>(&value));
|
97
|
+
if(!date_value) return Qnil;
|
98
|
+
Exiv2::DateValue::Date date = date_value->getDate();
|
99
|
+
return rb_funcall(rb_cTime, rb_intern("utc"), 3, INT2FIX(date.year), INT2FIX(date.month), INT2FIX(date.day));
|
100
|
+
}
|
94
101
|
|
95
102
|
case Exiv2::invalid6:
|
96
|
-
case Exiv2::date:
|
97
103
|
case Exiv2::time:
|
98
104
|
case Exiv2::comment:
|
99
105
|
case Exiv2::directory:
|
data/test/image.rb
CHANGED
@@ -198,6 +198,13 @@ class ImageTest < Test::Unit::TestCase
|
|
198
198
|
|
199
199
|
assert @img = Exiv2::Image.new(filename)
|
200
200
|
assert_equal "Moscow", @img["Iptc.Application2.City"]
|
201
|
+
|
202
|
+
assert_equal Time.utc(2004, 7, 13), @img["Iptc.Application2.DateCreated"]
|
203
|
+
assert_equal Time.utc(2006, 3, 5), @img["Iptc.Application2.DateCreated"] = Time.utc(2006, 3, 5)
|
204
|
+
assert @img.save
|
205
|
+
|
206
|
+
assert @img = Exiv2::Image.new(filename)
|
207
|
+
assert_equal Time.utc(2006, 3, 5), @img["Iptc.Application2.DateCreated"]
|
201
208
|
end
|
202
209
|
end
|
203
210
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-exiv2
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date: 2007-04-
|
6
|
+
version: "1.1"
|
7
|
+
date: 2007-04-10 00:00:00 +04:00
|
8
8
|
summary: Exiv2 (exif image tags handling) library driver
|
9
9
|
require_paths:
|
10
10
|
- lib
|