daengine 0.4.6.2 → 0.4.6.3
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.
- data/app/models/digital_asset.rb +3 -0
- data/lib/daengine.rb +1 -0
- data/lib/daengine/railtie.rb +12 -0
- data/lib/daengine/teamsite_metadata_parser.rb +20 -10
- data/lib/daengine/version.rb +1 -1
- data/lib/tasks/daengine_tasks.rake +10 -0
- metadata +3 -2
data/app/models/digital_asset.rb
CHANGED
@@ -183,6 +183,9 @@ class DigitalAsset::Document
|
|
183
183
|
field :pages, type: Integer, default: 1
|
184
184
|
field :size, type: String
|
185
185
|
field :mime_type, type: String
|
186
|
+
field :subject, type: String
|
187
|
+
field :keywords, type: Array, default: []
|
188
|
+
field :author, type: String
|
186
189
|
|
187
190
|
embedded_in :digital_asset
|
188
191
|
|
data/lib/daengine.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "daengine/version"
|
2
2
|
require 'daengine/engine'
|
3
|
+
require 'daengine/railtie' if defined?(Rails)
|
3
4
|
require File.expand_path('../../app/models/digital_asset',__FILE__)
|
4
5
|
require File.expand_path('../../app/models/taxonomy_term',__FILE__)
|
5
6
|
require File.expand_path('../../app/models/content_service_resource',__FILE__)
|
@@ -148,20 +148,30 @@ module Daengine::TeamsiteMetadataParser
|
|
148
148
|
doc['pages'] = pages
|
149
149
|
doc['size'] = exifdata.filesize
|
150
150
|
doc['mime_type'] = exifdata.mimetype
|
151
|
+
doc['keywords'] = exifdata.keywords.gsub(';', ',').gsub(':', ',').split(",") unless exifdata.keywords.nil?
|
152
|
+
if exifdata.description.is_a? Enumerable
|
153
|
+
doc['subject'] = exifdata.description.join(" ") unless exifdata.description.nil?
|
154
|
+
else
|
155
|
+
doc['subject'] = exifdata.description.gsub(':', '') unless exifdata.description.nil?
|
156
|
+
end
|
157
|
+
doc['author'] = exifdata.author
|
151
158
|
Daengine.log "Exif data for #{file} was pages:#{doc['pages']}, size:#{doc['size']}", "info"
|
152
159
|
rescue Exception => e
|
153
160
|
Daengine.log "Error reading metadata from #{file} #{e.message}", "error"
|
154
161
|
end
|
155
|
-
elsif(existing_da && !existing_da.new?)
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
elsif (existing_da && !existing_da.new?) # copy over the existing asset metadata
|
163
|
+
existing_doc = existing_da.documents.where(path: doc['path'])[0]
|
164
|
+
if (existing_doc)
|
165
|
+
doc['pages'] = existing_doc.pages
|
166
|
+
doc['size'] = existing_doc.size
|
167
|
+
doc['mime_type'] = existing_doc.mime_type
|
168
|
+
doc['keywords'] = existing_doc.keywords
|
169
|
+
doc['subject'] = existing_doc.subject
|
170
|
+
doc['author'] = existing_doc.author
|
171
|
+
else
|
172
|
+
Daengine.log "Unable to find document with path #{file} on existing asset #{existing_da.guid} title: #{existing_da.title}", "info"
|
173
|
+
end
|
174
|
+
Daengine.log "Saving existing pages #{existing_doc.pages} and size #{existing_doc.size} on #{file}", "info"
|
165
175
|
end
|
166
176
|
else
|
167
177
|
# the file was missing on disk, show a warning!
|
data/lib/daengine/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: daengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.6.
|
5
|
+
version: 0.4.6.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- sbhatia
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-07 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/daengine/content_service_processor.rb
|
103
103
|
- lib/daengine/digital_asset_processor.rb
|
104
104
|
- lib/daengine/engine.rb
|
105
|
+
- lib/daengine/railtie.rb
|
105
106
|
- lib/daengine/taxonomy_parser.rb
|
106
107
|
- lib/daengine/taxonomy_processor.rb
|
107
108
|
- lib/daengine/teamsite_metadata_parser.rb
|