ortfodb 1.5.0 → 1.6.0
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.
- checksums.yaml +4 -4
- data/lib/ortfodb/configuration.rb +0 -3
- data/lib/ortfodb/database.rb +25 -15
- data/lib/ortfodb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfdb5e23f5915036479e7ddb21929c3612369d72491679f435387dafe64e0332
|
4
|
+
data.tar.gz: 1bd20725c89cebcba8be97922d0ec994506efaa4d77dae3a11c1915b741ec903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cdc18ef72d256b60d0485c0688d8fc6536eaa7a4722e6f909cff82c6e13fa6dd872cf266ec5f7182324f4a2f824b269fdf68ebc6887b1780bd3a912c081ce19
|
7
|
+
data.tar.gz: 7932d8d198277da4cecd808053f7b6c3405681309472a3c49ca3f1bc2fa8ab8626c67ce26faa0c9936049b8e646ea11fd793d13a65f7cc6832d868d4d8eee716
|
@@ -198,7 +198,6 @@ module Ortfodb
|
|
198
198
|
|
199
199
|
# Configuration represents what the ortfodb.yaml configuration file describes.
|
200
200
|
class Configuration < Dry::Struct
|
201
|
-
attribute :build_metadata_file, Types::String.optional
|
202
201
|
|
203
202
|
# Exporter-specific configuration. Maps exporter names to their configuration.
|
204
203
|
attribute :exporters, Types::Hash.meta(of: Types::Hash.meta(of: Types::Any)).optional
|
@@ -218,7 +217,6 @@ module Ortfodb
|
|
218
217
|
def self.from_dynamic!(d)
|
219
218
|
d = Types::Hash[d]
|
220
219
|
new(
|
221
|
-
build_metadata_file: d["build metadata file"],
|
222
220
|
exporters: Types::Hash.optional[d["exporters"]]&.map { |k, v| [k, Types::Hash[v].map { |k, v| [k, Types::Any[v]] }.to_h] }&.to_h,
|
223
221
|
extract_colors: d["extract colors"] ? ExtractColorsConfiguration.from_dynamic!(d["extract colors"]) : nil,
|
224
222
|
make_gifs: d["make gifs"] ? MakeGIFSConfiguration.from_dynamic!(d["make gifs"]) : nil,
|
@@ -237,7 +235,6 @@ module Ortfodb
|
|
237
235
|
|
238
236
|
def to_dynamic
|
239
237
|
{
|
240
|
-
"build metadata file" => build_metadata_file,
|
241
238
|
"exporters" => exporters,
|
242
239
|
"extract colors" => extract_colors&.to_dynamic,
|
243
240
|
"make gifs" => make_gifs&.to_dynamic,
|
data/lib/ortfodb/database.rb
CHANGED
@@ -184,6 +184,11 @@ module Ortfodb
|
|
184
184
|
# in seconds
|
185
185
|
attribute :duration, Types::Double
|
186
186
|
|
187
|
+
# Hash of the media file, used for caching purposes. Could also serve as an integrity
|
188
|
+
# check.
|
189
|
+
# The value is the MD5 hash, base64-encoded.
|
190
|
+
attribute :content_block_hash, Types::String
|
191
|
+
|
187
192
|
attribute :has_sound, Types::Bool
|
188
193
|
attribute :id, Types::String
|
189
194
|
attribute :index, Types::Integer
|
@@ -214,6 +219,7 @@ module Ortfodb
|
|
214
219
|
dimensions: ImageDimensions.from_dynamic!(d.fetch("dimensions")),
|
215
220
|
dist_source: d.fetch("distSource"),
|
216
221
|
duration: d.fetch("duration"),
|
222
|
+
content_block_hash: d.fetch("hash"),
|
217
223
|
has_sound: d.fetch("hasSound"),
|
218
224
|
id: d.fetch("id"),
|
219
225
|
index: d.fetch("index"),
|
@@ -246,6 +252,7 @@ module Ortfodb
|
|
246
252
|
"dimensions" => dimensions.to_dynamic,
|
247
253
|
"distSource" => dist_source,
|
248
254
|
"duration" => duration,
|
255
|
+
"hash" => content_block_hash,
|
249
256
|
"hasSound" => has_sound,
|
250
257
|
"id" => id,
|
251
258
|
"index" => index,
|
@@ -267,18 +274,20 @@ module Ortfodb
|
|
267
274
|
end
|
268
275
|
|
269
276
|
class LocalizedContent < Dry::Struct
|
270
|
-
attribute :
|
271
|
-
attribute :
|
272
|
-
attribute :
|
273
|
-
attribute :
|
277
|
+
attribute :abbreviations, Types::Hash.meta(of: Types::String)
|
278
|
+
attribute :blocks, Types.Array(ContentBlock)
|
279
|
+
attribute :footnotes, Types::Hash.meta(of: Types::String)
|
280
|
+
attribute :layout, Types.Array(Types.Array(Types::String))
|
281
|
+
attribute :title, Types::String
|
274
282
|
|
275
283
|
def self.from_dynamic!(d)
|
276
284
|
d = Types::Hash[d]
|
277
285
|
new(
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
286
|
+
abbreviations: Types::Hash[d.fetch("abbreviations")].map { |k, v| [k, Types::String[v]] }.to_h,
|
287
|
+
blocks: d.fetch("blocks").map { |x| ContentBlock.from_dynamic!(x) },
|
288
|
+
footnotes: Types::Hash[d.fetch("footnotes")].map { |k, v| [k, Types::String[v]] }.to_h,
|
289
|
+
layout: d.fetch("layout"),
|
290
|
+
title: d.fetch("title"),
|
282
291
|
)
|
283
292
|
end
|
284
293
|
|
@@ -288,10 +297,11 @@ module Ortfodb
|
|
288
297
|
|
289
298
|
def to_dynamic
|
290
299
|
{
|
291
|
-
"
|
292
|
-
"
|
293
|
-
"
|
294
|
-
"
|
300
|
+
"abbreviations" => abbreviations,
|
301
|
+
"blocks" => blocks.map { |x| x.to_dynamic },
|
302
|
+
"footnotes" => footnotes,
|
303
|
+
"layout" => layout,
|
304
|
+
"title" => title,
|
295
305
|
}
|
296
306
|
end
|
297
307
|
|
@@ -388,8 +398,8 @@ module Ortfodb
|
|
388
398
|
end
|
389
399
|
end
|
390
400
|
|
391
|
-
#
|
392
|
-
class
|
401
|
+
# Work represents a given work in the database.
|
402
|
+
class Work < Dry::Struct
|
393
403
|
attribute :built_at, Types::String
|
394
404
|
attribute :content, Types::Hash.meta(of: LocalizedContent)
|
395
405
|
attribute :description_hash, Types::String
|
@@ -432,7 +442,7 @@ module Ortfodb
|
|
432
442
|
module Ortfodb
|
433
443
|
class Database
|
434
444
|
def self.from_json!(json)
|
435
|
-
Types::Hash[JSON.parse(json, quirks_mode: true)].map { |k, v| [k,
|
445
|
+
Types::Hash[JSON.parse(json, quirks_mode: true)].map { |k, v| [k, Work.from_dynamic!(v)] }.to_h
|
436
446
|
end
|
437
447
|
end
|
438
448
|
end
|
data/lib/ortfodb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ortfodb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ewen Le Bihan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|