Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issues, adopts native browser player by default #229

Merged
merged 12 commits into from
Sep 1, 2024
14 changes: 13 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Changes from v2.9.b to v2.10
- Adopts native browser player by default
- Adds translations and fixes typos
- Fixes #133, #205: crash occurring when ExifTool returns a wrong date_creation (thanks @Catfriend1)
- Fixes #136: updates VideoJS player to version 7.21.5 (thanks to @klaoun)
- Fixes #179, #197, #205: a crash occurring when the duration returned by ExifTool is an array
- Fixes #205: deprecated float to int casting (thanks to @klaoun)
- Fixes #140, #214: no thumbnail produced from very short videos
- Fixes #192, #216: calls binaries with system() or exec() according to their availability
- Fixes #194, #201, #203, #217, #228: undefined array key "resolution" warning (thanks to @klaoun)
- Fixes #145, #153, #162, #189, #204, #222: undefined array key "vjs_sync" warning

Changes from v2.9.a to v2.9.b
- Fix configuration initalize
- Fix configuration initialisation
- Add our own sql metadata table
- Update VideoJS player to version 6.11.0
- Update VideoJS player to version 7.1.0
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Then, go to the admin site, in the plugin section and activate it.
Requirement
-----

Piwigo-videojs require those 2 programs to be install on your system:
Piwigo-videojs requires software to be installed on your server:

