extractexifgps 0.1.0.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.ruby_version +1 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +140 -0
- data/Guardfile +10 -0
- data/LICENSE.txt +19 -0
- data/README.md +36 -0
- data/Rakefile +53 -0
- data/bin/extractexifgps +6 -0
- data/lib/coords.rb +39 -0
- data/lib/directory_files_extractor.rb +50 -0
- data/lib/extractexifgps.rb +12 -0
- data/test/coords_test.rb +61 -0
- data/test/extractexifgps_test.rb +8 -0
- data/test/helper.rb +40 -0
- data/test/images/.DS_Store +0 -0
- data/test/images/cats/.DS_Store +0 -0
- data/test/images/cats/image_e.jpg +0 -0
- data/test/images/image_a.jpg +0 -0
- data/test/images/image_b.jpg +0 -0
- data/test/images/image_c.jpg +0 -0
- data/test/images/image_d.jpg +0 -0
- data/test/integration/directory_files_extractor_test.rb +31 -0
- metadata +237 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 520e90a163beaf80af6f69fa4e0583a9e2729f4289917a1563980e80395eb2e3
|
4
|
+
data.tar.gz: 0464be9c8c7c14b94ad119b6498e00402f333d8dc3ed7bc49e7c9db39a52cbc9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f4a69e1094d31aff3fe02e2b6004cb809b82aa1b6f83a75a1357d1e8d4fcb11cba88c5ab2e336777c9d96c16076284a8d19b63057a736b4c13c71b55a93116be
|
7
|
+
data.tar.gz: 02ff1a5af99c9880936a9feb4f80e1c48e17f3f04b6c9e08c5ebb52810379cfaa2d80bbe9f8dbc09d34e212241770c03483f1d5e29368c247662ee59bd8b9b75
|
data/.document
ADDED
data/.ruby_version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'exif', '~> 2.2'
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'bundler', '~> 1.11'
|
7
|
+
gem 'jeweler', '~> 2.3.9'
|
8
|
+
gem 'byebug', '~> 8.2'
|
9
|
+
|
10
|
+
gem 'yard', '~> 0.7'
|
11
|
+
gem 'rdoc', '~> 3.12'
|
12
|
+
|
13
|
+
gem 'minitest', '~> 5.0'
|
14
|
+
gem 'minitest-reporters', '~> 1.1'
|
15
|
+
gem 'simplecov', '~> 0.11'
|
16
|
+
gem 'guard', '~> 2.14'
|
17
|
+
gem 'guard-minitest', '~> 2.4'
|
18
|
+
|
19
|
+
gem 'rubocop', '~> 0.48'
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
ansi (1.5.0)
|
6
|
+
ast (2.4.0)
|
7
|
+
builder (3.2.3)
|
8
|
+
byebug (8.2.5)
|
9
|
+
coderay (1.1.2)
|
10
|
+
descendants_tracker (0.0.4)
|
11
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
12
|
+
docile (1.3.1)
|
13
|
+
exif (2.2.0)
|
14
|
+
faraday (0.9.2)
|
15
|
+
multipart-post (>= 1.2, < 3)
|
16
|
+
ffi (1.9.25)
|
17
|
+
formatador (0.2.5)
|
18
|
+
git (1.4.0)
|
19
|
+
github_api (0.16.0)
|
20
|
+
addressable (~> 2.4.0)
|
21
|
+
descendants_tracker (~> 0.0.4)
|
22
|
+
faraday (~> 0.8, < 0.10)
|
23
|
+
hashie (>= 3.4)
|
24
|
+
mime-types (>= 1.16, < 3.0)
|
25
|
+
oauth2 (~> 1.0)
|
26
|
+
guard (2.14.2)
|
27
|
+
formatador (>= 0.2.4)
|
28
|
+
listen (>= 2.7, < 4.0)
|
29
|
+
lumberjack (>= 1.0.12, < 2.0)
|
30
|
+
nenv (~> 0.1)
|
31
|
+
notiffany (~> 0.0)
|
32
|
+
pry (>= 0.9.12)
|
33
|
+
shellany (~> 0.0)
|
34
|
+
thor (>= 0.18.1)
|
35
|
+
guard-compat (1.2.1)
|
36
|
+
guard-minitest (2.4.6)
|
37
|
+
guard-compat (~> 1.2)
|
38
|
+
minitest (>= 3.0)
|
39
|
+
hashie (3.5.7)
|
40
|
+
highline (2.0.0)
|
41
|
+
jaro_winkler (1.5.1)
|
42
|
+
jeweler (2.3.9)
|
43
|
+
builder
|
44
|
+
bundler
|
45
|
+
git (>= 1.2.5)
|
46
|
+
github_api (~> 0.16.0)
|
47
|
+
highline (>= 1.6.15)
|
48
|
+
nokogiri (>= 1.5.10)
|
49
|
+
psych
|
50
|
+
rake
|
51
|
+
rdoc
|
52
|
+
semver2
|
53
|
+
json (1.8.6)
|
54
|
+
jwt (1.5.6)
|
55
|
+
listen (3.1.5)
|
56
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
57
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
58
|
+
ruby_dep (~> 1.2)
|
59
|
+
lumberjack (1.0.13)
|
60
|
+
method_source (0.9.0)
|
61
|
+
mime-types (2.99.3)
|
62
|
+
mini_portile2 (2.3.0)
|
63
|
+
minitest (5.11.3)
|
64
|
+
minitest-reporters (1.3.1)
|
65
|
+
ansi
|
66
|
+
builder
|
67
|
+
minitest (>= 5.0)
|
68
|
+
ruby-progressbar
|
69
|
+
multi_json (1.13.1)
|
70
|
+
multi_xml (0.6.0)
|
71
|
+
multipart-post (2.0.0)
|
72
|
+
nenv (0.3.0)
|
73
|
+
nokogiri (1.8.4)
|
74
|
+
mini_portile2 (~> 2.3.0)
|
75
|
+
notiffany (0.1.1)
|
76
|
+
nenv (~> 0.1)
|
77
|
+
shellany (~> 0.0)
|
78
|
+
oauth2 (1.4.0)
|
79
|
+
faraday (>= 0.8, < 0.13)
|
80
|
+
jwt (~> 1.0)
|
81
|
+
multi_json (~> 1.3)
|
82
|
+
multi_xml (~> 0.5)
|
83
|
+
rack (>= 1.2, < 3)
|
84
|
+
parallel (1.12.1)
|
85
|
+
parser (2.5.1.2)
|
86
|
+
ast (~> 2.4.0)
|
87
|
+
powerpack (0.1.2)
|
88
|
+
pry (0.11.3)
|
89
|
+
coderay (~> 1.1.0)
|
90
|
+
method_source (~> 0.9.0)
|
91
|
+
psych (3.0.2)
|
92
|
+
rack (2.0.5)
|
93
|
+
rainbow (3.0.0)
|
94
|
+
rake (12.3.1)
|
95
|
+
rb-fsevent (0.10.3)
|
96
|
+
rb-inotify (0.9.10)
|
97
|
+
ffi (>= 0.5.0, < 2)
|
98
|
+
rdoc (3.12.2)
|
99
|
+
json (~> 1.4)
|
100
|
+
rubocop (0.58.2)
|
101
|
+
jaro_winkler (~> 1.5.1)
|
102
|
+
parallel (~> 1.10)
|
103
|
+
parser (>= 2.5, != 2.5.1.1)
|
104
|
+
powerpack (~> 0.1)
|
105
|
+
rainbow (>= 2.2.2, < 4.0)
|
106
|
+
ruby-progressbar (~> 1.7)
|
107
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
108
|
+
ruby-progressbar (1.10.0)
|
109
|
+
ruby_dep (1.5.0)
|
110
|
+
semver2 (3.4.2)
|
111
|
+
shellany (0.0.1)
|
112
|
+
simplecov (0.16.1)
|
113
|
+
docile (~> 1.1)
|
114
|
+
json (>= 1.8, < 3)
|
115
|
+
simplecov-html (~> 0.10.0)
|
116
|
+
simplecov-html (0.10.2)
|
117
|
+
thor (0.20.0)
|
118
|
+
thread_safe (0.3.6)
|
119
|
+
unicode-display_width (1.4.0)
|
120
|
+
yard (0.9.15)
|
121
|
+
|
122
|
+
PLATFORMS
|
123
|
+
ruby
|
124
|
+
|
125
|
+
DEPENDENCIES
|
126
|
+
bundler (~> 1.11)
|
127
|
+
byebug (~> 8.2)
|
128
|
+
exif (~> 2.2)
|
129
|
+
guard (~> 2.14)
|
130
|
+
guard-minitest (~> 2.4)
|
131
|
+
jeweler (~> 2.3.9)
|
132
|
+
minitest (~> 5.0)
|
133
|
+
minitest-reporters (~> 1.1)
|
134
|
+
rdoc (~> 3.12)
|
135
|
+
rubocop (~> 0.48)
|
136
|
+
simplecov (~> 0.11)
|
137
|
+
yard (~> 0.7)
|
138
|
+
|
139
|
+
BUNDLED WITH
|
140
|
+
1.16.3
|
data/Guardfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# vim: ft=ruby:
|
2
|
+
|
3
|
+
guard 'minitest', all_on_start: false, all_after_pass: false,
|
4
|
+
notification: true do
|
5
|
+
|
6
|
+
watch('Gemfile.lock')
|
7
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
8
|
+
watch(%r{^test/.+_test\.rb$})
|
9
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
10
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2018 Jon Sangster
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# ExtractExifGps
|
2
|
+
|
3
|
+
`extractexifgps` is an application to extract EXIF GPS data from all the images
|
4
|
+
in a given directory.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```sh
|
9
|
+
gem install extractexifgps
|
10
|
+
```
|
11
|
+
|
12
|
+
## Example Usage
|
13
|
+
|
14
|
+
```sh
|
15
|
+
extractexifgps > images_in_current_directory.csv
|
16
|
+
extractexifgps /some/directory/ > images_in_some_directory.csv
|
17
|
+
```
|
18
|
+
|
19
|
+
## Contributing to ExtractExifGps
|
20
|
+
|
21
|
+
* Check out the latest master to make sure the feature hasn't been
|
22
|
+
implemented or the bug hasn't been fixed yet.
|
23
|
+
* Check out the issue tracker to make sure someone already hasn't requested
|
24
|
+
it and/or contributed it.
|
25
|
+
* Fork the project.
|
26
|
+
* Start a feature/bugfix branch.
|
27
|
+
* Commit and push until you are happy with your contribution.
|
28
|
+
* Make sure to add tests for it. This is important so I don't break it in a
|
29
|
+
future version unintentionally.
|
30
|
+
* Please try not to mess with the Rakefile, version, or history. If you want
|
31
|
+
to have your own version, or is otherwise necessary, that is fine, but
|
32
|
+
please isolate to its own commit so I can cherry-pick around it.
|
33
|
+
|
34
|
+
## Copyright
|
35
|
+
|
36
|
+
Copyright (c) 2018 Jon Sangster. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'rake'
|
14
|
+
require 'jeweler'
|
15
|
+
require './lib/extractexifgps.rb'
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
gem.name = 'extractexifgps'
|
19
|
+
gem.homepage = 'http://github.com/sangster/extractexifgps'
|
20
|
+
gem.license = 'MIT'
|
21
|
+
gem.summary = %Q{Extracts EXIF GPS data from images}
|
22
|
+
gem.description = %Q{Extracts EXIF GPS data from images}
|
23
|
+
gem.email = 'jon@ertt.ca'
|
24
|
+
gem.authors = ['Jon Sangster']
|
25
|
+
gem.version = ExtractExifGps::Version::STRING
|
26
|
+
gem.executables = %W{extractexifgps}
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
Rake::TestTask.new(:test) do |test|
|
32
|
+
test.libs << 'lib' << 'test'
|
33
|
+
test.pattern = 'test/**/*_test.rb'
|
34
|
+
test.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Code coverage detail'
|
38
|
+
task :simplecov do
|
39
|
+
ENV['COVERAGE'] = "true"
|
40
|
+
Rake::Task['test'].execute
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "extractexifgps #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/bin/extractexifgps
ADDED
data/lib/coords.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
module ExtractExifGps
|
2
|
+
class Coords
|
3
|
+
GPS_ICONS = %w{° ' "}.freeze
|
4
|
+
MAX_DECIMALS = 5
|
5
|
+
|
6
|
+
class << self
|
7
|
+
# @param [Exif::Data] data
|
8
|
+
# @return [Hash<Symbol, Coords>, nil] the pair of GPS coordinates from in
|
9
|
+
# the given EXIF data, or +nil+ if there is none
|
10
|
+
def from_exif(data)
|
11
|
+
if (gps = data&.[](:gps))&.any?
|
12
|
+
{lat: extract(gps, :latitude), lon: extract(gps, :longitude)}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def extract(gps, dir)
|
19
|
+
new(gps[:"gps_#{dir}_ref"], gps[:"gps_#{dir}"])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(dir, coords)
|
24
|
+
@dir = dir
|
25
|
+
@coords = coords
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_s
|
29
|
+
parts = @coords.reject(&:zero?).map(&method(:rational_str)).zip(GPS_ICONS)
|
30
|
+
"#{@dir} #{parts.map(&:join).join(' ')}"
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def rational_str(rat)
|
36
|
+
format("%.#{MAX_DECIMALS}f", rat).gsub(/\.?0*$/, '')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'csv'
|
2
|
+
require 'exif'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
require_relative 'coords'
|
6
|
+
|
7
|
+
module ExtractExifGps
|
8
|
+
class DirectoryFilesExtractor
|
9
|
+
CSV_COLUMNS = ['Path', 'Latitude', 'Longitude'].freeze
|
10
|
+
|
11
|
+
def initialize(dir_path)
|
12
|
+
@dir_path = dir_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_csv
|
16
|
+
CSV.generate do |csv|
|
17
|
+
csv << CSV_COLUMNS
|
18
|
+
|
19
|
+
gps_list.each do |item|
|
20
|
+
csv << [ item[:path],
|
21
|
+
item[:gps]&.[](:lat)&.to_s,
|
22
|
+
item[:gps]&.[](:lon)&.to_s
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def gps_list
|
31
|
+
exif_list.map do |item|
|
32
|
+
{ path: item[:path], gps: Coords.from_exif(item[:exif]) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def exif_list
|
37
|
+
files.map { |file| { path: file, exif: exif(file) } }
|
38
|
+
end
|
39
|
+
|
40
|
+
def files
|
41
|
+
Pathname.new(@dir_path).glob('*').select(&:file?)
|
42
|
+
end
|
43
|
+
|
44
|
+
def exif(path)
|
45
|
+
Exif::Data.new(path.binread)
|
46
|
+
rescue Exif::Error
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/test/coords_test.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestCoords < UnitTest
|
4
|
+
def test_from_exif__missing
|
5
|
+
assert_nil ExtractExifGps::Coords.from_exif(nil)
|
6
|
+
assert_nil ExtractExifGps::Coords.from_exif({})
|
7
|
+
assert_nil ExtractExifGps::Coords.from_exif(gps: {})
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_from_exif__present
|
11
|
+
assert_equal({lat: %{N 38°}, lon: %{W 122°} },
|
12
|
+
from_exif(gps:
|
13
|
+
{gps_latitude_ref: "N", gps_latitude: [(38/1), (0/1), (0/1)],
|
14
|
+
gps_longitude_ref: "W", gps_longitude: [(122/1), (0/1), (0/1)]}
|
15
|
+
)
|
16
|
+
)
|
17
|
+
|
18
|
+
assert_equal({lat: %{N 38° 24'}, lon: %{W 122° 49'} },
|
19
|
+
from_exif(gps:
|
20
|
+
{gps_latitude_ref: "N", gps_latitude: [(38/1), (24/1), (0/1)],
|
21
|
+
gps_longitude_ref: "W", gps_longitude: [(122/1), (1243/25), (0/1)]}
|
22
|
+
)
|
23
|
+
)
|
24
|
+
|
25
|
+
assert_equal({lat: %{N 38° 24' 10"}, lon: %{W 122° 49' 20"} },
|
26
|
+
from_exif(gps:
|
27
|
+
{gps_latitude_ref: "N", gps_latitude: [(38/1), (24/1), (0/1), (10/1)],
|
28
|
+
gps_longitude_ref: "W", gps_longitude: [(122/1), (1243/25), (0/1), (20/1)]}
|
29
|
+
)
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_to_s__integers
|
34
|
+
assert_equal %{N 1°}, coords('N', 1).to_s
|
35
|
+
assert_equal %{N 1° 2'}, coords('N', 1, 2).to_s
|
36
|
+
assert_equal %{N 1° 2' 3"}, coords('N', 1, 2, 3).to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_to_s__floats_short
|
40
|
+
assert_equal %{N 0.5°}, coords('N', 1/2r).to_s
|
41
|
+
assert_equal %{N 0.5° 0.25'}, coords('N', 1/2r, 2/8r).to_s
|
42
|
+
assert_equal %{N 0.5° 0.25' 0.1875"}, coords('N', 1/2r, 2/8r, 3/16r).to_s
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_to_s__floats_long
|
46
|
+
assert_equal %{N 0.33333°}, coords('N', 1/3r).to_s
|
47
|
+
assert_equal %{N 0.33333° 0.16667'}, coords('N', 1/3r, 1/6r).to_s
|
48
|
+
assert_equal %{N 0.33333° 0.16667' 0.08333"}, coords('N', 1/3r, 1/6r, 1/12r).to_s
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def from_exif(data)
|
54
|
+
coords = ExtractExifGps::Coords.from_exif(data)
|
55
|
+
{lat: coords[:lat].to_s, lon: coords[:lon].to_s}
|
56
|
+
end
|
57
|
+
|
58
|
+
def coords(dir, *coords)
|
59
|
+
ExtractExifGps::Coords.new(dir, coords)
|
60
|
+
end
|
61
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
module SimpleCov::Configuration
|
7
|
+
def clean_filters
|
8
|
+
@filters = []
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
SimpleCov.configure do
|
13
|
+
clean_filters
|
14
|
+
load_adapter 'test_frameworks'
|
15
|
+
end
|
16
|
+
|
17
|
+
ENV["COVERAGE"] && SimpleCov.start
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
require 'bundler'
|
21
|
+
require 'byebug'
|
22
|
+
begin
|
23
|
+
Bundler.setup(:default, :development)
|
24
|
+
rescue Bundler::BundlerError => e
|
25
|
+
$stderr.puts e.message
|
26
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
27
|
+
exit e.status_code
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'extractexifgps'
|
31
|
+
|
32
|
+
require 'minitest/autorun'
|
33
|
+
require 'minitest/reporters'
|
34
|
+
Minitest::Reporters.use!
|
35
|
+
|
36
|
+
class UnitTest < Minitest::Test
|
37
|
+
end
|
38
|
+
|
39
|
+
class IntegrationTest < Minitest::Test
|
40
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
class DirectoryFilesExtractorTest < IntegrationTest
|
5
|
+
def test_to_csv
|
6
|
+
expected = <<-CSV.gsub(/^\s+/, '')
|
7
|
+
Path,Latitude,Longitude
|
8
|
+
images/image_c.jpg,N 38° 24',W 122° 49.72'
|
9
|
+
images/image_a.jpg,N 50° 5.48',W 122° 56.74'
|
10
|
+
images/image_b.jpg,,
|
11
|
+
images/image_d.jpg,,
|
12
|
+
CSV
|
13
|
+
|
14
|
+
Dir.chdir(Pathname.new(__FILE__).join('../..')) do
|
15
|
+
assert_equal expected,
|
16
|
+
ExtractExifGps::DirectoryFilesExtractor.new('images').to_csv
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_to_csv__cats
|
21
|
+
expected = <<-CSV.gsub(/^\s+/, '')
|
22
|
+
Path,Latitude,Longitude
|
23
|
+
images/cats/image_e.jpg,"N 59° 55' 29.11829""","E 10° 41' 44.15323"""
|
24
|
+
CSV
|
25
|
+
|
26
|
+
Dir.chdir(Pathname.new(__FILE__).join('../..')) do
|
27
|
+
assert_equal expected,
|
28
|
+
ExtractExifGps::DirectoryFilesExtractor.new('images/cats').to_csv
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,237 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: extractexifgps
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jon Sangster
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: exif
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jeweler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.3.9
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.3.9
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '8.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '8.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.7'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rdoc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.12'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest-reporters
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.1'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.11'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.11'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.14'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.14'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard-minitest
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.4'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.48'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.48'
|
181
|
+
description: Extracts EXIF GPS data from images
|
182
|
+
email: jon@ertt.ca
|
183
|
+
executables:
|
184
|
+
- extractexifgps
|
185
|
+
extensions: []
|
186
|
+
extra_rdoc_files:
|
187
|
+
- LICENSE.txt
|
188
|
+
- README.md
|
189
|
+
files:
|
190
|
+
- ".document"
|
191
|
+
- ".ruby_version"
|
192
|
+
- Gemfile
|
193
|
+
- Gemfile.lock
|
194
|
+
- Guardfile
|
195
|
+
- LICENSE.txt
|
196
|
+
- README.md
|
197
|
+
- Rakefile
|
198
|
+
- bin/extractexifgps
|
199
|
+
- lib/coords.rb
|
200
|
+
- lib/directory_files_extractor.rb
|
201
|
+
- lib/extractexifgps.rb
|
202
|
+
- test/coords_test.rb
|
203
|
+
- test/extractexifgps_test.rb
|
204
|
+
- test/helper.rb
|
205
|
+
- test/images/.DS_Store
|
206
|
+
- test/images/cats/.DS_Store
|
207
|
+
- test/images/cats/image_e.jpg
|
208
|
+
- test/images/image_a.jpg
|
209
|
+
- test/images/image_b.jpg
|
210
|
+
- test/images/image_c.jpg
|
211
|
+
- test/images/image_d.jpg
|
212
|
+
- test/integration/directory_files_extractor_test.rb
|
213
|
+
homepage: http://github.com/sangster/extractexifgps
|
214
|
+
licenses:
|
215
|
+
- MIT
|
216
|
+
metadata: {}
|
217
|
+
post_install_message:
|
218
|
+
rdoc_options: []
|
219
|
+
require_paths:
|
220
|
+
- lib
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - ">="
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">"
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: 1.3.1
|
231
|
+
requirements: []
|
232
|
+
rubyforge_project:
|
233
|
+
rubygems_version: 2.7.6
|
234
|
+
signing_key:
|
235
|
+
specification_version: 4
|
236
|
+
summary: Extracts EXIF GPS data from images
|
237
|
+
test_files: []
|