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)
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

#author=(val) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/filmrolls/negative.rb', line 81

def author=(val)
  @file[:Artist] = val
  @file['By-Line'] = val
  @file[:Author] = val
  @file[:Creator] = val
  @file['By-lineTitle'] = 'Photographer'
  @file[:AttributionName] = val if @file[:License]
end

#author_url=(val) ⇒ Object



98
99
100
# File 'lib/filmrolls/negative.rb', line 98

def author_url=(val)
  @file[:AttributionURL] = 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

#copyright=(val) ⇒ Object



90
91
92
93
94
95
96
# File 'lib/filmrolls/negative.rb', line 90

def copyright=(val)
  year = @file[:datetimecreated] ? @file[:datetimecreated].year : DateTime.now.year
  notice = (val % {:year => year})
  @file[:Copyright] = notice
  @file[:CopyrightNotice] = notice
  @file[:Rights] = notice
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

#license_url=(val) ⇒ Object



102
103
104
105
# File 'lib/filmrolls/negative.rb', line 102

def license_url=(val)
  @file[:License] = val
  @file[:AttributionName] = @file[:Artist] if @file[:Artist]
end

#marked=(val) ⇒ Object



107
108
109
# File 'lib/filmrolls/negative.rb', line 107

def marked=(val)
  @file[:Marked] = val
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}="
    public_send(method, value) if 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

#usage_terms=(val) ⇒ Object



111
112
113
# File 'lib/filmrolls/negative.rb', line 111

def usage_terms=(val)
  @file[:UsageTerms] = val
end