exif 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile +1 -3
- data/README.md +1 -1
- data/Rakefile +5 -1
- data/exif.gemspec +1 -0
- data/ext/exif/data.c +8 -8
- data/ext/exif/data.h +8 -8
- data/lib/exif/version.rb +1 -1
- data/spec/exif_spec.rb +0 -4
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62ee375b5a2f547b733036b6d45e9f07f9157a7f
|
4
|
+
data.tar.gz: 1777637e0b478a47d4008a0953addbbc1b24f73b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47983ae0fb7a3ad48c5b01d973da975c0d74bd1e50abb1db4ff310a4296b29c9ee435286c80a5280f45f804524f82e2f118bce0e8b0219f5674913206e09741d
|
7
|
+
data.tar.gz: f026ead2e3e8c67a13cec1093bba58c7c162d7c67e347c967362ee8c19fe992eba2a077ea91ccd3130004451a1b97d72742a05bc3dcc8a73861a762d91aec272
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/exif.gemspec
CHANGED
data/ext/exif/data.c
CHANGED
@@ -22,7 +22,7 @@ void init_data(){
|
|
22
22
|
rb_define_method(rb_cData, "[]", rb_value, 1);
|
23
23
|
}
|
24
24
|
|
25
|
-
|
25
|
+
VALUE rb_new(VALUE self, VALUE file_path){
|
26
26
|
Check_Type(file_path, T_STRING);
|
27
27
|
ExifData *ed = exif_data_new_from_file(StringValueCStr(file_path));
|
28
28
|
if(!ed) rb_raise(rb_eRuntimeError, "File not readable or no EXIF data in file.");
|
@@ -32,19 +32,19 @@ static VALUE rb_new(VALUE self, VALUE file_path){
|
|
32
32
|
return rb_data;
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
VALUE rb_dump(VALUE self){
|
36
36
|
ExifData *ed;
|
37
37
|
Data_Get_Struct(self, ExifData, ed);
|
38
38
|
exif_data_dump(ed);
|
39
39
|
return Qnil;
|
40
40
|
}
|
41
41
|
|
42
|
-
|
42
|
+
VALUE rb_value(VALUE self, VALUE key){
|
43
43
|
VALUE rb_contents = rb_iv_get(self, "@contents");
|
44
44
|
return rb_hash_aref(rb_contents, key);
|
45
45
|
}
|
46
46
|
|
47
|
-
|
47
|
+
void each_content(ExifContent *ec, void *self_ptr){
|
48
48
|
VALUE *self = (VALUE*)self_ptr;
|
49
49
|
VALUE rb_contents = rb_iv_get(*self, "@contents");
|
50
50
|
Check_Type(rb_contents, T_HASH);
|
@@ -55,11 +55,11 @@ static void each_content(ExifContent *ec, void *self_ptr){
|
|
55
55
|
exif_content_foreach_entry(ec, each_entry, self);
|
56
56
|
}
|
57
57
|
|
58
|
-
|
58
|
+
void each_entry(ExifEntry *ee, void *self_ptr){
|
59
59
|
VALUE *self = (VALUE*)self_ptr;
|
60
60
|
VALUE rb_contents = rb_iv_get(*self, "@contents");
|
61
61
|
ExifIfd ifd = exif_entry_get_ifd(ee);
|
62
|
-
char *attr_name = attr_string(ifd, ee->tag);
|
62
|
+
const char *attr_name = attr_string(ifd, ee->tag);
|
63
63
|
VALUE tag_name = ID2SYM(rb_intern(attr_name + 1));
|
64
64
|
char buf[500];
|
65
65
|
exif_entry_get_value(ee, buf, sizeof(buf));
|
@@ -101,7 +101,7 @@ static void each_entry(ExifEntry *ee, void *self_ptr){
|
|
101
101
|
rb_iv_set(*self, attr_name, value);
|
102
102
|
}
|
103
103
|
|
104
|
-
|
104
|
+
VALUE process_value(VALUE *self_ptr, ExifIfd ifd, ExifTag tag, char *buf){
|
105
105
|
ExifData *ed;
|
106
106
|
Data_Get_Struct(*self_ptr, ExifData, ed);
|
107
107
|
switch((int)tag){
|
@@ -146,7 +146,7 @@ static VALUE process_value(VALUE *self_ptr, ExifIfd ifd, ExifTag tag, char *buf)
|
|
146
146
|
return rb_str_new_cstr(buf);
|
147
147
|
}
|
148
148
|
|
149
|
-
|
149
|
+
const char* attr_string(ExifIfd ifd, ExifTag tag){
|
150
150
|
switch((int)tag){
|
151
151
|
case EXIF_TAG_INTEROPERABILITY_INDEX: /* EXIF_TAG_GPS_LATITUDE_REF */
|
152
152
|
return ifd == EXIF_IFD_GPS ? "@gps_latitude_ref" : "@interoperability_index";
|
data/ext/exif/data.h
CHANGED
@@ -4,17 +4,17 @@
|
|
4
4
|
#include <libexif/exif-data.h>
|
5
5
|
#include "ruby.h"
|
6
6
|
|
7
|
-
static char *attrs[] = {"aperture_value", "artist", "battery_level", "bits_per_sample", "brightness_value", "cfa_pattern", "cfa_repeat_pattern_dim", "color_space", "components_configuration", "compressed_bits_per_pixel", "compression", "contrast", "copyright", "custom_rendered", "date_time", "date_time_digitized", "date_time_original", "device_setting_description", "digital_zoom_ratio", "document_name", "exif_ifd_pointer", "exif_version", "exposure_bias_value", "exposure_index", "exposure_mode", "exposure_program", "exposure_time", "file_source", "fill_order", "flash", "flash_energy", "flash_pix_version", "fnumber", "focal_length", "focal_length_in_35mm_film", "focal_plane_resolution_unit", "focal_plane_x_resolution", "focal_plane_y_resolution", "gain_control", "gamma", "gps_altitude", "gps_altitude_ref", "gps_area_information", "gps_date_stamp", "gps_dest_bearing", "gps_dest_bearing_ref", "gps_dest_distance", "gps_dest_distance_ref", "gps_dest_latitude", "gps_dest_latitude_ref", "gps_dest_longitude", "gps_dest_longitude_ref", "gps_differential", "gps_dop", "gps_img_direction", "gps_img_direction_ref", "gps_info_ifd_pointer", "gps_latitude", "gps_latitude_ref", "gps_longitude", "gps_longitude_ref", "gps_map_datum", "gps_measure_mode", "gps_processing_method", "gps_satellites", "gps_speed", "gps_speed_ref", "gps_status", "gps_time_stamp", "gps_track", "gps_track_ref", "gps_version_id", "image_description", "image_length", "image_resources", "image_unique_id", "image_width", "inter_color_profile", "interoperability_ifd_pointer", "interoperability_index", "interoperability_version", "iptc_naa", "iso_speed_ratings", "jpeg_interchange_format", "jpeg_interchange_format_length", "jpeg_proc", "light_source", "make", "maker_note", "max_aperture_value", "metering_mode", "model", "new_cfa_pattern", "new_subfile_type", "oecf", "orientation", "padding", "photometric_interpretation", "pixel_x_dimension", "pixel_y_dimension", "planar_configuration", "primary_chromaticities", "print_image_matching", "reference_black_white", "related_image_file_format", "related_image_length", "related_image_width", "related_sound_file", "resolution_unit", "rows_per_strip", "samples_per_pixel", "saturation", "scene_capture_type", "scene_type", "sensing_method", "sharpness", "shutter_speed_value", "software", "spatial_frequency_response", "spectral_sensitivity", "strip_byte_counts", "strip_offsets", "sub_ifds", "sub_sec_time", "sub_sec_time_digitized", "sub_sec_time_original", "subject_area", "subject_distance", "subject_distance_range", "subject_location", "tiff_ep_standard_id", "time_zone_offset", "transfer_function", "transfer_range", "user_comment", "white_balance", "white_point", "x_resolution", "xml_packet", "xp_author", "xp_comment", "xp_keywords", "xp_subject", "xp_title", "y_resolution", "ycbcr_coefficients", "ycbcr_positioning", "ycbcr_sub_sampling"};
|
7
|
+
static const char *attrs[] = {"aperture_value", "artist", "battery_level", "bits_per_sample", "brightness_value", "cfa_pattern", "cfa_repeat_pattern_dim", "color_space", "components_configuration", "compressed_bits_per_pixel", "compression", "contrast", "copyright", "custom_rendered", "date_time", "date_time_digitized", "date_time_original", "device_setting_description", "digital_zoom_ratio", "document_name", "exif_ifd_pointer", "exif_version", "exposure_bias_value", "exposure_index", "exposure_mode", "exposure_program", "exposure_time", "file_source", "fill_order", "flash", "flash_energy", "flash_pix_version", "fnumber", "focal_length", "focal_length_in_35mm_film", "focal_plane_resolution_unit", "focal_plane_x_resolution", "focal_plane_y_resolution", "gain_control", "gamma", "gps_altitude", "gps_altitude_ref", "gps_area_information", "gps_date_stamp", "gps_dest_bearing", "gps_dest_bearing_ref", "gps_dest_distance", "gps_dest_distance_ref", "gps_dest_latitude", "gps_dest_latitude_ref", "gps_dest_longitude", "gps_dest_longitude_ref", "gps_differential", "gps_dop", "gps_img_direction", "gps_img_direction_ref", "gps_info_ifd_pointer", "gps_latitude", "gps_latitude_ref", "gps_longitude", "gps_longitude_ref", "gps_map_datum", "gps_measure_mode", "gps_processing_method", "gps_satellites", "gps_speed", "gps_speed_ref", "gps_status", "gps_time_stamp", "gps_track", "gps_track_ref", "gps_version_id", "image_description", "image_length", "image_resources", "image_unique_id", "image_width", "inter_color_profile", "interoperability_ifd_pointer", "interoperability_index", "interoperability_version", "iptc_naa", "iso_speed_ratings", "jpeg_interchange_format", "jpeg_interchange_format_length", "jpeg_proc", "light_source", "make", "maker_note", "max_aperture_value", "metering_mode", "model", "new_cfa_pattern", "new_subfile_type", "oecf", "orientation", "padding", "photometric_interpretation", "pixel_x_dimension", "pixel_y_dimension", "planar_configuration", "primary_chromaticities", "print_image_matching", "reference_black_white", "related_image_file_format", "related_image_length", "related_image_width", "related_sound_file", "resolution_unit", "rows_per_strip", "samples_per_pixel", "saturation", "scene_capture_type", "scene_type", "sensing_method", "sharpness", "shutter_speed_value", "software", "spatial_frequency_response", "spectral_sensitivity", "strip_byte_counts", "strip_offsets", "sub_ifds", "sub_sec_time", "sub_sec_time_digitized", "sub_sec_time_original", "subject_area", "subject_distance", "subject_distance_range", "subject_location", "tiff_ep_standard_id", "time_zone_offset", "transfer_function", "transfer_range", "user_comment", "white_balance", "white_point", "x_resolution", "xml_packet", "xp_author", "xp_comment", "xp_keywords", "xp_subject", "xp_title", "y_resolution", "ycbcr_coefficients", "ycbcr_positioning", "ycbcr_sub_sampling"};
|
8
8
|
|
9
9
|
void init_data();
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
VALUE rb_new(VALUE self, VALUE file_path);
|
12
|
+
VALUE rb_dump(VALUE self);
|
13
|
+
VALUE rb_value(VALUE self, VALUE key);
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
void each_content(ExifContent *ec, void *user_data);
|
16
|
+
void each_entry(ExifEntry *, void *user_data);
|
17
|
+
VALUE process_value(VALUE *self_ptr, ExifIfd ifd, ExifTag tag, char *buf);
|
18
|
+
const char* attr_string(ExifIfd ifd, ExifTag tag);
|
19
19
|
|
20
20
|
#endif /* DATA_H */
|
data/lib/exif/version.rb
CHANGED
data/spec/exif_spec.rb
CHANGED
@@ -5,10 +5,6 @@ describe Exif do
|
|
5
5
|
@data = Exif::Data.new(File.expand_path('../sample.jpg', __FILE__))
|
6
6
|
end
|
7
7
|
|
8
|
-
# it '#dump' do
|
9
|
-
# expect { @data.dump }.not_to raise_error
|
10
|
-
# end
|
11
|
-
|
12
8
|
it 'works' do
|
13
9
|
expect(@data.model).to eq 'NIKON D600'
|
14
10
|
expect(@data.image_width).to eq 4000
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jian Weihang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Ruby EXIF reader written in C extension.
|
56
70
|
email:
|
57
71
|
- tonytonyjan@gmail.com
|
@@ -62,6 +76,7 @@ extra_rdoc_files: []
|
|
62
76
|
files:
|
63
77
|
- ".gitignore"
|
64
78
|
- ".rspec"
|
79
|
+
- ".travis.yml"
|
65
80
|
- Gemfile
|
66
81
|
- LICENSE.txt
|
67
82
|
- README.md
|
@@ -98,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
113
|
version: '0'
|
99
114
|
requirements: []
|
100
115
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.4.
|
116
|
+
rubygems_version: 2.4.5
|
102
117
|
signing_key:
|
103
118
|
specification_version: 4
|
104
119
|
summary: Ruby EXIF reader written in C extension.
|
@@ -106,3 +121,4 @@ test_files:
|
|
106
121
|
- spec/exif_spec.rb
|
107
122
|
- spec/sample.jpg
|
108
123
|
- spec/spec_helper.rb
|
124
|
+
has_rdoc:
|