Class: Sidecar
- Inherits:
-
Object
- Object
- Sidecar
- Defined in:
- lib/flickrup/ext/sidecar.rb
Instance Method Summary collapse
- #archive(ctx) ⇒ Object
-
#initialize(config, delegate, context) ⇒ Sidecar
constructor
A new instance of Sidecar.
- #write_sidecar(ctx) ⇒ Object
Constructor Details
#initialize(config, delegate, context) ⇒ Sidecar
Returns a new instance of Sidecar.
4 5 6 |
# File 'lib/flickrup/ext/sidecar.rb', line 4 def initialize(config, delegate, context) @delegate = delegate end |
Instance Method Details
#archive(ctx) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/flickrup/ext/sidecar.rb', line 8 def archive(ctx) @delegate.archive(ctx) if ctx.file.type == TaggedVideo::TYPE file = write_sidecar(ctx) @delegate.archive(ctx.with_properties({:filename => file})) end end |
#write_sidecar(ctx) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/flickrup/ext/sidecar.rb', line 18 def write_sidecar(ctx) #write temp file to_file = "#{Dir::tmpdir}/#{File.basename(ctx.properties[:filename])}.meta" File.open(to_file, "w") do |f| f.write({:keywords => ctx.file['keywords']}.to_yaml) end return to_file end |