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

(-)a/C4/HTML5Media.pm (-1 / +23 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', $video_id;
125
126
                    $HTML5Media{is_vimeo} = 1;
127
                    $is_vimeo = 1;
128
                }
129
               else {
130
                   next; # do not embed vimeo videos
131
               }
132
            }
116
        }
133
        }
117
        elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) {
134
        elsif ( $HTML5Media_field->subfield('a') && $HTML5Media_field->subfield('d') && $HTML5Media_field->subfield('f') ) {
118
            $HTML5Media{host}        = $HTML5Media_field->subfield('a');
135
            $HTML5Media{host}        = $HTML5Media_field->subfield('a');
Lines 141-147 sub gethtml5media { Link Here
141
        else {
158
        else {
142
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
159
            $HTML5Media{extension} = ($HTML5Media{srcblock} =~ m/([^.]+)$/)[0];
143
        }
160
        }
144
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) ) {
161
        if ( ( !grep /\Q$HTML5Media{extension}\E/, @HTML5MediaExtensions ) && ( $is_youtube != 1) && ( $is_vimeo != 1 ) ) {
145
            next; # not a specified media file
162
            next; # not a specified media file
146
        }
163
        }
147
        # youtube
164
        # youtube
Lines 149-154 sub gethtml5media { Link Here
149
            $HTML5Media{mime} = 'video/webm';
166
            $HTML5Media{mime} = 'video/webm';
150
            $HTML5Media{type} = 'video';
167
            $HTML5Media{type} = 'video';
151
        }
168
        }
169
        # vimeo
170
        if ($is_vimeo == 1) {
171
            $HTML5Media{mime} = 'video/webm';
172
            $HTML5Media{type} = 'video';
173
        }
152
        # mime
174
        # mime
153
        if ( $HTML5Media_field->subfield('c') ) {
175
        if ( $HTML5Media_field->subfield('c') ) {
154
            $HTML5Media{codecs} = $HTML5Media_field->subfield('c');
176
            $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 (-1 / +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
345
- 

Return to bug 19339