From 50c173ebd6b6c495376c46bd546fca0bbdd3fb99 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Fri, 20 Sep 2024 18:19:45 -0400 Subject: [PATCH 1/6] grabbing transcript links if available --- app/views/player/_record.html.erb | 25 ++++++++++++++++++++++++- docker-compose.yml | 4 ++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index a07ebb3..bc4cb20 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -5,7 +5,22 @@

<%= record.title %>

- + <% #record.metadata.marc_record.class %> + <% transcripts = [] %> + <% eight56_fields = record.metadata.marc_record.fields(['856']) %> + <% if eight56_fields.any? %> + <% #eight56_fields.each {|f| f.to_hash } %> + <% eight56_fields.each do |f| %> + <% if f.indicator1 == '4' && f.indicator2 == '2' %> + <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> + <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> + <% transcripts << subfields['u'] %> + <% end %> + <% end %> + + <% end %> + <% end %> + <% #byebug %> <% if record.tracks.empty? %>

No track information found.

<% else %> @@ -86,6 +101,14 @@ <% end %> + <% if transcripts.any? %> + +

Transcripts

+ + <% transcripts.each do |transcript| %> + <%= link_to(File.basename(URI.parse(transcript).path), transcript) %> + <% end %> + <% end %> <% end %> diff --git a/docker-compose.yml b/docker-compose.yml index 8f5060a..9ce9812 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: app: build: . @@ -15,3 +13,5 @@ services: # Note that this mounts the *entire* repo directory (including # files ignored in .dockerignore when building the image) - ./:/opt/app + tty: true + stdin_open: true \ No newline at end of file From 262dd77d4a83bd9d4d658c9cbc0715b6807ed8c1 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 26 Sep 2024 16:50:03 -0400 Subject: [PATCH 2/6] cleanup --- app/views/player/_record.html.erb | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index bc4cb20..ebd6f20 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -5,22 +5,6 @@

<%= record.title %>

- <% #record.metadata.marc_record.class %> - <% transcripts = [] %> - <% eight56_fields = record.metadata.marc_record.fields(['856']) %> - <% if eight56_fields.any? %> - <% #eight56_fields.each {|f| f.to_hash } %> - <% eight56_fields.each do |f| %> - <% if f.indicator1 == '4' && f.indicator2 == '2' %> - <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> - <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> - <% transcripts << subfields['u'] %> - <% end %> - <% end %> - - <% end %> - <% end %> - <% #byebug %> <% if record.tracks.empty? %>

No track information found.

<% else %> @@ -101,13 +85,30 @@ <% end %> + + <% transcripts = [] %> + <% eight56_fields = record.metadata.marc_record.fields(['856']) %> + <% if eight56_fields.any? %> + <% #eight56_fields.each {|f| f.to_hash } %> + <% eight56_fields.each do |f| %> + <% if f.indicator1 == '4' && f.indicator2 == '2' %> + <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> + <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> + <% transcripts << subfields %> + <% end %> + <% end %> + + <% end %> + <% end %> <% if transcripts.any? %>

Transcripts

<% transcripts.each do |transcript| %> - <%= link_to(File.basename(URI.parse(transcript).path), transcript) %> + <%= link_to(transcript['y'], transcript['u']) %> <% end %> + + <% end %> <% end %> From 1ede78ab30c35e38cd71700d671c5940318b0023 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 10 Oct 2024 17:30:29 -0400 Subject: [PATCH 3/6] bumping version of av-core gem --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index ec1b1af..b17a743 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ ruby_version_file = File.expand_path('.ruby-version', __dir__) ruby_version_exact = File.read(ruby_version_file).strip ruby ruby_version_exact -gem 'berkeley_library-av-core', '~> 0.4.1' +gem 'berkeley_library-av-core', '~> 0.4.2' gem 'berkeley_library-docker', '~> 0.2.0' gem 'berkeley_library-logging', '~> 0.2' gem 'browser', '~> 4.2' diff --git a/Gemfile.lock b/Gemfile.lock index f988fd5..6a6444d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,7 +70,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) amazing_print (1.5.0) ast (2.4.2) - berkeley_library-av-core (0.4.1) + berkeley_library-av-core (0.4.2) berkeley_library-logging (~> 0.2) berkeley_library-marc (~> 0.2, >= 0.2.1) berkeley_library-util (~> 0.1, >= 0.1.1) @@ -357,7 +357,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - berkeley_library-av-core (~> 0.4.1) + berkeley_library-av-core (~> 0.4.2) berkeley_library-docker (~> 0.2.0) berkeley_library-logging (~> 0.2) brakeman From bdd8047418012a293c23d780b2b01429e85c8cd8 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 10 Oct 2024 17:33:24 -0400 Subject: [PATCH 4/6] removing manual transcript addition --- app/views/player/_record.html.erb | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index ebd6f20..b7221fe 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -85,31 +85,6 @@ <% end %> - - <% transcripts = [] %> - <% eight56_fields = record.metadata.marc_record.fields(['856']) %> - <% if eight56_fields.any? %> - <% #eight56_fields.each {|f| f.to_hash } %> - <% eight56_fields.each do |f| %> - <% if f.indicator1 == '4' && f.indicator2 == '2' %> - <% subfields = f.subfields.each_with_object({}) {|sf, hash| hash[sf.code] = sf.value } %> - <% if subfields['u'] && subfields['y'] && subfields['y'].downcase.include?('transcript') %> - <% transcripts << subfields %> - <% end %> - <% end %> - - <% end %> - <% end %> - <% if transcripts.any? %> - -

Transcripts

- - <% transcripts.each do |transcript| %> - <%= link_to(transcript['y'], transcript['u']) %> - <% end %> - - - <% end %> <% end %> From d20831bac680c36941ffe8c94ce573d107ab9a8e Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 10 Oct 2024 17:34:38 -0400 Subject: [PATCH 5/6] typo --- app/views/player/_record.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index b7221fe..d09d108 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -5,6 +5,7 @@

<%= record.title %>

+ <% if record.tracks.empty? %>

No track information found.

<% else %> From dfbf799dcb08df2ad8c79f4945affcda9e2c913c Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 10 Oct 2024 17:35:39 -0400 Subject: [PATCH 6/6] typo --- app/views/player/_record.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/player/_record.html.erb b/app/views/player/_record.html.erb index d09d108..a07ebb3 100644 --- a/app/views/player/_record.html.erb +++ b/app/views/player/_record.html.erb @@ -5,7 +5,7 @@

<%= record.title %>

- + <% if record.tracks.empty? %>

No track information found.

<% else %>