Bugzilla – Attachment 177331 Details for
Bug 19339
Enhance streaming cataloging to include Vimeo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19339: Enhance streaming cataloging to include Vimeo
Bug-19339-Enhance-streaming-cataloging-to-include-.patch (text/plain), 8.87 KB, created by
Wainui Witika-Park
on 2025-01-30 02:22:40 UTC
(
hide
)
Description:
Bug 19339: Enhance streaming cataloging to include Vimeo
Filename:
MIME Type:
Creator:
Wainui Witika-Park
Created:
2025-01-30 02:22:40 UTC
Size:
8.87 KB
patch
obsolete
>From 9d3a8e7680151d7965b470c9c2c1f17e0dbdbbab Mon Sep 17 00:00:00 2001 >From: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz> >Date: Tue, 14 Jan 2025 05:30:51 +0000 >Subject: [PATCH] Bug 19339: Enhance streaming cataloging to include Vimeo >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Test plan: > >1. Apply patch >2. Run updatedatabase in ktd >3. Set system preferenceHTML5MediaEnabled >4. Enable system preferenceHTML5MediaVimeo >5. Go to a record and edit it >6. Go to 856u - add a vimeo url - save your changes >7. On the biblio detail page - there should be a "Play media" tab above the holdings table >8. The vimeo video should be embedded under the "Play media" tab and be playable > >Sponsored-by: MÄoriland Film Festival >--- > C4/HTML5Media.pm | 25 ++++++++++++++++++- > .../bug_19339-HTML5MediaVimeo_syspref.pl | 15 +++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/enhanced_content.pref | 6 +++++ > .../prog/en/modules/catalogue/detail.tt | 2 ++ > .../bootstrap/en/modules/opac-detail.tt | 3 +++ > 6 files changed, 51 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_19339-HTML5MediaVimeo_syspref.pl > >diff --git a/C4/HTML5Media.pm b/C4/HTML5Media.pm >index 2c5a8786500..878098bdb00 100644 >--- a/C4/HTML5Media.pm >+++ b/C4/HTML5Media.pm >@@ -49,9 +49,11 @@ sub gethtml5media { > my $HTML5MediaWidth; > my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") ); > my $HTML5MediaYouTube = C4::Context->preference("HTML5MediaYouTube"); >+ my $HTML5MediaVimeo = C4::Context->preference("HTML5MediaVimeo"); > my $marcflavour = C4::Context->preference("marcflavour"); > foreach my $HTML5Media_field (@HTML5Media_fields) { > my $is_youtube = 0; >+ my $is_vimeo = 0; > my %HTML5Media; > # protocol > if ( $HTML5Media_field->indicator(1) eq '1' ) { >@@ -113,6 +115,22 @@ sub gethtml5media { > next; # do not embed youtube videos > } > } >+ if (grep /vimeo/, $HTML5Media_field->subfield('u') ) { >+ if ($HTML5MediaVimeo == 1) { >+ my $url = $HTML5Media_field->subfield('u'); >+ next unless $url =~ m{^.*(vimeo.com/)([^#\&\?]*).*}; >+ >+ my $video_id = $2; >+#$HTML5Media{srcblock} = sprintf 'https://player.vimeo.com/video/%s?badge=0&autopause=0&player_id=0&app_id=58479', $video_id; >+ $HTML5Media{srcblock} = sprintf 'https://player.vimeo.com/video/%s', $video_id; >+ >+ $HTML5Media{is_vimeo} = 1; >+ $is_vimeo = 1; >+ } >+ else { >+ next; # do not embed vimeo videos >+ } >+ } > } > elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) { > $HTML5Media{host} = $HTML5Media_field->subfield('a'); >@@ -141,7 +159,7 @@ sub gethtml5media { > else { > $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0]; > } >- if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) ) { >+ if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) && ( $is_vimeo != 1 ) ) { > next; # not a specified media file > } > # youtube >@@ -149,6 +167,11 @@ sub gethtml5media { > $HTML5Media{mime} = 'video/webm'; > $HTML5Media{type} = 'video'; > } >+ # vimeo >+ if ($is_vimeo == 1) { >+ $HTML5Media{mime} = 'video/webm'; >+ $HTML5Media{type} = 'video'; >+ } > # mime > if ( $HTML5Media_field->subfield('c') ) { > $HTML5Media{codecs} = $HTML5Media_field->subfield('c'); >diff --git a/installer/data/mysql/atomicupdate/bug_19339-HTML5MediaVimeo_syspref.pl b/installer/data/mysql/atomicupdate/bug_19339-HTML5MediaVimeo_syspref.pl >new file mode 100755 >index 00000000000..f67694a7050 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_19339-HTML5MediaVimeo_syspref.pl >@@ -0,0 +1,15 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "19339", >+ description => "Enhance streaming cataloging to include Vimeo", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('HTML5MediaVimeo',0,'Embed|Don\'t embed','Vimeo links as videos','YesNo')}); >+ >+ say_success( $out, "Added new system preference 'HTML5MediaVimeo'" ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 336f05bd294..4de65bc7f73 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -316,6 +316,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'), > ('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','','Media file extensions','free'), > ('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'), >+('HTML5MediaVimeo',0,'Embed|Don\'t embed','Vimeo links as videos','YesNo'), > ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'), > ('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'), > ('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >index 1f088136f49..41ffcf05000 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >@@ -339,6 +339,12 @@ Enhanced content: > 1: "Embed" > 0: "Don't embed" > - YouTube links as videos. >+ - >+ - pref: HTML5MediaVimeo >+ choices: >+ 1: "Embed" >+ 0: "Don't embed" >+ - Vimeo links as videos. > OverDrive: > - > - pref: OPACOverDrive >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 00c00d00861..fa39de9921f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -832,6 +832,8 @@ > <p> > [% IF HTML5MediaSet.is_youtube %] > <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe> >+ [% ELSIF HTML5MediaSet.is_vimeo %] >+ <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe> > [% ELSE %] > <[% HTML5MediaParent | html %] controls preload=none> > <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index b77a00417cd..0b696693cf9 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -924,6 +924,9 @@ > [% IF HTML5MediaSet.is_youtube %] > <iframe id="player" type="text/html" width="640" height="360" > src="[% HTML5MediaSet.srcblock | url %]" frameborder="0"></iframe> >+ [% ELSIF HTML5MediaSet.is_vimeo %] >+ <iframe id="player" type="text/html" width="640" height="360" >+ src="[% HTML5MediaSet.srcblock | url %]" frameborder="0"></iframe> > [% ELSE %] > [% SET ctrl_preload = ' controls preload=none' #translatability %] > <[% HTML5MediaParent _ ctrl_preload | html %] > >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19339
:
67210
|
176484
|
176487
|
176488
|
177094
|
177330
| 177331