Class: MachineTags

Inherits:
Object
  • Object
show all
Defined in:
lib/flickrup/ext/machine_tags.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, context) ⇒ MachineTags

Returns a new instance of MachineTags.



2
3
4
# File 'lib/flickrup/ext/machine_tags.rb', line 2

def initialize(config, context)
  @config = config
end

Instance Method Details

#preupload(ctx) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flickrup/ext/machine_tags.rb', line 6

def preupload(ctx)

  tags = ctx.file.tags

  remapped = tags.map do |x|
    x.sub(/^([^:]+):([^:]+)::/,"\\1:\\2=")
  end.uniq



  unless tags == remapped #write back to file
    ctx.file['Keywords'] = remapped
    ctx.file['Subject'] = remapped #also write Subject XMP tag
  end

  ctx

end