Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change "Watch from Here" to "Access from Here" #2452

Closed
caseyedavis12 opened this issue Jul 21, 2022 · 5 comments · Fixed by #2484
Closed

Change "Watch from Here" to "Access from Here" #2452

caseyedavis12 opened this issue Jul 21, 2022 · 5 comments · Fixed by #2484
Assignees

Comments

@caseyedavis12
Copy link
Contributor

User Story

As a user, when I do a search of the AAPB and the keywords appear in a transcript, I should see a link that says "Access from Here" rather than "Watch from Here" since not all content in the AAPB is TV.

Snap9 (1)

@mrharpo
Copy link
Contributor

mrharpo commented Jul 21, 2022

@caseyedavis12 It looks like the code already does this, at least a little:
From #1667 (comment)

Have the text read "Watch from here" or "Listen from here"

And in snippet_helper.rb, it renders:

<button type="button" class="btn btn-default snippet-link">#{media_type == 'Moving Image' ? "Watch" : "Listen"} from here</button>

@caseyedavis12
Copy link
Contributor Author

Hmmm... here is an example of a radio series where the button says "Watch from Here"

https://americanarchive.org/catalog?f%5Bspecial_collections%5D%5B%5D=backstory&q=aids&sort=asset_date+asc&utf8=%E2%9C%93&f[access_types][]=online

@mrharpo
Copy link
Contributor

mrharpo commented Jul 21, 2022

Very strange!

Here is that record you found:
https://americanarchive.org/catalog/cpb-aacip-532-3r0pr7nx4w

But the .pbcore says:

<instantiationMediaType>Sound</instantiationMediaType>

@mrharpo
Copy link
Contributor

mrharpo commented Jul 21, 2022

It looks like the media_type is always set to "Moving Image", and does not come from the type of media:

if transcript_file.file_type == TranscriptFile::JSON_FILE && !transcript_file.file_content.empty?
ts = TimecodeSnippet.new(this_id, terms_array, transcript_file.plaintext, JSON.parse(transcript_file.file_content)["parts"])
# fix media type
snippet_view_string = transcript_snippet(ts.snippet, "Moving Image", ts.url_at_timecode) if ts.snippet
elsif transcript_file.file_type == TranscriptFile::TEXT_FILE
ts = Snippet.new(this_id, terms_array, transcript_file.plaintext)
# fix it
snippet_view_string = transcript_snippet(ts.snippet, "Moving Image") if ts.snippet
end

@foglabs
Copy link
Contributor

foglabs commented Jul 21, 2022

@mrharpo you're right, it'll always get set to 'Moving Image' - I think this is an oversight from my last refactor 😬

if you wanted to maintain the old behavior for this, you would need to get the xml from the SolrDocument, use it to instantiate a PBCorePresenter, and then pass in your_pbcoreprsenter_instance.media_type instead of "Moving Image"

I think casey's change to 'Access' is better here, because there's actually a lot of processing and loading that happens during PBCorePresenter.new(xml), and this snippet code will potentially be run once for each record in every page of a catalog search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants