Bug 14168: (followup) 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.

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Mirko Tietgen 2016-03-03 07:58:55 +01:00 committed by Brendan A Gallagher
parent 348cfe6e0a
commit 10cbf64b24
1 changed files with 2 additions and 1 deletions

View File

@ -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'), {