From 7e051969bb85632fa1a766b660cb24e034ae4157 Mon Sep 17 00:00:00 2001 From: Mirko Tietgen Date: Thu, 3 Mar 2016 07:58:55 +0100 Subject: [PATCH] Bug 14168 Follow-up: require WWW::YouTube::Download only when syspref enabled This patch fixes the problem of missing WWW::YouTube::Download breaking record detail views. Instead of a general 'use', the module is only required if the related syspref is enabled. --- C4/HTML5Media.pm | 3 ++- opac/opac-detail.pl | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/HTML5Media.pm b/C4/HTML5Media.pm index 7c2b174..b438933 100644 --- a/C4/HTML5Media.pm +++ b/C4/HTML5Media.pm @@ -23,7 +23,6 @@ use warnings; use C4::Context; use MARC::Field; use Koha::Upload; -use WWW::YouTube::Download qw(playback_url); =head1 HTML5Media @@ -101,6 +100,8 @@ sub gethtml5media { $HTML5Media{srcblock} = $HTML5Media_field->subfield('u'); if (grep /youtube/, $HTML5Media_field->subfield('u') ) { # TODO is there an official YT URL shortener? Can we use that too? if ($HTML5MediaYouTube == 1) { + require WWW::YouTube::Download; + import WWW::YouTube::Download qw(playback_url); my $youtube = WWW::YouTube::Download->new; $HTML5Media{srcblock} = $youtube->playback_url( $HTML5Media_field->subfield('u'), { diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6d71bed..6d94bc8 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -59,6 +59,10 @@ BEGIN { require C4::External::BakerTaylor; import C4::External::BakerTaylor qw(&image_url &link_url); } +# if ( C4::Context->preference("HTML5MediaYouTube" == 1) ) { +# require WWW::YouTube::Download; +# import WWW::YouTube::Download qw(playback_url); +# } } my $query = new CGI; -- 2.1.4