<?php

/*
 *    This file is part of izap-videos plugin for Elgg.
 *
 *    izap-videos for Elgg 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 2 of the License, or
 *    (at your option) any later version.
 *
 *    izap-videos for Elgg 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 izap-videos for Elgg.  If not, see <http://www.gnu.org/licenses/>.
 */
elgg_load_library('elgg:izap_video');
$queue = izap_run_queue_izap_videos();
foreach ($queue as $pending) {
    $converted = izap_convert_video_izap_videos($pending['main_file'], $pending['guid'], $pending['title'], $pending['url'], $pending['owner_id']);
    echo $converted;
}
Ejemplo n.º 2
0
/**
 * Fetch videos from queue and send these videos for conversion
 * 
 * @return boolean
 * 
 * @version 5.0
 */
function izap_run_queue_izap_videos()
{
    $queue_object = new izapQueue();
    $queue = $queue_object->fetch_videos();
    if (defined('IZAP_VIDEO_UNIT_TEST')) {
        if (IZAP_VIDEO_UNIT_TEST === True) {
            global $CONFIG;
            $converted = izap_convert_video_izap_videos($CONFIG->dataroot . '/test_video.avi', '', '', '', 77);
        }
    } elseif (is_array($queue)) {
        izap_get_all_access();
        foreach ($queue as $pending) {
            $converted = izap_convert_video_izap_videos($pending['main_file'], $pending['guid'], $pending['title'], $pending['url'], $pending['owner_id']);
            $izap_video = get_entity($pending['guid']);
            if (is_array($converted) && $converted['error']) {
                $izap_video->converted = 'no';
                $queue_object->move_to_trash($pending['guid']);
            } else {
                $izap_video->converted = 'yes';
                $queue_object->delete($pending['guid']);
            }
        }
        if ($queue_object->count() > 0) {
            izap_run_queue_izap_videos();
        }
    }
    return true;
}