wax_iiif 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5447f4cbf62b6a01b55188e0367155d78d1e4a7b101fd70972fe0d3c7d712ee6
4
- data.tar.gz: 58c2e247be993f1eb00bbfda4b13c14fd42aff61b67e5a91a0a50c07fdbdfc88
3
+ metadata.gz: b13d4ff2abd3af952990aacf338ff5d9842fa9947699e5fc1844bbc09e43f625
4
+ data.tar.gz: 531615c4d2380c96916370b798cf22ed945ea53e79906bc6f757da3c6101ce64
5
5
  SHA512:
6
- metadata.gz: 7a0572e37b2f2a389308d2ce6b4b99f0fdae78ea5188a5c793b733c6a6e36011cb04f74e6ac4f95de41871bca8d4f3ef5b85462e6f37ec7ce5c2347d302ea17c
7
- data.tar.gz: da76f5a70b0f62c0cf662670cbfa483e7bc089b6e5c83bcf957c3252550a8d78831b8c6f88428e5088a98a5b9e247487be8f291a9afabbb438199fb0b8a21e63
6
+ metadata.gz: 9b1f984f67dae9f129339d2b62f9fd7dbe7382e2be43b8111e3733ac286bd6d063239bb75b59b0bb5484ea88f43c5baa3429eafc78390a593f0f3668ff913d35
7
+ data.tar.gz: 3b2350315e8945edf5bc2ae9102d806c2df2de9a60f130b818bd937a67e3aa818e325a29bea8df00bfed11289e7a68959917ce0d9c4d391be263c1dabc189d20
@@ -2,7 +2,6 @@ require_relative 'utilities'
2
2
 
3
3
  require 'pathname'
4
4
  require 'progress_bar'
5
- require 'progress_bar/core_ext/enumerable_with_progress'
6
5
 
7
6
  module WaxIiif
8
7
  # Builder class
@@ -61,35 +60,20 @@ module WaxIiif
61
60
  #
62
61
  # Take the loaded data and generate all the files.
63
62
  #
64
- # @param [Boolean] force_image_generation Generate images even if they already exist
65
- #
66
63
  # @return [Void]
67
64
  #
68
- def process_data(force_image_generation = false)
65
+ def process_data
69
66
  return nil if @data.nil? # do nothing without data.
70
67
 
71
68
  @manifests = []
72
- @data.group_by(&:manifest_id).each_with_progress do |key, value|
73
- resources = {}
69
+
70
+ data = @data.group_by(&:manifest_id)
71
+ bar = ProgressBar.new(data.length)
72
+
73
+ data.each do |key, value|
74
74
  manifest_id = key
75
75
  image_records = value
76
-
77
- # genrate the images
78
- image_records.each do |image_record|
79
- # It attempts to load the info files and skip generation - not currently working.
80
- info_file = image_info_file_name(image_record)
81
- if File.exist?(info_file) && !force_image_generation
82
- puts "skipping #{info_file}" if @config.verbose?
83
- image_record.variants = load_variants(info_file)
84
- else
85
- image_record.variants = generate_variants(image_record, @config)
86
- generate_tiles(image_record, @config)
87
- generate_image_json(image_record, @config)
88
- end
89
- # Save the image info for the manifest
90
- resources[image_record.id] ||= []
91
- resources[image_record.id].push image_record
92
- end
76
+ resources = process_image_records(image_records)
93
77
 
94
78
  # Generate the manifest
95
79
  if manifest_id.to_s.empty?
@@ -99,6 +83,9 @@ module WaxIiif
99
83
  else
100
84
  manifests.push generate_manifest(image_records, @config)
101
85
  end
86
+
87
+ bar.increment!
88
+ bar.write
102
89
  end
103
90
 
104
91
  generate_collection
@@ -251,5 +238,28 @@ module WaxIiif
251
238
  end
252
239
  obj
253
240
  end
241
+
242
+ def process_image_records(image_records)
243
+ resources = {}
244
+
245
+ # genrate the images
246
+ image_records.each do |image_record|
247
+ # It attempts to load the info files and skip generation - not currently working.
248
+ info_file = image_info_file_name(image_record)
249
+ if File.exist?(info_file)
250
+ puts "skipping #{info_file}" if @config.verbose?
251
+ image_record.variants = load_variants(info_file)
252
+ else
253
+ image_record.variants = generate_variants(image_record, @config)
254
+ generate_tiles(image_record, @config)
255
+ generate_image_json(image_record, @config)
256
+ end
257
+ # Save the image info for the manifest
258
+ resources[image_record.id] ||= []
259
+ resources[image_record.id].push image_record
260
+ end
261
+
262
+ resources
263
+ end
254
264
  end
255
265
  end
data/wax_iiif.gemspec CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'wax_iiif'
6
- spec.version = '0.1.1'
6
+ spec.version = '0.1.2'
7
7
  spec.authors = ['Marii Nyrop', 'David Newbury']
8
8
  spec.email = ['m.nyrop@columbia.edu']
9
9
  spec.summary = 'Minimal IIIF level 0 generator'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wax_iiif
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marii Nyrop
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-31 00:00:00.000000000 Z
12
+ date: 2019-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dotenv