envato / exiv2

A simple wrapper around exiv2
MIT License
25 stars 17 forks source link

Simple write support and array like accessors. #2

Closed jgraichen closed 13 years ago

jgraichen commented 13 years ago

I've added simple write support for all tag types. All values are converted to strings without type check. Iptc, Xmp and Exif Data classes have array like accessors to get single values.

Tests are included and passing with Ruby 1.8.7, 1.9.3 and REE 1.8.7 on Linux.

joho commented 13 years ago

Hey I just tried to run the tests on your branch and can't build....

joho6[06:54:44]:~/source/envato/exiv2(write)
♺ rake spec
(in /Users/joho/source/envato/exiv2)
cd tmp/i686-darwin10.7.4/exiv2/1.8.7
make
g++  -I. -I/opt/local/include -I. -I/Users/joho/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/i686-darwin10.7.4 -I../../../../ext/exiv2   -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -g -O2  -pipe -fno-common    -c    ../../../../ext/exiv2/exiv2.cpp
../../../../ext/exiv2/exiv2.cpp: In function ‘VALUE exif_data_add(VALUE, VALUE, VALUE)’:
../../../../ext/exiv2/exiv2.cpp:193: error: ‘class Exiv2::ExifKey’ has no member named ‘defaultTypeId’
make: *** [exiv2.o] Error 1
rake aborted!
Command failed with status (2): [make...]

(See full trace by running task with --trace)

I just confirmed they pass in master. Any ideas? What version of exiv2 have you got installed locally?

jgraichen commented 13 years ago

Exiv2 cli tool says I'm using version 0.21.1:

$ exiv2 -V
exiv2 0.21.1
joho commented 13 years ago

Hmmn, we're running 0.20 in dev and production (across around 20 boxes)

It might be a lot to ask, but is there any chance you could write this to work across both versions?

jgraichen commented 13 years ago

I'll give it a try. But it might take a while because it was my first experience with C++.

joho commented 13 years ago

Well good luck and godspeed then ;)

Is an awesome patch though and will definitely merge when it'll work in our environment. Thanks heaps.

jgraichen commented 13 years ago

Should now work with exiv2 v0.20 too. I just have to check exiv2 version on compile-time to decide which method I have to use.

All tests pass on Debian Linux with REE and exiv2 v0.20.

joho commented 13 years ago

Yep, just pulled, rebuilt and tests were green.

Thanks so much for this, this is actually going to help us a large amount with an upcoming photodune feature we want to do.