Bugzilla – Attachment 67210 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-includ.patch (text/plain), 8.50 KB, created by
leire
on 2017-09-19 13:35:51 UTC
(
hide
)
Description:
Bug 19339 - Enhance streaming cataloging to include Vimeo
Filename:
MIME Type:
Creator:
leire
Created:
2017-09-19 13:35:51 UTC
Size:
8.50 KB
patch
obsolete
>From f781230fae07221eb11f67fc9b0bc71c9c8323a7 Mon Sep 17 00:00:00 2001 >From: Leire Diez <leire@scanbit.net> >Date: Tue, 19 Sep 2017 13:07:06 +0200 >Subject: [PATCH] Bug 19339 - Enhance streaming cataloging to include Vimeo > >Create a new preference HTML5MediaVimeo, it works like HTML5MediaYoutube. >The patch uses the player javascript to show de Vimeo video. >The Vimeo video is shown only in the Opac. > >Steps to test: >1) Apply patch >2) Catalogue a Vimeo link in 856$u >3) Turn on HTML5MediaEnabled and HTML5MediaVimeo >4) Open the record in OPAC, check that the > 'Play media' tab is showing and playing the video works > >Sponsored-by: Tabakalera (Ubik) >Sponsored-by: Scanbit (http://www.scanbit.net/) >--- > C4/HTML5Media.pm | 21 +++++++++++++++++++-- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 ++++++++++ > .../modules/admin/preferences/enhanced_content.pref | 6 ++++++ > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 12 +++++++++--- > 5 files changed, 45 insertions(+), 5 deletions(-) > >diff --git a/C4/HTML5Media.pm b/C4/HTML5Media.pm >index 1ac22f1..75321b3 100644 >--- a/C4/HTML5Media.pm >+++ b/C4/HTML5Media.pm >@@ -51,6 +51,11 @@ sub gethtml5media { > my $HTML5MediaYouTube = C4::Context->preference("HTML5MediaYouTube"); > my $marcflavour = C4::Context->preference("marcflavour"); > my $isyoutube = 0; >+ my $isvimeo = 0; >+ my @vimeoVideos = (); >+ my $VimeoMedia; >+ my $MediaVimeo = C4::Context->preference("HTML5MediaVimeo"); >+ > foreach my $HTML5Media_field (@HTML5Media_fields) { > my %HTML5Media; > # protocol >@@ -116,6 +121,13 @@ sub gethtml5media { > else { > next; # do not embed youtube videos > } >+ } elsif (grep /vi\.?meo/, $HTML5Media_field->subfield('u') ) { >+ $isvimeo = 1; >+ if ($MediaVimeo == 1) { >+ # push >+ $VimeoMedia = $HTML5Media_field->subfield('u'); >+ push @vimeoVideos, $VimeoMedia; >+ } > } > } > elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) { >@@ -145,7 +157,7 @@ sub gethtml5media { > else { > $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0]; > } >- if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $isyoutube != 1) ) { >+ if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $isyoutube != 1) && ( $isvimeo != 1) ) { > next; # not a specified media file > } > # youtube >@@ -159,6 +171,9 @@ sub gethtml5media { > ### from subfield q⦠> if ( $HTML5Media_field->subfield('q') ) { > $HTML5Media{mime} = $HTML5Media_field->subfield('q'); >+ if ( $HTML5Media{mime} eq 'video' ) { >+ $HTML5Media{mime} = 'video/webm'; >+ } > } > ### â¦or from file extension and codecs⦠> elsif ( $HTML5Media{codecs} ) { >@@ -222,7 +237,7 @@ sub gethtml5media { > $HTML5Media{type} = 'track'; > } > # push >- if ( $HTML5Media{srcblock} && $HTML5Media{type} ) { >+ if ( $HTML5Media{srcblock} && $HTML5Media{type} && ( $isvimeo != 1) ) { > push (@HTML5Media_sets, \%HTML5Media); > } > } >@@ -256,6 +271,8 @@ sub gethtml5media { > HTML5MediaSets => \@HTML5Media_sets, > HTML5MediaParent => $HTML5MediaParent, > HTML5MediaWidth => $HTML5MediaWidth, >+ VimeoMediaEnabled => scalar(@vimeoVideos) > 0, >+ VimeoMediaSets => \@vimeoVideos, > ); > } > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 928d1ac..178519c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -193,6 +193,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('HouseboundModule',0,'','If ON, enable housebound module functionality.','YesNo'), > ('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'), >+('HTML5MediaVimeo',0,'Embed|Don\'t embed','Vimeo links as videos','YesNo'), > ('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'), > ('IDreamBooksReadometer','0','','Display Readometer from IDreamBooks.com','YesNo'), > ('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d5dd064..29b6ddd 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -14636,6 +14636,16 @@ if( CheckVersion( $DBversion ) ) { > print "Upgrade to $DBversion done (Bug 18811 - Visibility settings inconsistent between framework and authority editor)\n"; > } > >+$DBversion = '17.06.00.006'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaVimeo','','Vimeo links as videos','Embed|Don\'t embed','YesNo') >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 19339 - Enhance streaming cataloging to include Vimeo )\n"; >+} >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >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 f62882d..7b3c4b6 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 >@@ -345,6 +345,12 @@ Enhanced Content: > yes: "Embed" > no: "Don't embed" > - YouTube links as videos. >+ - >+ - pref: HTML5MediaVimeo >+ choices: >+ yes: "Embed" >+ no: "Don't embed" >+ - Vimeo links as videos. > Plugins: > - > - pref: UseKohaPlugins >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 9d1f2b9..77ff4f9 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -616,7 +616,7 @@ > <li id="tab_images"><a href="#images">Images</a></li> > [% END %] > >- [% IF ( HTML5MediaEnabled && HTML5MediaSets ) %] >+ [% IF ( HTML5MediaEnabled && HTML5MediaSets ) || ( VimeoMediaEnabled && VimeoMediaSets ) %] > [% IF ( defaulttab == 'media' ) %]<li id="tab_html5media" class="ui-tabs-active">[% ELSE %]<li id="tab_html5media">[% END %]<a href="#html5media">Play media</a></li> > [% END %] > >@@ -1012,7 +1012,10 @@ > </div> <!-- / #editions --> > [% END # / IF OPACFRBRizeEditions && XISBNS %] > >- [% IF ( HTML5MediaEnabled ) %] >+ [% IF ( VimeoMediaEnabled ) %] >+ <script src="[% interface %]/[% theme %]/js/player-v2.0.1.js"></script> >+ [% END # / IF VimeoMediaEnabled %] >+ [% IF ( HTML5MediaEnabled ) || ( VimeoMediaEnabled ) %] > <div id="html5media"> > [% FOREACH HTML5MediaSet IN HTML5MediaSets %] > <p> >@@ -1023,8 +1026,11 @@ > </[% HTML5MediaParent %]> > </p> > [% END %] >+ [% FOREACH VimeoMediaSet IN VimeoMediaSets %] >+ <div data-vimeo-url="[% VimeoMediaSet %]" class="vimeo_player"></div> >+ [% END %] > </div> >- [% END # / IF HTML5MediaEnabled %] >+ [% END # / IF HTML5MediaEnabled # / IF VimeoMediaEnabled %] > > [% IF ( OPACLocalCoverImages && localimages.size ) %] > <div id="images"> >-- >2.1.4
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
|
180609
|
181574