Class: IPTC::MarkerNomenclature

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/iptc/marker_nomenclature.rb,
lib/iptc/marker_nomenclature_data.rb

Constant Summary collapse

NOMENCLATURE =
"RecordVersion Version of IIM part 2 0 0x0000  Yes  No 2 2 Iptc.Application2.RecordVersion\nObjectType  IIM appendix G object type 3 0x0003  No No  3  67 Iptc.Application2.ObjectType\nObjectAttribute IIM appendix G object attribute 4 0x0004  No Yes 4 68  Iptc.Application2.ObjectAttribute\nObjectName  Shorthand reference of content 5 0x0005  No No  0  64 Iptc.Application2.ObjectName\nEditStatus  Content status 7 0x0007  No No  0  64 Iptc.Application2.EditStatus\nEditorialUpdate Indicates the type of update  8  0x0008 No  No 2 2 Iptc.Application2.EditorialUpdate\nUrgency Editorial urgency of content  10 0x000a  No No  1  1  Iptc.Application2.Urgency\nSubject Structured definition of the subject  12 0x000c  No Yes 13  236  Iptc.Application2.Subject\nCategory  Identifies the subject 15  0x000f No  No 0 3 Iptc.Application2.Category\nSuppCategory  Refines the subject  20 0x0014  No Yes 0 32  Iptc.Application2.SuppCategory\nFixtureId Identifies content that recurs  22 0x0016  No No  0  32 Iptc.Application2.FixtureId\nKeywords  Information retrieval words  25 0x0019  No Yes 0 64  Iptc.Application2.Keywords\nLocationCode  ISO country code for content 26  0x001a No  Yes  3  3  Iptc.Application2.LocationCode\nLocationName  Full country name for content  27 0x001b  No Yes 0 64  Iptc.Application2.LocationName\nReleaseDate Earliest intended usable date 30  0x001e No  No 8 8 Iptc.Application2.ReleaseDate\nReleaseTime Earliest intended usable time 35  0x0023 No  No 11  11 Iptc.Application2.ReleaseTime\nExpirationDate  Latest intended usable date  37 0x0025  No No  8  8  Iptc.Application2.ExpirationDate\nExpirationTime  Latest intended usable time  38 0x0026  No No  11 11  Iptc.Application2.ExpirationTime\nSpecialInstructions Editorial usage instructions  40 0x0028  No No  0  256  Iptc.Application2.SpecialInstructions\nActionAdvised Action provided to previous data  42 0x002a  No No  2  2  Iptc.Application2.ActionAdvised\nReferenceService  Service Identifier of a prior envelope 45  0x002d No  Yes  0  10 Iptc.Application2.ReferenceService\nReferenceDate Date of a prior envelope  47 0x002f  No Yes 8 8 Iptc.Application2.ReferenceDate\nReferenceNumber Envelope Number of a prior envelope 50  0x0032 No  Yes  8  8  Iptc.Application2.ReferenceNumber\nDateCreated Creation date of intellectual content 55  0x0037 No  No 8 8 Iptc.Application2.DateCreated\nTimeCreated Creation time of intellectual content 60  0x003c No  No 11  11 Iptc.Application2.TimeCreated\nDigitizationDate  Creation date of digital representation  62 0x003e  No No  8  8  Iptc.Application2.DigitizationDate\nDigitizationTime  Creation time of digital representation  63 0x003f  No No  11 11  Iptc.Application2.DigitizationTime\nProgram Content creation program  65 0x0041  No No  0  32 Iptc.Application2.Program\nProgramVersion  Content creation program version 70  0x0046 No  No 0 10  Iptc.Application2.ProgramVersion\nObjectCycle Morning 75  0x004b No  No 1 1 Iptc.Application2.ObjectCycle\nByline  Name of content creator  80 0x0050  No Yes 0 32  Iptc.Application2.Byline\nBylineTitle Title of content creator  85 0x0055  No Yes 0 32  Iptc.Application2.BylineTitle\nCity  City of content origin 90  0x005a No  No 0 32  Iptc.Application2.City\nSubLocation Location within city  92 0x005c  No No  0  32 Iptc.Application2.SubLocation\nProvinceState Province/State of content origin  95 0x005f  No No  0  32 Iptc.Application2.ProvinceState\nCountryCode ISO country code of content origin  100  0x0064 No  No 3 3 Iptc.Application2.CountryCode\nCountryName Full country name of content origin 101 0x0065  No No  0  64 Iptc.Application2.CountryName\nTransmissionReference Location of original transmission 103 0x0067  No No  0  32 Iptc.Application2.TransmissionReference\nHeadline  Content synopsis 105 0x0069  No No  0  256  Iptc.Application2.Headline\nCredit  Content provider 110 0x006e  No No  0  32 Iptc.Application2.Credit\nSource  Original owner of content  115  0x0073 No  No 0 32  Iptc.Application2.Source\nCopyright Necessary copyright notice  116  0x0074 No  No 0 128 Iptc.Application2.Copyright\nContact Person or organisation to contact 118 0x0076  No Yes 0 128 Iptc.Application2.Contact\nCaption Content description 120 0x0078  No No  0  2000 Iptc.Application2.Caption\nWriter  Person responsible for caption 122 0x007a  No Yes 0 32  Iptc.Application2.Writer\nRasterizedCaption Black and white caption image 125 0x007d  No No  7360 7360  Iptc.Application2.RasterizedCaption\nImageType Color components in an image  130  0x0082 No  No 2 2 Iptc.Application2.ImageType\nImageOrientation  Indicates the layout of an image 131 0x0083  No No  1  1  Iptc.Application2.ImageOrientation\nLanguage  ISO 639:1988 language code 135 0x0087  No No  2  3  Iptc.Application2.Language\nAudioType Information about audio content 150 0x0096  No No  2  2  Iptc.Application2.AudioType\nAudioRate Sampling rate of audio content  151  0x0097 No  No 6 6 Iptc.Application2.AudioRate\nAudioResolution Sampling resolution of audio content  152  0x0098 No  No 2 2 Iptc.Application2.AudioResolution\nAudioDuration Duration of audio content 153 0x0099  No No  6  6  Iptc.Application2.AudioDuration\nAudioOutcue Final words or sounds of audio content  154  0x009a No  No 0 64  Iptc.Application2.AudioOutcue\nPreviewFormat IIM appendix A file format of preview 200 0x00c8  No No  2  2  Iptc.Application2.PreviewFormat\nPreviewVersion  File format version of preview 201 0x00c9  No No  2  2  Iptc.Application2.PreviewVersion\nPreview Binary preview data 202 0x00ca  No No  0  256000 Iptc.Application2.Preview\n"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.markers(id) ⇒ Object