* [MediaInfo](http://mediaarea.net/en/MediaInfo)
* [Libav](https://libav.org/)
* [FFmpeg](http://www.ffmpeg.org/)
* [ExifTool](https://exiftool.org)
* [FFmpeg](http://www.ffmpeg.org)

Please refer to the [wiki](https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#step-2-install) for additional information.

Expand All @@ -53,19 +53,20 @@ Please refer to the [wiki](https://github.com/xbgmsharp/piwigo-videojs/wiki) for

Support
-----
Please have a look at the forums if you encounter some issues during installation.

To get support, please create new [issue](https://github.com/xbgmsharp/piwigo-videojs/issues)
To report bugs and suggest new features, please create a new [issue](https://github.com/xbgmsharp/piwigo-videojs/issues)

Help me improve the plugin, rate my [plugin](http://piwigo.org/ext/extension_view.php?eid=610), and if possible please send a greeting message to me ;)

Thanks
-----

* [videojs](http://videojs.com/)
* [getid3](http://getid3.sourceforge.net/)
* [getID3](http://getid3.sourceforge.net/)
* [FFmpeg](http://www.ffmpeg.org/)
* [MediaInfo](http://mediaarea.net/en/MediaInfo)
* [Libav](https://libav.org/)
* [ExifTool](https://exiftool.org)
* [piwigo-jplayer](https://github.com/d-matt/piwigo-jplayer)

Licence
Expand Down
2 changes: 1 addition & 1 deletion admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 24.06.2012
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
10 changes: 5 additions & 5 deletions admin/admin_batchmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 4.06.2013
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -68,7 +68,7 @@ function vjs_loc_end_element_set_global()
<li>
<label><input type="checkbox" name="vjs_metadata" value="1" checked="checked" /> filesize, width, height, latitude, longitude, date_creation, rotation</label>
<br/><small>Will overwrite the information in the database with the metadata from the video.</small>
<br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'MediaInfo\' or \'ffprobe\' or \'Exiftool\'</a> to be install.</strong></small>
<br/><small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'MediaInfo\' or \'ffprobe\' or \'Exiftool\'</a> to be installed.</strong></small>
</li>
</ul>
<legend>Poster</legend>
Expand All @@ -78,7 +78,7 @@ function vjs_loc_end_element_set_global()
<!-- <input type="range" name="vjs_postersec" value="4" min="0" max="60" step="1"/> -->
<input type="text" name="vjs_postersec" value="4" size="2" required/>
<br/><small>Create a poster from the video at specify position.</small>
<br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'FFmpeg\'</a> to be install.</strong></small>
<br/><small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'FFmpeg\'</a> to be installed.</strong></small>
</li>
<li>
<label><input type="checkbox" name="vjs_posteroverwrite" value="1" checked="checked"> Overwrite existing posters</label>
Expand Down Expand Up @@ -266,7 +266,7 @@ function vjs_prefilter_batch_manager_unit($content)
<li>
<label><input type="checkbox" name="vjs_metadata-{$element.id}" value="1"/> filesize, width, height, latitude, longitude, date_creation, rotation</label>
<br/><small>Will overwrite the information in the database with the metadata from the video.</small>
<br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'MediaInfo\' or \'ffprobe\' or \'Exiftool\'</a> to be install.</strong></small>
<br/><small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'MediaInfo\' or \'ffprobe\' or \'Exiftool\'</a> to be installed.</strong></small>
</li>
</ul>
<legend>Poster</legend>
Expand All @@ -276,7 +276,7 @@ function vjs_prefilter_batch_manager_unit($content)
<!-- <input type="range" name="vjs_postersec-{$element.id}" value="4" min="0" max="60" step="1"/> -->
<input type="text" name="vjs_postersec-{$element.id}" value="4" size="2" required/>
<br/><small>Create a poster from the video at specify position.</small>
<br/><small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'FFmpeg\'</a> to be install.</strong></small>
<br/><small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">\'FFmpeg\'</a> to be installed.</strong></small>
</li>
<li>
<label><input type="checkbox" name="vjs_posteroverwrite-{$element.id}" value="1" checked="checked"> Overwrite existing posters</label>
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 6.06.2013
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
4 changes: 2 additions & 2 deletions admin/admin_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 24.06.2012
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,11 +39,11 @@

// Available player
$available_players = array(
'html5-player.tpl' => 'Native Browser',
'vjs-7-player.tpl' => 'Video.js v7',
'vjs-6-player.tpl' => 'Video.js v6',
'vjs-5-player.tpl' => 'Video.js v5',
'vjs-4-player.tpl' => 'Video.js v4',
'html5-player.tpl' => 'Native Browser',
);

// Available preload value
Expand Down
13 changes: 10 additions & 3 deletions admin/admin_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@
</style>
{/html_head}

This plugin add the open source HTML5 video player <a href="http://www.videojs.com/" target="_blank">VideoJS</a>.
<br/><br/>
Refer to the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blank">plugin documentation</a> for additional information. Create an <a href="https://github.com/xbgmsharp/piwigo-videojs/issues" target="_blank">issue</a> for support, or feedback, or feature request.
<fieldset>
<div style="text-align:left">
This plugin:<br/>
<ul>
<li class="update_summary_new">adds the open source HTML5 video player <a href="http://www.videojs.com/" target="_blank">VideoJS</a>.</li>
<li class="update_summary_new">extracts metadata with <a href="https://exiftool.org" target="_blank">ExifTool</a>, <a href="http://mediaarea.net/en/MediaInfo" target="_blank">MediaInfo</a> or <a href="http://www.ffmpeg.org" target="_blank">FFprobe</a> (if available)</li>
<li class="update_summary_new">produces thumbnails with <a href="http://www.ffmpeg.org" target="_blank">FFmpeg</a> (if available)</li>
</ul>
</div>
</fieldset>

<div class="vjs_layout">
<legend>{'Statistics'|@translate}</legend>
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 10.07.2013
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_rotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Created : 16.03.2015
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 4.06.2013
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
18 changes: 13 additions & 5 deletions admin/admin_sync.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@ jQuery(".showInfo").tipTip({
});
{/literal}{/footer_script}

Synchronization of metadata information and poster creation for videos.
<br/><br/>
Refer to the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blank">plugin documentation</a> for additional information. Create an <a href="https://github.com/xbgmsharp/piwigo-videojs/issues" target="_blank">issue</a> for support, or feedback, or feature request.
<fieldset>
<div style="text-align:left">
Synchronization of metadata information and thumbnail creation for videos:<br/>
<ul>
<li class="update_summary_new">extracts metadata with <a href="https://exiftool.org" target="_blank">ExifTool</a>, <a href="http://mediaarea.net/en/MediaInfo" target="_blank">MediaInfo</a> or <a href="http://www.ffmpeg.org" target="_blank">FFprobe</a> (if available)</li>
<li class="update_summary_new">produces thumbnails with <a href="http://www.ffmpeg.org" target="_blank">FFmpeg</a> (if available)</li>
</ul>
Refer to the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="_blank">plugin documentation</a> for additional information and look at the <a href="https://piwigo.org/forum/" target="_blank">forums</a> if you encounter some issues.<br/>
To report bugs and suggest new features, please create a new <a href="https://github.com/xbgmsharp/piwigo-videojs/issues" target="_blank">issue</a>.
</div>
</fieldset>

<div class="vjs_layout">
<legend>{'Statistics'|@translate}</legend>
Expand Down Expand Up @@ -126,7 +134,7 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="
<li>
<label><input type="checkbox" name="metadata" value="1" {if $metadata}checked="checked"{/if} /> filesize, width, height, latitude, longitude, date_creation, rotation</label>
<br/><small>{'SYNC_METADATA_DESC'|@translate}</small>
<small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">'MediaInfo' or 'ffprobe' or 'Exiftool'</a> to be install.</strong></small>
<small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">'MediaInfo' or 'ffprobe' or 'Exiftool'</a> to be installed.</strong></small>
</li>
</ul>
</fieldset>
Expand All @@ -139,7 +147,7 @@ Refer to the <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki" target="
<!-- <input type="range" name="postersec" value="4" min="0" max="60" step="1"/> -->
<input type="text" name="postersec" value="{$postersec}" size="2" required/>
<br/><small>{'SYNC_POSTER_DESC'|@translate}</small>
<small><strong>Require <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">'FFmpeg'</a> to be install.</strong></small>
<small><strong>Requires <a href="https://github.com/xbgmsharp/piwigo-videojs/wiki/How-to-add-videos#external-tools" target="_blank">'FFmpeg'</a> to be installed.</strong></small>
</li>
<li>
<label><input type="checkbox" name="posteroverwrite" value="1" {if $posteroverwrite}checked="checked"{/if}> {'SYNC_POSTEROVERWRITE'|@translate}</label>
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_tech.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 4.06.2013
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
20 changes: 18 additions & 2 deletions include/exiftool.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 02.04.2015
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -49,13 +49,29 @@
}

/* General */
global $logger;
if (isset($general['FileSize']))
{
$exif['filesize'] = round($general['FileSize']/1024);
}
if (isset($general['Duration']))
{
$exif['duration'] = round($general['Duration']*1000, 0);
if (is_array($general['Duration']))
{
$durationArray = $general['Duration'];
foreach ($durationArray as $key => $value)
{
$logger->info('exiftool : $durationArray has '.$value.' for key '.$key);
}
$duration = $durationArray['Scale'] * $durationArray['Value'];
$logger->info('exiftool : duration of '.round($duration).' seconds');
$exif['duration'] = round($duration * 1000, 0);
}
else
{
$logger->info('exiftool : duration of '.$general['Duration'].' seconds');
$exif['duration'] = round($general['Duration']*1000, 0);
}
}
if (isset($general['TrackDuration']))
{
Expand Down
2 changes: 1 addition & 1 deletion include/ffprobe.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Created : 21.07.2018
*
* Copyright 2012-2018 <[email protected]>
* Copyright 2012-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
Expand Down
59 changes: 59 additions & 0 deletions include/function_caller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/***********************************************
* File : function_caller.php
* Project : piwigo-videojs
* Descr : Executes external programs with system() or exec()
* according to availability
*
* Created : 26.12.2023
*
* Copyright 2023-2024 <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
************************************************/

// Returns if system() or exec() is allowed
function isAvailable($func)
{
if (ini_get('safe_mode')) return false;
$disabled = ini_get('disable_functions');
if ($disabled) {
$disabled = explode(',', $disabled);
$disabled = array_map('trim', $disabled);
return !in_array($func, $disabled);
}
return true;
}

function execCMD($cmd)
{
global $logger;
$retval = null;
$output = null;

if (isAvailable('system')) {
$output = system($cmd, $retval);
$logger->info('system('.$cmd.') returns '.$output.', retval: '.$retval);
return $retval;
}
else if (isAvailable('exec')) {
exec($cmd, $output, $retval);
$outputStr = implode(',', $output);
$logger->info('exec('.$cmd.') returns '.$outputStr.', retval: '.$retval);
return $retval;
}
return 127;
}
Loading