flickrup 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,11 +5,12 @@ class MachineTags
5
5
 
6
6
  def preupload(image, meta, config)
7
7
 
8
- tags = config[:tags].split(" ")
8
+ tags = config[:tags]
9
9
 
10
10
  remapped = tags.map do |x|
11
11
  x.sub(/^([^:]+):([^:]+)::/,"\\1:\\2=")
12
- end
12
+ end.uniq
13
+
13
14
 
14
15
 
15
16
  unless tags == remapped #write back to file
@@ -17,7 +18,7 @@ class MachineTags
17
18
  meta['Subject'] = remapped #also write Subject XMP tag
18
19
  end
19
20
 
20
- config.merge({:tags => remapped.join(" ")})
21
+ config.merge({:tags => TagSet.new(remapped)})
21
22
 
22
23
  end
23
24
  end
@@ -4,7 +4,7 @@ class PrefixedExtension
4
4
  end
5
5
 
6
6
  def values(prefix_key, config)
7
- all_tags = config[:tags].split(" ")
7
+ all_tags = config[:tags]
8
8
 
9
9
  prefix = @config[prefix_key]
10
10
 
@@ -6,7 +6,6 @@ class ReplacementTags
6
6
  def preupload(image, meta, config)
7
7
 
8
8
  replacements = @config[:tag_replacements]
9
- new_config = config
10
9
 
11
10
  if replacements != nil
12
11
  replacements.each do |tag_name, tag_value_replacements|
@@ -15,13 +14,12 @@ class ReplacementTags
15
14
  tag_value_replacements.each do |key, value|
16
15
  if existing == key
17
16
  meta[tag_name] = value
18
- new_config = new_config.merge({tag_name => value})
19
17
  break
20
18
  end
21
19
  end
22
20
  end
23
21
  end
24
22
 
25
- new_config
23
+ config
26
24
  end
27
25
  end
@@ -0,0 +1,11 @@
1
+ class TagSet < Array
2
+ def initialize(tags)
3
+ super(tags)
4
+ end
5
+
6
+ def to_s
7
+ reduce("") do |result, tag|
8
+ "#{result} \"#{tag}\""
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,7 @@
1
1
  require 'mini_exiftool'
2
2
  require 'fileutils'
3
3
  require "flickrup/logging"
4
+ require "flickrup/tag_set"
4
5
 
5
6
  class TaggedImage
6
7
  include Logging
@@ -19,11 +20,12 @@ class TaggedImage
19
20
  else
20
21
  keywords
21
22
  end
23
+ TagSet.new(keywords)
22
24
  end
23
25
 
24
26
  def doUpload(preupload_handlers, uploader)
25
27
 
26
- config = preupload_handlers.reduce({:tags => tags.join(" ")}) do |config, handler|
28
+ config = preupload_handlers.reduce({:tags => tags}) do |config, handler|
27
29
  handler.preupload(file, self, config)
28
30
  end
29
31
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickrup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Gilbert
@@ -148,6 +148,7 @@ files:
148
148
  - lib/flickrup/processor.rb
149
149
  - lib/flickrup/quick_listener.rb
150
150
  - lib/flickrup/slow_listener.rb
151
+ - lib/flickrup/tag_set.rb
151
152
  - lib/flickrup/tagged_image.rb
152
153
  - lib/flickrup/uploader.rb
153
154
  - lib/flickrup.rb