View | Details | Raw Unified | Return to bug 19339
Collapse All | Expand All

(-)a/C4/HTML5Media.pm (-1 / +24 lines)
Lines 49-57 sub gethtml5media { Link Here
49
    my $HTML5MediaWidth;
49
    my $HTML5MediaWidth;
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
51
    my $HTML5MediaYouTube    = C4::Context->preference("HTML5MediaYouTube");
51
    my $HTML5MediaYouTube    = C4::Context->preference("HTML5MediaYouTube");
52
    my $HTML5MediaVimeo      = C4::Context->preference("HTML5MediaVimeo");
52
    my $marcflavour          = C4::Context->preference("marcflavour");
53
    my $marcflavour          = C4::Context->preference("marcflavour");
53
    foreach my $HTML5Media_field (@HTML5Media_fields) {
54
    foreach my $HTML5Media_field (@HTML5Media_fields) {
54
        my $is_youtube            = 0;
55
        my $is_youtube            = 0;
56
        my $is_vimeo              = 0;
55
        my %HTML5Media;
57
        my %HTML5Media;
56
        # protocol
58
        # protocol
57
        if ( $HTML5Media_field->indicator(1) eq '1' ) {
59
        if ( $HTML5Media_field->indicator(1) eq '1' ) {
Lines 113-118 sub gethtml5media { Link Here
113
                   next; # do not embed youtube videos
115
                   next; # do not embed youtube videos
114
               }
116
               }
115
            }
117
            }
118
            if (grep /vimeo/, $HTML5Media_field->subfield('u') ) {
119
                if ($HTML5MediaVimeo == 1) {
120
                    my $url = $HTML5Media_field->subfield('u');
121
                    next unless $url =~ m{^.*(vimeo.com/)([^#\&\?]*).*};
122
123
                    my $video_id = $2;
124
#$HTML5Media{srcblock} = sprintf 'https://player.vimeo.com/video/%s?badge=0&autopause=0&player_id=0&app_id=58479', $video_id;
125
                    $HTML5Media{srcblock} = sprintf 'https://player.vimeo.com/video/%s', $video_id;
126
127
                    $HTML5Media{is_vimeo} = 1;
128
                    $is_vimeo = 1;
129
                }
130
               else {
131
                   next; # do not embed vimeo videos
132
               }
133
            }
116
        }
134
        }
117
        elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) {
135
        elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) {
118
            $HTML5Media{host}        = $HTML5Media_field->subfield('a');
136
            $HTML5Media{host}        = $HTML5Media_field->subfield('a');
Lines 141-147 sub gethtml5media { Link Here
141
        else {
159
        else {
142
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
160
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
143
        }
161
        }
144
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) ) {
162
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) && ( $is_vimeo != 1 ) ) {
145
            next; # not a specified media file
163
            next; # not a specified media file
146
        }
164
        }
147
        # youtube
165
        # youtube
Lines 149-154 sub gethtml5media { Link Here
149
            $HTML5Media{mime} = 'video/webm';
167
            $HTML5Media{mime} = 'video/webm';
150
            $HTML5Media{type} = 'video';
168
            $HTML5Media{type} = 'video';
151
        }
169
        }
170
        # vimeo
171
        if ($is_vimeo == 1) {
172
            $HTML5Media{mime} = 'video/webm';
173
            $HTML5Media{type} = 'video';
174
        }
152
        # mime
175
        # mime
153
        if ( $HTML5Media_field->subfield('c') ) {
176
        if ( $HTML5Media_field->subfield('c') ) {
154
            $HTML5Media{codecs} = $HTML5Media_field->subfield('c');
177
            $HTML5Media{codecs} = $HTML5Media_field->subfield('c');
(-)a/installer/data/mysql/atomicupdate/bug_19339-HTML5MediaVimeo_syspref.pl (+15 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "19339",
6
    description => "Enhance streaming cataloging to include Vimeo",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('HTML5MediaVimeo',0,'Embed|Don\'t embed','Vimeo links as videos','YesNo')});
12
13
        say_success( $out, "Added new system preference 'HTML5MediaVimeo'" );
14
    },
15
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 316-321 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
316
('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'),
316
('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'),
317
('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','','Media file extensions','free'),
317
('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','','Media file extensions','free'),
318
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
318
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
319
('HTML5MediaVimeo',0,'Embed|Don\'t embed','Vimeo links as videos','YesNo'),
319
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
320
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
320
('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
321
('ILLCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
321
('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'),
322
('ILLDefaultStaffEmail', '', NULL, 'Fallback email address for staff ILL notices to be sent to in the absence of a branch address', 'Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+6 lines)
Lines 339-344 Enhanced content: Link Here
339
                  1: "Embed"
339
                  1: "Embed"
340
                  0: "Don't embed"
340
                  0: "Don't embed"
341
            - YouTube links as videos.
341
            - YouTube links as videos.
342
        -
343
            - pref: HTML5MediaVimeo
344
              choices:
345
                  1: "Embed"
346
                  0: "Don't embed"
347
            - Vimeo links as videos.
342
    OverDrive:
348
    OverDrive:
343
        -
349
        -
344
            - pref: OPACOverDrive
350
            - pref: OPACOverDrive
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (+2 lines)
Lines 832-837 Link Here
832
                                        <p>
832
                                        <p>
833
                                            [% IF HTML5MediaSet.is_youtube %]
833
                                            [% IF HTML5MediaSet.is_youtube %]
834
                                                <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
834
                                                <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
835
                                            [% ELSIF HTML5MediaSet.is_vimeo %]
836
                                                <iframe id="player" width="640" height="360" src="[% HTML5MediaSet.srcblock | url %]"></iframe>
835
                                            [% ELSE %]
837
                                            [% ELSE %]
836
                                                <[% HTML5MediaParent | html %] controls preload=none>
838
                                                <[% HTML5MediaParent | html %] controls preload=none>
837
                                                    <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] />
839
                                                    <[% HTML5MediaSet.child | html %] src="[% HTML5MediaSet.srcblock | url %]"[% HTML5MediaSet.typeblock | html %] />
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-1 / +3 lines)
Lines 924-929 Link Here
924
                                        [% IF HTML5MediaSet.is_youtube %]
924
                                        [% IF HTML5MediaSet.is_youtube %]
925
                                            <iframe id="player" type="text/html" width="640" height="360"
925
                                            <iframe id="player" type="text/html" width="640" height="360"
926
                                                src="[% HTML5MediaSet.srcblock | url %]" frameborder="0"></iframe>
926
                                                src="[% HTML5MediaSet.srcblock | url %]" frameborder="0"></iframe>
927
                                        [% ELSIF HTML5MediaSet.is_vimeo %]
928
                                            <iframe id="player" type="text/html" width="640" height="360"
929
                                                src="[% HTML5MediaSet.srcblock | url %]" frameborder="0"></iframe>
927
                                        [% ELSE %]
930
                                        [% ELSE %]
928
                                            [% SET ctrl_preload = ' controls preload=none' #translatability %]
931
                                            [% SET ctrl_preload = ' controls preload=none' #translatability %]
929
                                            <[% HTML5MediaParent _ ctrl_preload | html %] >
932
                                            <[% HTML5MediaParent _ ctrl_preload | html %] >
930
- 

Return to bug 19339