Class: Geotagger::ExifEditor
- Inherits:
-
Object
- Object
- Geotagger::ExifEditor
- Defined in:
- lib/geotagger/exif_editor.rb
Instance Attribute Summary collapse
-
#global_time_offset ⇒ Object
Returns the value of attribute global_time_offset.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
- #fix_times ⇒ Object
- #get_photo_time(path) ⇒ Object
-
#initialize(options = {}) ⇒ ExifEditor
constructor
A new instance of ExifEditor.
- #read_file(path, time_offset = 0) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ExifEditor
Returns a new instance of ExifEditor.
93 94 95 96 97 98 99 |
# File 'lib/geotagger/exif_editor.rb', line 93 def initialize( = {}) @options = @images = [] @image_map = {} @global_time_offset = 0 @verbose = [:verbose] end |
Instance Attribute Details
#global_time_offset ⇒ Object
Returns the value of attribute global_time_offset.
102 103 104 |
# File 'lib/geotagger/exif_editor.rb', line 102 def global_time_offset @global_time_offset end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
101 102 103 |
# File 'lib/geotagger/exif_editor.rb', line 101 def images @images end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
91 92 93 |
# File 'lib/geotagger/exif_editor.rb', line 91 def @options end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
91 92 93 |
# File 'lib/geotagger/exif_editor.rb', line 91 def verbose @verbose end |
Instance Method Details
#fix_times ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/geotagger/exif_editor.rb', line 104 def fix_times start_time = [:start_time] && DateTime.parse([:start_time]) || DateTime.now puts "Start: #{start_time}" @images.each_with_index do |image,index| if image[:time].nil? = start_time + (([:time_gap] || 1000).to_i * index) / (1000.0 * 24 * 60 * 60) image[:time] = .to_time end puts "#{index}: #{image.attr.inspect}" end end |
#get_photo_time(path) ⇒ Object
124 125 126 127 |
# File 'lib/geotagger/exif_editor.rb', line 124 def get_photo_time(path) image = @image_map[path] || read_file(path) image.photo['DateTimeOriginal'] end |