Esempio n. 1
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;
}
Esempio n. 2
0
function izapRunQueue_izap_videos()
{
    $queue_object = new izapQueue();
    $queue = $queue_object->fetch_videos();
    if (is_array($queue)) {
        foreach ($queue as $pending) {
            $converted = izapConvertVideo_izap_videos($pending['main_file'], $pending['guid'], $pending['title'], $pending['url'], $pending['owner_id']);
            if (!$converted) {
                $queue_object->move_to_trash($pending['guid']);
            }
            $queue_object->delete($pending['guid']);
            izap_update_all_defined_access_id($pending['guid'], $pending['access_id']);
        }
        // re-check if there are new videos in the queue
        if ($queue_object->count() > 0) {
            izapRunQueue_izap_videos();
        }
    }
    return true;
}