Module: Exif::MakerNote

Defined in:
lib/exifparser/makernote/prove.rb

Defined Under Namespace

Classes: NotSupportedError

Class Method Summary collapse

Class Method Details

.prove(data, tag_make = nil, tag_model = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/exifparser/makernote/prove.rb', line 27

def prove(data, tag_make=nil, tag_model=nil)

  make = tag_make == nil ? '' : tag_make.to_s.upcase
  model = tag_model == nil ? '' : tag_model.to_s.upcase

  #
  # Identifier for OLYMPUS
  #
  if data[0..5] == "OLYMP\000"
    return Olympus
  #
  # Identifier for FUJIFILM
  #
  elsif data[0..7] == "FUJIFILM"
    return Fujifilm

  #
  # Identifier for Nikon
  #

  elsif make[0..4] == 'NIKON'
    if data[0..5] == "Nikon\000"
      if data[6] == 0x01 && data[7] == 0x00
        return Nikon
      end
    end
    return Nikon2

  #
  # Canon
  #
  elsif make[0..4] == 'CANON'
    return Canon

  #
  # Minolta
  #
  elsif make[0..6] == 'MINOLTA'
    return Minolta

  #
  # Sigma
  #
  elsif make[0..4] == 'SIGMA'
    return Sigma

  #
  # Sony
  #
  elsif make[0..3] == 'SONY'
    return Sony

  end

  #
  # If none above is applied, raises exception,
  # which will be caught by caller's rescue statement.
  #
  raise NotSupportedError
end