10
11
12
# File 'lib/iptc/marker_nomenclature.rb', line 10

def MarkerNomenclature.markers(id)
  return MarkerNomenclature.instance.markers(id)
end

Instance Method Details

#benchmarkObject



41
42
43
44
45
46
# File 'lib/iptc/marker_nomenclature.rb', line 41

def benchmark
  require 'benchmark'
  Benchmark.bm(40) do |x|
    x.report("Populate Markers") { 1000.times do populate(); end }
  end
end

#markers(id) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/iptc/marker_nomenclature.rb', line 16

def markers(id)
  if @markers.has_key?(id)
    return @markers[id]
  else
    return @markers[-1]
  end
end

#markers_countObject



13
14
15
# File 'lib/iptc/marker_nomenclature.rb', line 13

def markers_count
  @markers.keys.length
end

#populateObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/iptc/marker_nomenclature.rb', line 24

def populate
  @markers = {}

  marker = Struct.new(:iid, :name, :description)
  
  m = marker.new
  m.name = "Unknown marker"
  m.iid = -1
  @markers[-1] = m
          
  NOMENCLATURE.each_line do |line|
      m = marker.new
      m[:name], m[:description], m[:iid] = line.split(/\t/)
      m[:iid] = m[:iid].to_i
      @markers[m.iid] = m
  end
end