Piwigo / piwigo-videojs

Videojs port for piwigo. Play your videos on your web gallery!
http://piwigo.org/ext/extension_view.php?eid=610
GNU General Public License v3.0
67 stars 46 forks source link

Wrong Datatype for "Duration" for particular files #197

Closed Niklashere closed 3 weeks ago

Niklashere commented 1 year ago

Hi all,

I stumbled upon an issue with the plugin yesterday, in which some videos will not receive all their metadata.

This is the error code:

Fatal error: Uncaught TypeError: Unsupported operand types: array * int in /config/www/plugins/piwigo-videojs/include/exiftool.php:58 Stack trace: #0 /config/www/plugins/piwigo-videojs/include/function_sync2.php(80): include() #1 /config/www/plugins/piwigo-videojs/admin/admin_batchmanager.php(180): require_once('...') #2 /app/www/public/include/functions_plugins.inc.php(264): vjs_element_set_global_action() #3 /app/www/public/admin/batch_manager_global.php(425): trigger_notify() #4 /app/www/public/admin/batch_manager.php(814): include('...') #5 /app/www/public/admin.php(345): include('...') #6 {main} thrown in /config/www/plugins/piwigo-videojs/include/exiftool.php on line 58

The problem is that, for whatever reason for particular files, the output of Duration ($general['Duration']) is an array rather than an int.

I've added a basic workaround at line 58, but the developers should take a look at why exactly this error occurs.

Workarround for file /config/www/plugins/piwigo-videojs/include/exiftool.php:

        if (is_int($general['Duration'])) {
                $exif['duration'] = round($general['Duration']*1000, 0);
        } elseif (is_array($general['Duration'])) {
                $exif['duration'] = round($general['Duration']['Value']*1000, 0);
        }

Kind regards

EddyLB commented 3 weeks ago

Fixed with https://github.com/Piwigo/piwigo-videojs/pull/229