Class: Filmrolls::Negative

Inherits:
Object
  • Object
show all
Defined in:
lib/filmrolls/negative.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Negative

Returns a new instance of Negative.



5
6
7
# File 'lib/filmrolls/negative.rb', line 5

def initialize(path)
  @file = Exiftool.new(path, :coord_format => "%.6f degrees")
end

Instance Method Details

#aperture=(val) ⇒ Object



29
30
31
32
# File 'lib/filmrolls/negative.rb', line 29

def aperture=(val)
  @file[:ApertureValue] = val
  @file[:FNumber] = val
end

#camera=(val) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/filmrolls/negative.rb', line 73

def camera=(val)
  make = val.strip.split(/\s+/)[0]
  model = val.strip[(make.length)..-1]
  @file[:LocalizedCameraModel] = val.strip
  @file[:Make] = make.strip
  @file[:Model] = model.strip
end

#changed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/filmrolls/negative.rb', line 21

def changed?
  @file.changed?
end

#compensation=(val) ⇒ Object



45
46
47
# File 'lib/filmrolls/negative.rb', line 45

def compensation=(val)
  @file[:ExposureCompensation] = val
end

#date=(val) ⇒ Object



60
61
62
# File 'lib/filmrolls/negative.rb', line 60

def date=(val)
  @file[:DateTimeOriginal] = val
end

#film=(val) ⇒ Object



56
57
58
# File 'lib/filmrolls/negative.rb', line 56

def film=(val)
  @file[:UserComment] = val
end

#lens=(val) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/filmrolls/negative.rb', line 64

def lens=(val)
  # TODO: this is hacky as f
  make = val.strip.split(/\s+/)[0]
  model = val.strip[(make.length)..-1]
  @file[:Lens] = val.strip
  @file[:LensMake] = make.strip
  @file[:LensModel] = model.strip
end

#merge(*args) ⇒ Object



9
10
11
12
13
14
# File 'lib/filmrolls/negative.rb', line 9

def merge(*args)
  args.each do |key, value|
    method = "#{key}="
    @self.public_send(method, value) if @self.respond_to? method
  end
end

#position=(val) ⇒ Object



49
50
51
52
53
54
# File 'lib/filmrolls/negative.rb', line 49

def position=(val)
  @file[:GPSLatitude] = "#{val.lat} degrees"
  @file[:GPSLatitudeRef] = 'North'
  @file[:GPSLongitude] = "#{val.lng} degrees"
  @file[:GPSLongitudeRef] = 'East'
end

#save!Object



25
26
27
# File 'lib/filmrolls/negative.rb', line 25

def save!
  @file.save!
end

#shutter_speed=(val) ⇒ Object



40
41
42
43
# File 'lib/filmrolls/negative.rb', line 40

def shutter_speed=(val)
  @file[:ExposureTime] = val
  @file[:ShutterSpeedValue] = val.to_f
end

#speed=(val) ⇒ Object



34
35
36
37
38
# File 'lib/filmrolls/negative.rb', line 34

def speed=(val)
  @file[:ISO] = val
  @file[:ISOSpeed] = val
  @file[:SensitivityType] = 'ISO Speed'
end

#to_sObject



16
17
18
19
# File 'lib/filmrolls/negative.rb', line 16

def to_s
  require 'yaml'
  @file.to_yaml
end