* * * 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 . * ************************************************/ // Check whether we are indeed included by Piwigo. if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); // Hook to add a new filter in the batch mode add_event_handler('get_batch_manager_prefilters', 'vjs_get_batch_manager_prefilters'); function vjs_get_batch_manager_prefilters($prefilters) { $prefilters[] = array('ID' => 'videojs0', 'NAME' => l10n('All videos')); $prefilters[] = array('ID' => 'videojs1', 'NAME' => l10n('All videos with poster')); $prefilters[] = array('ID' => 'videojs2', 'NAME' => l10n('All videos without poster')); return $prefilters; } // Hook to perfom the filter in the batch mode add_event_handler('perform_batch_manager_prefilters', 'vjs_perform_batch_manager_prefilters', 50, 2); function vjs_perform_batch_manager_prefilters($filter_sets, $prefilter) { if ($prefilter==="videojs0") $filter = ""; else if ($prefilter==="videojs1") $filter = "AND `representative_ext` IS NOT NULL"; else if ($prefilter==="videojs2") $filter = "AND `representative_ext` IS NULL"; if ( isset($filter) ) { $query = "SELECT id FROM ".IMAGES_TABLE." WHERE ".SQL_VIDEOS." ".$filter; $filter_sets[] = array_from_query($query, 'id'); } return $filter_sets; } // Hook to show action when selected add_event_handler('loc_end_element_set_global', 'vjs_loc_end_element_set_global'); function vjs_loc_end_element_set_global() { global $template; $template->append('element_set_global_plugins_actions', array('ID' => 'videojs', 'NAME'=>l10n('Videos'), 'CONTENT' => ' ')); } // Hook to perform the action on in global mode add_event_handler('element_set_global_action', 'vjs_element_set_global_action', 50, 2); function vjs_element_set_global_action($action, $collection) { if ($action!=="videojs") return; global $page; $query = "SELECT `id`, `file`, `path` FROM ".IMAGES_TABLE." WHERE id IN (".implode(',',$collection).")"; // Override default value from the form $sync_options = array( 'metadata' => isset($_POST['vjs_metadata']), 'thumb' => isset($_POST['vjs_thumb']), 'thumbsec' => $_POST['vjs_thumbsec'], 'thumbouput' => $_POST['vjs_thumbouput'], 'thumboverlay' => isset($_POST['vjs_thumboverlay']), 'simulate' => false, 'sync_gps' => true, ); // Do the work, share with batch manager require_once(dirname(__FILE__).'/../include/function_sync.php'); $page['errors'] = $errors; $page['infos'] = $infos; } // Hook to perform the action on in single mode add_event_handler('loc_begin_element_set_unit', 'vjs_loc_begin_element_set_unit'); function vjs_loc_begin_element_set_unit() { global $page; if (!isset($_POST['submit'])) return; $collection = explode(',', $_POST['element_ids']); foreach ($collection as $id) { if (!isset($_POST['vjs_thumbsec-'.$id])) return; // Override default value from the form $sync_options = array( 'metadata' => isset($_POST['vjs_metadata-'.$id]), 'thumb' => isset($_POST['vjs_thumb-'.$id]), 'thumbsec' => $_POST['vjs_thumbsec-'.$id], 'thumbouput' => $_POST['vjs_thumbouput-'.$id], 'thumboverlay' => isset($_POST['vjs_thumboverlay-'.$id]), 'simulate' => false, 'sync_gps' => true, ); $query = "SELECT `id`, `file`, `path` FROM ".IMAGES_TABLE." WHERE `id`='".$id."';"; // Do the work, share with batch manager include(dirname(__FILE__).'/../include/function_sync.php'); $page['errors'] = array_merge($page['errors'], $errors); $page['infos'] = array_merge($page['infos'], $infos); } } // Hoook for batch manager in single mode add_event_handler('loc_end_element_set_unit', 'vjs_loc_end_element_set_unit'); function vjs_loc_end_element_set_unit() { global $template, $conf, $page, $is_category, $category_info; $template->set_prefilter('batch_manager_unit', 'vjs_prefilter_batch_manager_unit'); } function vjs_prefilter_batch_manager_unit($content) { $needle = ''; $pos = strpos($content, $needle); if ($pos!==false) { $add = '{\'VideoJS\'|@translate}
Will overwrite the information in the database with the metadata from the video.
Support of latitude, longitude required \'OpenStreetMap\' or \'RV Maps & Earth\' plugin.

Create a thumbnail from the video at specify position, it will overwrite any existing poster.

Select the output format for the thumbnail

Apply an overlay on the poster creation.
'; $content = substr_replace($content, $add, $pos, 0); } return $content; } ?>