berkeley_library-av-core 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +33 -0
- data/.idea/av_core.iml +1 -1
- data/CHANGES.md +4 -0
- data/lib/berkeley_library/av/config.rb +1 -0
- data/lib/berkeley_library/av/constants.rb +4 -0
- data/lib/berkeley_library/av/core/module_info.rb +1 -1
- data/lib/berkeley_library/av/metadata/fields.rb +5 -1
- data/lib/berkeley_library/av/record.rb +1 -0
- data/rakelib/spec.rake +1 -1
- data/spec/data/record-audio-multiple-856s.xml +55 -0
- data/spec/lib/berkeley_library/av/metadata/field_spec.rb +21 -0
- data/spec/lib/berkeley_library/av/metadata/fields_spec.rb +2 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79eeca0ec147ccba75f22e0589b58821fea176bf4aac9759cf18932fdad1deec
|
4
|
+
data.tar.gz: 48b3c4299e46475cf14b1d764eb84198d98e0571af648008ec3b46775bab478d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd767008eaf6d51c5a4e1ce94feeaa5951332c07eba79ce13101a4b79ecfa885c978f2d258946b6a5cb3ac66637ff1a7679aa18f0a44d4e42027f8f016fa87c3
|
7
|
+
data.tar.gz: f35e8b193c25d40ce110d7031875ac254c7521c4618c11c689ca853a92445be233c66da21ae7b3f895fe2db28290227cb23fd6cf6f48d3aabf8ea124b37e689d
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Build and push Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
|
18
|
+
- name: Set up Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: '3.2'
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- name: Publish to RubyGems
|
25
|
+
run: |
|
26
|
+
mkdir -p $HOME/.gem
|
27
|
+
touch $HOME/.gem/credentials
|
28
|
+
chmod 0600 $HOME/.gem/credentials
|
29
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
30
|
+
gem build *.gemspec
|
31
|
+
gem push *.gem
|
32
|
+
env:
|
33
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.idea/av_core.iml
CHANGED
@@ -113,7 +113,7 @@
|
|
113
113
|
</RakeTaskImpl>
|
114
114
|
<RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
|
115
115
|
<RakeTaskImpl description="Run tests, check test coverage, check code style, check for vulnerabilities, build gem" fullCommand="default" id="default" />
|
116
|
-
<RakeTaskImpl description="Build av_core.gemspec as
|
116
|
+
<RakeTaskImpl description="Build av_core.gemspec as berkeley_library-av-core-0.4.1.gem" fullCommand="gem" id="gem" />
|
117
117
|
<RakeTaskImpl description="Run RuboCop with auto-correct, and output results to console" fullCommand="ra" id="ra" />
|
118
118
|
<RakeTaskImpl description="Run rubocop with HTML output" fullCommand="rubocop" id="rubocop" />
|
119
119
|
<RakeTaskImpl id="rubocop">
|
data/CHANGES.md
CHANGED
@@ -5,6 +5,10 @@ module BerkeleyLibrary
|
|
5
5
|
TAG_LINK_FIELD = '856'.freeze
|
6
6
|
TAG_TRACK_FIELD = '998'.freeze
|
7
7
|
TAG_TIND_ID = '001'.freeze
|
8
|
+
TAG_TRANSCRIPT_FIELD = '856'.freeze
|
9
|
+
|
10
|
+
SUBFIELD_CODE_URI = :u
|
11
|
+
SUBFIELD_CODE_LINKTEXT = :y
|
8
12
|
|
9
13
|
# TODO: use marc/spec
|
10
14
|
TAG_TIND_CATALOG_ID = '901'.freeze
|
@@ -8,7 +8,7 @@ module BerkeleyLibrary
|
|
8
8
|
SUMMARY = 'UC Berkeley Library audio/video core code'.freeze
|
9
9
|
DESCRIPTION = 'Gem for UC Berkeley Library shared audio/video code'.freeze
|
10
10
|
LICENSE = 'MIT'.freeze
|
11
|
-
VERSION = '0.4.
|
11
|
+
VERSION = '0.4.2'.freeze
|
12
12
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/av-core'.freeze
|
13
13
|
|
14
14
|
private_class_method :new
|
@@ -12,7 +12,10 @@ module BerkeleyLibrary
|
|
12
12
|
CREATOR_PERSONAL = Field.new(order: 2, label: 'Creator', spec: '700')
|
13
13
|
CREATOR_CORPORATE = Field.new(order: 2, label: 'Creator', spec: '710')
|
14
14
|
TRACKS = Field.new(order: 99, label: 'Tracks', spec: TAG_TRACK_FIELD, subfield_order: %w[g t a])
|
15
|
-
CATALOG_LINK = Field.new(order:
|
15
|
+
CATALOG_LINK = Field.new(order: 998, label: 'Linked Resources', spec: "#{TAG_LINK_FIELD}{^1=\\4}{^2=\\1}")
|
16
|
+
# rubocop:disable Layout/LineLength
|
17
|
+
TRANSCRIPTS = Field.new(order: 999, label: 'Transcripts', spec: "#{TAG_TRANSCRIPT_FIELD}{$y~\\Transcript}{^1=\\4}{^2=\\2}", subfield_order: %w[u y])
|
18
|
+
# rubocop:enable Layout/LineLength
|
16
19
|
|
17
20
|
STANDARD_FIELDS = [
|
18
21
|
TITLE,
|
@@ -20,6 +23,7 @@ module BerkeleyLibrary
|
|
20
23
|
CREATOR_PERSONAL,
|
21
24
|
CREATOR_CORPORATE,
|
22
25
|
TRACKS,
|
26
|
+
TRANSCRIPTS,
|
23
27
|
CATALOG_LINK
|
24
28
|
].freeze
|
25
29
|
|
data/rakelib/spec.rake
CHANGED
@@ -3,7 +3,7 @@ require 'rspec/core/rake_task'
|
|
3
3
|
namespace :spec do
|
4
4
|
desc 'Run all tests'
|
5
5
|
RSpec::Core::RakeTask.new(:all) do |task|
|
6
|
-
task.rspec_opts = %w[--color --format documentation
|
6
|
+
task.rspec_opts = %w[--color --format documentation]
|
7
7
|
task.pattern = 'spec/**/*_spec.rb'
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
3
|
+
<collection xmlns="http://www.loc.gov/MARC21/slim">
|
4
|
+
<record>
|
5
|
+
<controlfield tag="001">207666</controlfield>
|
6
|
+
<controlfield tag="005">20231106135319.0</controlfield>
|
7
|
+
<datafield tag="035" ind1=" " ind2=" ">
|
8
|
+
<subfield code="a">drilmav-00004</subfield>
|
9
|
+
</datafield>
|
10
|
+
<datafield tag="245" ind1=" " ind2=" ">
|
11
|
+
<subfield code="a">On changes regarding discrimination against people with disabilities</subfield>
|
12
|
+
</datafield>
|
13
|
+
<datafield tag="336" ind1=" " ind2=" ">
|
14
|
+
<subfield code="a">Audio</subfield>
|
15
|
+
</datafield>
|
16
|
+
<datafield tag="540" ind1=" " ind2=" ">
|
17
|
+
<subfield code="a">Researchers may make free and open use of the UC Berkeley Library’s digitized public domain materials. However, some materials in our online collections may be protected by U.S. copyright law (Title 17, U.S.C.). Use or reproduction of materials protected by copyright beyond that allowed by fair use (Title 17, U.S.C. § 107) requires permission from the copyright owners. The use or reproduction of some materials may also be restricted by terms of University of California gift or purchase agreements, privacy and publicity rights, or trademark law. Responsibility for determining rights status and permissibility of any use or reproduction rests exclusively with the researcher. To learn more or make inquiries, please see our permissions policies (https://www.lib.berkeley.edu/about/permissions-policies).
|
18
|
+
</subfield>
|
19
|
+
</datafield>
|
20
|
+
<datafield tag="700" ind1="1" ind2=" ">
|
21
|
+
<subfield code="a">Billings, Carol Fewell</subfield>
|
22
|
+
</datafield>
|
23
|
+
<datafield tag="852" ind1=" " ind2=" ">
|
24
|
+
<subfield code="c">The Bancroft Library</subfield>
|
25
|
+
</datafield>
|
26
|
+
<datafield tag="856" ind1="4" ind2="2">
|
27
|
+
<subfield code="u">https://avplayer.lib.berkeley.edu/ROHOAudio/drilmav-00004</subfield>
|
28
|
+
<subfield code="y">Play Audio</subfield>
|
29
|
+
</datafield>
|
30
|
+
<datafield tag="856" ind1="4" ind2="2">
|
31
|
+
<subfield code="u">https://digitalassets.lib.berkeley.edu/audio/transcript/Carol_Fewell_Billings_Transcript.pdf</subfield>
|
32
|
+
<subfield code="y">Transcript of audio file</subfield>
|
33
|
+
</datafield>
|
34
|
+
<datafield tag="902" ind1=" " ind2=" ">
|
35
|
+
<subfield code="d">2/3/21</subfield>
|
36
|
+
<subfield code="n">SMS</subfield>
|
37
|
+
</datafield>
|
38
|
+
<datafield tag="909" ind1="C" ind2="O">
|
39
|
+
<subfield code="o">oai:digicoll.lib.berkeley.edu:207666</subfield>
|
40
|
+
<subfield code="q">mcleanCalisphere_oai</subfield>
|
41
|
+
</datafield>
|
42
|
+
<datafield tag="980" ind1=" " ind2=" ">
|
43
|
+
<subfield code="a">DRILM: AV</subfield>
|
44
|
+
</datafield>
|
45
|
+
<datafield tag="982" ind1=" " ind2=" ">
|
46
|
+
<subfield code="b">Disability Rights and Independent Living Movement</subfield>
|
47
|
+
</datafield>
|
48
|
+
<datafield tag="982" ind1=" " ind2=" ">
|
49
|
+
<subfield code="a">Disability Rights Movement</subfield>
|
50
|
+
</datafield>
|
51
|
+
<datafield tag="998" ind1=" " ind2=" ">
|
52
|
+
<subfield code="g">billings1.mp3</subfield>
|
53
|
+
</datafield>
|
54
|
+
</record>
|
55
|
+
</collection>
|
@@ -66,6 +66,27 @@ module BerkeleyLibrary
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
context 'transcripts' do
|
70
|
+
it 'extracts transcripts from TIND records' do
|
71
|
+
marc_record = MARC::XMLReader.new('spec/data/record-audio-multiple-856s.xml').first
|
72
|
+
field = Field.new(order: 999, label: 'Transcripts', spec: "#{TAG_TRANSCRIPT_FIELD}{$y~\\Transcript}{^1=\\4}{^2=\\2}", subfield_order: %w[u y])
|
73
|
+
value = field.value_from(marc_record)
|
74
|
+
expect(value).to be_a(Value)
|
75
|
+
expected_transcript = AV::Metadata::Link.new(
|
76
|
+
url: 'https://digitalassets.lib.berkeley.edu/audio/transcript/Carol_Fewell_Billings_Transcript.pdf',
|
77
|
+
body: 'Transcript of audio file'
|
78
|
+
)
|
79
|
+
expect(value.entries).to contain_exactly(expected_transcript)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'doesn\'t break when there are no transcripts' do
|
83
|
+
marc_record = MARC::XMLReader.new('spec/data/record-(pacradio)01469.xml').first
|
84
|
+
field = Field.new(order: 999, label: 'Transcripts', spec: "#{TAG_TRANSCRIPT_FIELD}{$y~\\Transcript}{^1=\\4}{^2=\\2}", subfield_order: %w[u y])
|
85
|
+
value = field.value_from(marc_record)
|
86
|
+
expect(value).to be_nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
69
90
|
describe :hash do
|
70
91
|
it 'returns the same hash for identical Fields' do
|
71
92
|
f1 = Field.new(order: 2, label: 'Description', spec: '520$a')
|
@@ -75,7 +75,8 @@ module BerkeleyLibrary
|
|
75
75
|
Field.new(order: 86, spec: '991$a', label: 'Access', subfields_separator: ', '),
|
76
76
|
Field.new(order: 89, spec: '982$a', label: 'Collection'),
|
77
77
|
Field.new(order: 99, spec: '998', label: 'Tracks', subfield_order: %w[g t a]),
|
78
|
-
Field.new(order:
|
78
|
+
Field.new(order: 998, spec: '856{^1=\4}{^2=\1}', label: 'Linked Resources'),
|
79
|
+
Field.new(order: 999, spec: '856{$y~\Transcript}{^1=\4}{^2=\2}', label: 'Transcripts', subfield_order: %w[u y])
|
79
80
|
]
|
80
81
|
|
81
82
|
fields = Fields.default_fields
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkeley_library-av-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: berkeley_library-logging
|
@@ -322,6 +322,7 @@ extra_rdoc_files: []
|
|
322
322
|
files:
|
323
323
|
- ".dockerignore"
|
324
324
|
- ".github/workflows/build.yml"
|
325
|
+
- ".github/workflows/gem-push.yml"
|
325
326
|
- ".gitignore"
|
326
327
|
- ".idea/av_core.iml"
|
327
328
|
- ".idea/codeStyles/Project.xml"
|
@@ -395,6 +396,7 @@ files:
|
|
395
396
|
- spec/data/record-(miscmat)00615.xml
|
396
397
|
- spec/data/record-(pacradio)00107.xml
|
397
398
|
- spec/data/record-(pacradio)01469.xml
|
399
|
+
- spec/data/record-audio-multiple-856s.xml
|
398
400
|
- spec/data/record-empty-result.xml
|
399
401
|
- spec/data/record-multiple-998s-disordered.xml
|
400
402
|
- spec/data/record-multiple-998s.xml
|
@@ -426,7 +428,7 @@ licenses:
|
|
426
428
|
- MIT
|
427
429
|
metadata:
|
428
430
|
rubygems_mfa_required: 'true'
|
429
|
-
post_install_message:
|
431
|
+
post_install_message:
|
430
432
|
rdoc_options: []
|
431
433
|
require_paths:
|
432
434
|
- lib
|
@@ -441,8 +443,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
441
443
|
- !ruby/object:Gem::Version
|
442
444
|
version: '0'
|
443
445
|
requirements: []
|
444
|
-
rubygems_version: 3.
|
445
|
-
signing_key:
|
446
|
+
rubygems_version: 3.4.19
|
447
|
+
signing_key:
|
446
448
|
specification_version: 4
|
447
449
|
summary: UC Berkeley Library audio/video core code
|
448
450
|
test_files:
|
@@ -470,6 +472,7 @@ test_files:
|
|
470
472
|
- spec/data/record-(miscmat)00615.xml
|
471
473
|
- spec/data/record-(pacradio)00107.xml
|
472
474
|
- spec/data/record-(pacradio)01469.xml
|
475
|
+
- spec/data/record-audio-multiple-856s.xml
|
473
476
|
- spec/data/record-empty-result.xml
|
474
477
|
- spec/data/record-multiple-998s-disordered.xml
|
475
478
|
- spec/data/record-multiple-998s.xml
|