exif_csv 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1954994304150c85ca6ade9a1a81c4f417f0614f882c69cfdcd213aa3f266dd5
4
+ data.tar.gz: dac301db7e6bfbafe98a53e8c85a1d5c28afa131e9da5b411b9d588bd1813fd3
5
+ SHA512:
6
+ metadata.gz: cd7a670257ce3371c00b0c480a1a0f83f7291698cfb8574e53663289f0d6e3ea9d4b389a4a0391f8dc8c845682dc7cbd78808e92d94a613a2c32de10503a2b62
7
+ data.tar.gz: 4ee53dfe86db914c1469885d94abcd79462ac69d45c708d440eabb50c6829a6ef694b6fe2a8fa84849995810d86f9fe063745e1870a3ee3bfa83fded17cdcd13
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ /.bundle/
3
+ /.yardoc
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in exif_csv.gemspec
4
+ gemspec
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ exif_csv (0.1.0)
5
+ exifr
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ exifr (1.3.6)
12
+ rake (10.5.0)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.1)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.4)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.1)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.2)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 2.0)
32
+ exif_csv!
33
+ rake (~> 10.0)
34
+ rspec
35
+
36
+ BUNDLED WITH
37
+ 2.0.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 masakazutakewaka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # ExifCsv
2
+
3
+ ExifCsv reads exif of all the jpgs in the directory and writes them in a csv file.
4
+ It only supports gps latitude and longitude at the moment.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'exif_csv'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install exif_csv
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ $ ls img
26
+ /img
27
+ ├── cats
28
+ │   └── image_e.jpg
29
+ ├── image_a.jpg
30
+ ├── image_b.jpg(doesn't have exif)
31
+ ├── image_c.jpg
32
+ └── image_d.jpg(doesn't have gps tags)
33
+
34
+ $ exif_csv img
35
+
36
+ $ cat output.csv
37
+ /img/cats/image_e.jpg,59.92475507998271,10.695598120067395
38
+ /img/image_c.jpg,38.4,-122.82866666666666
39
+ /img/image_a.jpg,50.09133333333333,-122.94566666666667
40
+ ```
41
+
42
+ ## Help
43
+
44
+ ```
45
+ Usage: exif_csv [options]
46
+ --dry-run
47
+ -h, --help
48
+ ```
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/exif_csv.
59
+
60
+ ## License
61
+
62
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "exif_csv"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH << File.expand_path('../lib', __dir__)
3
+ require 'csv'
4
+ require 'optparse'
5
+ require 'exifr/jpeg'
6
+ #require "exif_csv"
7
+
8
+ DEFAULT_PATH = Dir.pwd
9
+
10
+ options = { dry_run: false }
11
+
12
+ ARGV.options do |opt|
13
+ opt.on('', '--dry-run') { options[:dry_run] = true }
14
+ opt.on('-h', '--help') do
15
+ puts opt.help
16
+ exit 0
17
+ end
18
+ opt.parse!
19
+ end
20
+
21
+ path = ARGV.first || DEFAULT_PATH
22
+ images = Dir.glob("#{path}/**/*.jpg")
23
+
24
+ if images.empty?
25
+ warn("No image was found in #{path}")
26
+ exit 1
27
+ end
28
+
29
+ input = []
30
+
31
+ images.each do |i|
32
+ exifr = EXIFR::JPEG.new(i)
33
+ next if !exifr.exif? || exifr.gps.nil?
34
+ input << [i, exifr.gps.latitude, exifr.gps.longitude]
35
+ end
36
+
37
+ if options[:dry_run]
38
+ input.each { |i| p i.join(',') }
39
+ else
40
+ CSV.open('./output.csv', 'wb') do |csv|
41
+ input.each { |i| csv<< i }
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "exif_csv/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "exif_csv"
8
+ spec.version = ExifCsv::VERSION
9
+ spec.authors = ["masakazutakewaka"]
10
+ spec.email = ["takewakamma@gmail.com"]
11
+
12
+ spec.summary = "read exif of all the images in the directory and write them in a csv file."
13
+ spec.homepage = "https://github.com/masakazutakewaka/exif_csv"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency 'exifr'
26
+
27
+ spec.add_development_dependency "bundler", "~> 2.0"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec"
30
+ end
@@ -0,0 +1,6 @@
1
+ require "exif_csv/version"
2
+
3
+ module ExifCsv
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module ExifCsv
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exif_csv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - masakazutakewaka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: exifr
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.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'
69
+ description:
70
+ email:
71
+ - takewakamma@gmail.com
72
+ executables:
73
+ - exif_csv
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - exe/exif_csv
87
+ - exif_csv.gemspec
88
+ - lib/exif_csv.rb
89
+ - lib/exif_csv/version.rb
90
+ homepage: https://github.com/masakazutakewaka/exif_csv
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubygems_version: 3.0.3
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: read exif of all the images in the directory and write them in a csv file.
113
+ test_files: []